SpearmanCorrelation<T>

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

Spearman rank correlation for feature selection.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

While Pearson correlation only detects linear relationships, Spearman detects any monotonic relationship (consistently increasing or decreasing). It works by ranking values, so outliers have less impact. Perfect for ordinal data or when relationships are curved but consistent.

How It Works

Measures the monotonic relationship between features and target using ranks instead of raw values. Robust to outliers and non-linear monotonic relationships.

Constructors

Constructor Summary
SpearmanCorrelation(int nFeaturesToSelect, double minCorrelation, int[] columnIndices)

Properties

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