Pipeline Element

The pipeline element class is essential for adding logic to your pipeline. Each element encapsulates an algorithm or a method you want to use. With the pipeline element class we add the functionality of completely disabling an item as well as storing, preparing and managing the hyperparameter space for it.

We have preregistered many already implemented preprocessing steps or models so you can easily add them via their name. See PHOTON Register.list() for a complete list of registered items. You can register your own, too.

# SHOW WHAT IS POSSIBLE IN THE CONSOLE
PhotonRegister.list()

# NOW FIND OUT MORE ABOUT A SPECIFIC ELEMENT
PhotonRegister.info('SVC')

...
# then do feature selection using a PCA, specify which values to try in the hyperparameter search
my_pipe += PipelineElement('PCA', hyperparameters={'n_components': [5, 10, None]}, test_disabled=True)

# engage and optimize the good old SVM for Classification
my_pipe += PipelineElement('SVC', hyperparameters={'kernel': Categorical(['rbf', 'linear']),
                                                   'C': FloatRange(0.5, 2, "linspace", num=5)})

class PipelineElement

Photon wrapper class for any transformer or predictor element in the pipeline.

  1. Saves the hyperparameters that are to be tested and creates a grid of all hyperparameter configurations
  2. Enables fast and rapid instantiation of pipeline elements per string identifier, e.g 'svc' creates an sklearn.svm.SVC object.
  3. Attaches a "disable" switch to every element in the pipeline in order to test a complete disable

Parameters

  • name [str]: A string literal encoding the class to be instantiated
  • hyperparameters [dict]: Which values/value range should be tested for the hyperparameter. In form of "Hyperparameter_name: [array of parameter values to be tested]"
  • test_disabled [bool]: If the hyperparameter search should evaluate a complete disabling of the element
  • disabled [bool]: If true, the element is currently disabled and does nothing except return the data it received
  • kwargs [dict]: Any parameters that should be passed to the object to be instantiated, default parameters