ElasticNetFeatureSelection<T>
Models & Types ยท AiDotNet.Preprocessing.FeatureSelection.Embedded
Elastic Net regularization-based feature selection.
Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> โ ElasticNetFeatureSelection<T>
Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>
For Beginners
Elastic Net is a compromise between Lasso and Ridge regression. When features are highly correlated, Lasso tends to pick one and ignore the others. Elastic Net groups correlated features together, selecting them as a group rather than arbitrarily picking one.
How It Works
Elastic Net combines L1 (Lasso) and L2 (Ridge) regularization. Like Lasso, it can drive coefficients to zero for feature selection, but the L2 component helps when features are correlated. The l1_ratio parameter controls the mix between L1 and L2.
Constructors
| Constructor | Summary |
|---|---|
ElasticNetFeatureSelection(int nFeaturesToSelect, double alpha, double l1Ratio, int maxIterations, double tolerance, 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) |