Pipeline Element

So called PHOTONAI PipelineElements can be added to the Hyperpipe, each of them being a data-processing method or a learning algorithm. By choosing and combining data-processing methods and algorithms and arranging them with the PHOTONAI classes, both simple and complex pipeline architectures can be designed rapidly.

The PHOTONAI PipelineElement implements several helpful features.

1. Easy access to various methods and algorithms across diverse toolboxes.
If, the user wants to access the support vector machine for classification implemented in scikit-learn, he can access it by simply adding a PipelineElement with the name “SVC” to the Hyperpipe. Internally the object is referenced and instantiated.

2. Simple syntax for the specification of the hyperparameters
their dimension: a categorical finite list of options, a range of floating point or a range of integer numbers. PHOTONAI communicates these parameters to the hyperparameter optimization strategy and ensures proper hyperparameter space initialization.

3. Disabling the pipeline element
Each PipelineElement has a parameter that is called ‘test_disabled’ functioning as an on- and off-switch adding additional functionality to the hyperparameter optimization process. Thereby, the hyperparameter optimization strategy can decide to completely disable any element in the pipeline if that suits a good performance.

4. AND- and OR-Element
For a more complex architecture, there are both an AND-Element as well as an OR-Element available called PHOTONAI Stack and PHOTONAI Switch, in which both particular PipelineElements or complete sub pipelines, called PHOTONAI Branches, can be combined.

5. Batching
For each PipelineElement you can specify the parameter batch_size. If given, PHOTONAI fits, transforms and predicts in batches containing n=num_data/batch_size elements.

Example

           
my_pipe += PipelineElement('StandardScaler')

my_pipe += PipelineElement('PCA',
                           hyperparameters={'n_components': IntegerRange(5, 20)},
                           test_disabled=True)

my_pipe += PipelineElement('ImbalancedDataTransform',
                           hyperparameters={'method_name': Categorical(['RandomUnderSampler',
                                                                        'SMOTE'])})

my_pipe += PipelineElement('SVC',
                           hyperparameters={'kernel': Categorical(['rbf', 'linear']),
                                            'C': FloatRange(0.5, 2)})

# DO BATCHING
atlas = PipelineElement('BrainAtlas', batch_size=20,
                        rois=['Hippocampus_L', 'Hippocampus_R', 'Amygdala_L', 'Amygdala_R'],
                        atlas_name="AAL", extract_mode='vec')
           
    

Parameters

Parameter Type Description
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, default=False If the hyperparameter optimization strategy shall evaluate a complete disabling of the element
batch_size int, default=None If given, PHOTONAI fits, transforms and predicts in batches containing n=num_data/batch_size elements.
kwargs Any parameters that should be passed to the object to be instantiated.