RidgeSelector<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Embedded

Ridge Regression (L2) based feature selection.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

Unlike Lasso (L1), Ridge doesn’t set coefficients exactly to zero. Instead, it shrinks all coefficients proportionally. Features with larger coefficients after shrinking are more important.

How It Works

Ridge regression adds L2 regularization to linear regression, shrinking coefficients toward zero. Features with larger absolute coefficients after regularization are considered more important.

Constructors

Constructor Summary
RidgeSelector(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)