LassoFS<T>

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

LASSO (Least Absolute Shrinkage and Selection Operator) for feature selection.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

LASSO is a special kind of linear regression that automatically picks only the most important features. It does this by adding a penalty that forces unimportant feature weights to become exactly zero, effectively removing them from the model.

How It Works

LASSO uses L1 regularization during linear regression training, which naturally drives some coefficients to exactly zero. Features with non-zero coefficients are selected for the final model.

Constructors

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

Properties

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