ReliefF<T>
Models & Types · AiDotNet.Preprocessing.FeatureSelection.Filter
ReliefF algorithm for feature selection based on nearest neighbor differences.
Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> → ReliefF<T>
Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>
For Beginners
ReliefF picks random samples and looks at their nearest neighbors. If a feature differs between a sample and its nearby “enemies” (different class) but stays similar to nearby “friends” (same class), it’s useful. The algorithm rewards features that help separate classes and penalizes those that don’t.
How It Works
ReliefF estimates feature relevance by sampling instances and comparing them to their nearest neighbors of the same class (hits) and different classes (misses). Features that differentiate between classes get higher weights.
Constructors
| Constructor | Summary |
|---|---|
ReliefF(int nFeaturesToSelect, int nNeighbors, int nSamples, int? randomState, int[] columnIndices) |
Properties
| Property | Summary |
|---|---|
Vector<T> FeatureWeights { get; } |
|
bool SupportsInverseTransform { get; } |
|
int NFeaturesToSelect { get; } |
|
int NNeighbors { 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) |