LassoFeatureSelection<T>

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

L1 (Lasso) regularization-based feature selection.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

Lasso is like a strict editor that removes unnecessary words from a sentence. The L1 penalty forces some feature weights to become exactly zero, automatically removing unimportant features. Stronger regularization means more features get eliminated, leaving only the most essential ones.

How It Works

Lasso regression uses L1 regularization which drives some coefficients exactly to zero, effectively performing feature selection. Features with non-zero coefficients are selected. The regularization strength controls how many features are zeroed out.

Constructors

Constructor Summary
LassoFeatureSelection(int nFeaturesToSelect, double alpha, int maxIterations, double tolerance, int[] columnIndices)

Properties

Property Summary
Vector<T> Coefficients { get; }
bool SupportsInverseTransform { get; }
double Alpha { 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)