pyeeg.features.FeatureReducer

class pyeeg.features.FeatureReducer(config: ReductionConfig)

Reduce the dimensionality of feature sets.

Provides a scikit-learn-like interface for reducing 2D feature matrices (samples x features) to a lower-dimensional space. The reduction behavior is governed by the method field of the configuration:

  • "pca": principal component analysis. Components are the principal eigenvectors of the feature covariance, sorted by descending eigenvalue; the number retained is n_components or is derived from variance_threshold.

  • "ica": independent component analysis implemented as a whitening transform of the centered data. The number retained is n_components or the full input dimensionality.

  • "none": identity transformation; features pass through unchanged.

Data is centered (mean subtracted per feature) before reduction, and the fitted mean is added back by inverse_transform().

Parameters:

config (ReductionConfig) – Configuration of the reduction method and component selection.

config

Configuration of the reducer.

Type:

ReductionConfig

_fitted

Whether fit() has been called successfully.

Type:

bool

_components

Fitted component matrix (rows are components), or None before fit / for method='none'.

Type:

ndarray or None

_explained_variance

Per-component explained variance ratios (PCA only), or None otherwise.

Type:

ndarray or None

_mean

Per-feature mean used to center the data, or None before fit.

Type:

ndarray or None

_n_components

Number of retained components, or None before fit.

Type:

int or None

Methods

FeatureReducer.fit(features)

Fit the reducer to the features.

FeatureReducer.fit_transform(features)

Fit the reducer and transform the features.

FeatureReducer.get_components()

Return the fitted components.

FeatureReducer.get_explained_variance()

Return the per-component explained variance ratios.

FeatureReducer.get_n_components()

Return the number of retained components.

FeatureReducer.inverse_transform(...)

Transform reduced features back to original space.

FeatureReducer.transform(features)

Transform features to reduced space.