FairFeatureSelector<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Fairness

Fair Feature Selection that balances predictive power with fairness constraints.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

In ML fairness, we want models that don’t discriminate based on protected attributes like race or gender. This selector chooses features that are good for prediction but have low correlation with a specified protected attribute. This helps build fairer models by removing proxies for protected groups.

How It Works

Selects features that maximize predictive accuracy while minimizing correlation with protected attributes to promote fair predictions.

Constructors

Constructor Summary
FairFeatureSelector(int nFeaturesToSelect, int protectedAttributeIndex, double fairnessWeight, int[] columnIndices)

Properties

Property Summary
Vector<T> CombinedScores { get; }
Vector<T> FairnessScores { get; }
Vector<T> PredictiveScores { get; }
bool SupportsInverseTransform { get; }
double FairnessWeight { get; }
int NFeaturesToSelect { get; }
int ProtectedAttributeIndex { get; }
int[] SelectedIndices { get; }

Methods

Method Summary
Matrix<T> FitTransform(Matrix<T> data, Vector<T> target)
T GetDisparateImpact(Matrix<T> data, int featureIndex) Computes the disparate impact ratio for a specific feature.
bool[] GetSupportMask()
string[] GetFeatureNamesOut(string[] inputFeatureNames)
void Fit(Matrix<T> data, Vector<T> target)