baikal.steps.make_step¶
-
baikal.steps.
make_step
(base_class, attr_dict=None)¶ Creates a step subclass from the given base class.
For example, calling:
PCA = make_step(sklearn.decomposition.PCA)
is equivalent to:
class PCA(Step, sklearn.decomposition.PCA): def __init__(self, name=None, n_outputs=1, **kwargs): super().__init__(name=name, n_outputs=n_outputs, **kwargs)
- Parameters
base_class (type) – The base class to inherit from. It must implement the scikit-learn API.
attr_dict (dict) – Dictionary of additional attributes for the class. You can use this to add methods such as
fit_compute
to the class. (keys: name of attribute (str
), values: attributes).
- Returns
step_subclass (type) – A new class that inherits from both Step and the given base class and has the the specified attributes.