ElasticNetSelector<T>

Models & Types ยท AiDotNet.Preprocessing.FeatureSelection.Sparsity

Elastic Net based Feature Selection.

Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> โ†’ ElasticNetSelector<T>

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

Elastic Net combines Lasso (L1) and Ridge (L2) penalties. L1 selects features by zeroing coefficients; L2 groups correlated features together. The mix gives stable feature selection even when features are correlated, which pure Lasso struggles with.

How It Works

Selects features using Elastic Net regularization, which combines L1 and L2 penalties for better stability with correlated features.

Constructors

Constructor Summary
ElasticNetSelector(int nFeaturesToSelect, double alpha, double l1Ratio, int maxIterations, int[] columnIndices)

Properties

Property Summary
Vector<T> Coefficients { get; }
bool SupportsInverseTransform { get; }
double Alpha { get; }
double L1Ratio { get; }
int NFeaturesToSelect { get; }
int[] SelectedIndices { get; }

Methods

Method Summary
Matrix<T> FitTransform(Matrix<T> data, Vector<T> target)
bool[] GetSupportMask()
string[] GetFeatureNamesOut(string[] inputFeatureNames)
void Fit(Matrix<T> data, Vector<T> target)