Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Css fix plugin loading #117

Merged
merged 5 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions src/vai_lab/DataProcessing/plugins/binarizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,25 @@ class Binarizer(DataProcessingT):
Binarize data (set feature values to 0 or 1) according to a threshold
"""

def __init__(self, config = {}, data_in = [None]):
def __init__(self, config = {}, data_in = [None], ini = False):
"""Initialises parent class.
Passes `globals` dict of all current variables
"""
super().__init__(globals())
self.set_data_in(data_in)
self.configure(config)

try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise

if not ini:
# Model configuration
self.set_data_in(data_in)
self.configure(config)
# Model initialisation
try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise
else:
self.model = model

# Method mapping
self.fit_plugin = self.model.fit
self.transform_plugin = self.model.transform
26 changes: 15 additions & 11 deletions src/vai_lab/DataProcessing/plugins/kbinsdiscretizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,24 @@ class KBinsDiscretizer(DataProcessingT):
Bin continuous data into interval
"""

def __init__(self, config = {}, data_in = [None]):
def __init__(self, config = {}, data_in = [None], ini = False):
"""Initialises parent class.
Passes `globals` dict of all current variables
"""
super().__init__(globals())
self.set_data_in(data_in)
self.configure(config)

try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise

if not ini:
# Model configuration
self.set_data_in(data_in)
self.configure(config)
# Model initialisation
try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise
else:
self.model = model

self.fit_plugin = self.model.fit
self.transform_plugin = self.model.transform
26 changes: 15 additions & 11 deletions src/vai_lab/DataProcessing/plugins/labelbinarizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,24 @@ class LabelBinarizer(DataProcessingT):
"""
Binarize labels in a one-vs-all fashion
"""
def __init__(self, config = {}, data_in = [None]):
def __init__(self, config = {}, data_in = [None], ini = False):
"""Initialises parent class.
Passes `globals` dict of all current variables
"""
super().__init__(globals())
self.set_data_in(data_in)
self.configure(config)

try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise

if not ini:
# Model configuration
self.set_data_in(data_in)
self.configure(config)
# Model initialisation
try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise
else:
self.model = model

self.fit_plugin = self.model.fit
self.transform_plugin = self.model.transform
26 changes: 15 additions & 11 deletions src/vai_lab/DataProcessing/plugins/labelencoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,24 @@ class LabelEncoder(DataProcessingT):
Encode target labels with value between 0 and n_classes-1
"""

def __init__(self, config = {}, data_in = [None]):
def __init__(self, config = {}, data_in = [None], ini = False):
"""Initialises parent class.
Passes `globals` dict of all current variables
"""
super().__init__(globals())
self.set_data_in(data_in)
self.configure(config)

try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise

if not ini:
# Model configuration
self.set_data_in(data_in)
self.configure(config)
# Model initialisation
try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise
else:
self.model = model

self.fit_plugin = self.model.fit
self.transform_plugin = self.model.transform
26 changes: 15 additions & 11 deletions src/vai_lab/DataProcessing/plugins/maxabsscaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,24 @@ class MaxAbsScaler(DataProcessingT):
Scale each feature by its maximum absolute value
"""

def __init__(self, config = {}, data_in = [None]):
def __init__(self, config = {}, data_in = [None], ini = False):
"""Initialises parent class.
Passes `globals` dict of all current variables
"""
super().__init__(globals())
self.set_data_in(data_in)
self.configure(config)

try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise

if not ini:
# Model configuration
self.set_data_in(data_in)
self.configure(config)
# Model initialisation
try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise
else:
self.model = model

self.fit_plugin = self.model.fit
self.transform_plugin = self.model.transform
26 changes: 15 additions & 11 deletions src/vai_lab/DataProcessing/plugins/minmaxscaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,24 @@ class MinMaxScaler(DataProcessingT):
is in the given range on the training set, e.g. between zero and one
"""

def __init__(self, config = {}, data_in = [None]):
def __init__(self, config = {}, data_in = [None], ini = False):
"""Initialises parent class.
Passes `globals` dict of all current variables
"""
super().__init__(globals())
self.set_data_in(data_in)
self.configure(config)

try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise

if not ini:
# Model configuration
self.set_data_in(data_in)
self.configure(config)
# Model initialisation
try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise
else:
self.model = model

self.fit_plugin = self.model.fit
self.transform_plugin = self.model.transform
26 changes: 15 additions & 11 deletions src/vai_lab/DataProcessing/plugins/multilabelbinarizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,24 @@ class MultiLabelBinarizer(DataProcessingT):
Transform between iterable of iterables and a multilabel format
"""

def __init__(self, config = {}, data_in = [None]):
def __init__(self, config = {}, data_in = [None], ini = False):
"""Initialises parent class.
Passes `globals` dict of all current variables
"""
super().__init__(globals())
self.set_data_in(data_in)
self.configure(config)

try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise

if not ini:
# Model configuration
self.set_data_in(data_in)
self.configure(config)
# Model initialisation
try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise
else:
self.model = model

self.fit_plugin = self.model.fit
self.transform_plugin = self.model.transform
26 changes: 15 additions & 11 deletions src/vai_lab/DataProcessing/plugins/normalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,24 @@ class Normalizer(DataProcessingT):
Normalize samples individually to unit norm
"""

def __init__(self, config = {}, data_in = [None]):
def __init__(self, config = {}, data_in = [None], ini = False):
"""Initialises parent class.
Passes `globals` dict of all current variables
"""
super().__init__(globals())
self.set_data_in(data_in)
self.configure(config)

try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise

if not ini:
# Model configuration
self.set_data_in(data_in)
self.configure(config)
# Model initialisation
try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise
else:
self.model = model

self.fit_plugin = self.model.fit
self.transform_plugin = self.model.transform
26 changes: 15 additions & 11 deletions src/vai_lab/DataProcessing/plugins/onehotencoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,24 @@ class OneHotEncoder(DataProcessingT):
Encode categorical features as a one-hot numeric array
"""

def __init__(self, config = {}, data_in = [None]):
def __init__(self, config = {}, data_in = [None], ini = False):
"""Initialises parent class.
Passes `globals` dict of all current variables
"""
super().__init__(globals())
self.set_data_in(data_in)
self.configure(config)

try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise

if not ini:
# Model configuration
self.set_data_in(data_in)
self.configure(config)
# Model initialisation
try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise
else:
self.model = model

self.fit_plugin = self.model.fit
self.transform_plugin = self.model.transform
26 changes: 15 additions & 11 deletions src/vai_lab/DataProcessing/plugins/ordinalencoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,24 @@ class OrdinalEncoder(DataProcessingT):
Encode categorical features as an integer array
"""

def __init__(self, config = {}, data_in = [None]):
def __init__(self, config = {}, data_in = [None], ini = False):
"""Initialises parent class.
Passes `globals` dict of all current variables
"""
super().__init__(globals())
self.set_data_in(data_in)
self.configure(config)

try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise

if not ini:
# Model configuration
self.set_data_in(data_in)
self.configure(config)
# Model initialisation
try:
self.model = model(**self._config["options"])
except Exception as exc:
print('The plugin encountered an error on the parameters of '
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+': '+str(exc)+'.')
raise
else:
self.model = model

self.fit_plugin = self.model.fit
self.transform_plugin = self.model.transform
Loading
Loading