SPEC<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Filter.Spectral

SPEC (Spectral Feature Selection) for unsupervised feature selection.

Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> → SPEC<T>

Implements: IFixedCountFeatureSelector<T>

For Beginners

SPEC builds a graph where similar data points are connected. It then looks at the graph’s “shape” (via eigenvectors) and asks: which features align well with this structure? Features that respect the natural groupings in the data get high scores.

How It Works

SPEC ranks features based on their consistency with the structure of the data as captured by a similarity graph’s spectral representation. It uses the eigenvectors of the graph Laplacian to evaluate feature quality.

The score is phi3 of Zhao and Liu (2007), “Spectral Feature Selection for Supervised and Unsupervised Learning” (ICML): for the normalised Laplacian L = I - D^-1/2 W D^-1/2 of a k-nearest-neighbour Gaussian graph, sum_{j=2..k} (2 - lambda_j) (f^ . xi_j)^2 over its smallest eigenpairs (eigenvalues ascending, the trivial first one skipped) with f^ = D^1/2 f / ||D^1/2 f||; k is nEigenvectors. Features that vary smoothly over the graph score highest.

Constructors

Constructor Summary
SPEC(int nFeaturesToSelect, int nNeighbors, double sigma, int nEigenvectors, int[] columnIndices)

Properties

Property Summary
Vector<T> SpecScores { get; }
bool SupportsInverseTransform { get; }
int NFeaturesToSelect { get; }
int[] SelectedIndices { get; }

Methods

Method Summary
bool[] GetSupportMask()
string[] GetFeatureNamesOut(string[] inputFeatureNames)