ElasticNetSelector<T>
Models & Types ยท AiDotNet.Preprocessing.FeatureSelection.Embedded
Elastic Net (L1+L2) regularization-based feature selection.
Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> โ ElasticNetSelector<T>
Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>
For Beginners
Elastic Net is like having both a strict budget (L1) and a preference for simpler solutions (L2). This combination works well when features are correlated - pure Lasso might arbitrarily pick one from a group of correlated features, but Elastic Net tends to select or exclude them together.
How It Works
Combines L1 (Lasso) and L2 (Ridge) penalties to perform feature selection while handling correlated features better than pure Lasso. The l1_ratio parameter controls the mix of L1 and L2 penalties.
Constructors
| Constructor | Summary |
|---|---|
ElasticNetSelector(int nFeaturesToSelect, double alpha, double l1Ratio, int maxIterations, double tolerance, int[] columnIndices) |
Properties
| Property | Summary |
|---|---|
Vector<T> Coefficients { get; } |
|
bool SupportsInverseTransform { 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) |