RidgeFS<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Embedded

Ridge Regression-based feature selection.

Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> → RidgeFS<T>

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

Ridge regression shrinks all feature weights towards zero but never quite reaches it. Unlike LASSO, it keeps all features but makes less important ones smaller. We select features by choosing those with the biggest weights after shrinkage.

How It Works

Ridge Regression uses L2 regularization which shrinks all coefficients but doesn’t set them to exactly zero. Feature selection is done by selecting features with the largest absolute coefficients.

Constructors

Constructor Summary
RidgeFS(int nFeaturesToSelect, double alpha, 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)