features_extraction module#

@author: Théo Lambert

This module regroups all the functions related to feature extraction.

class features_extraction.FeatureExtractor(method, params={})#

Bases: object

Object for performing feature extraction / dimensionality reduction on input data. Accept either names of method from scikit-learn or custom feature extractors.

Parameters:
  • method (str | object) – If str, supported methods are ‘pca’, ‘ica’ and ‘nmf’, from the scikit-learn library. If object, the requirements are: - the output has the same first dimension as input data. - the object has either a ‘fit_predict’, ‘predict’, ‘fit_transform’ or ‘transform’ method.

  • params (dict) – Dictionary containing the arguments to be used for the initialization of the method.

process(data)#

Method for performing the feature extraction on input data.

Parameters:

data (ndarray) – 2D data with samples as lines and features as columns.

Returns:

res – 2D array containing the reduced data, with samples as lines and features as columns.

Return type:

ndarray

visualize(data)#

Method for visualizing the quality of the dimensionality reduction. Currently only implemented for PCA (plot of the cumulated explained variance ratio).

Parameters:

data (ndarray) – 2D data with samples as lines and features as columns