baikal.steps.make_step(base_class, attr_dict=None, class_name=None)

Creates a step subclass from the given base class.

For example, calling:

PCA = make_step(sklearn.decomposition.PCA, class_name="PCA")

is equivalent to:

class PCA(Step, sklearn.decomposition.PCA):
    def __init__(self, *args, name=None, n_outputs=1, **kwargs):
        super().__init__(*args, name=name, n_outputs=n_outputs, **kwargs)
  • base_class – The base class to inherit from. It must implement the scikit-learn API.

  • attr_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).

  • class_name – Name of the step class. If None, the name will be the name of the given base class.


step_subclass – A new class that inherits from both Step and the given base class and has the the specified attributes.