Boruta<T>
Models & Types · AiDotNet.Preprocessing.FeatureSelection.Embedded
Boruta feature selection algorithm.
Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> → Boruta<T>
Implements: ISupervisedFeatureSelector<T>
For Beginners
Boruta asks: “Is this feature better than random noise?”
It creates “shadow” features by shuffling your real features randomly. If your original feature has higher importance than these random shadows, it’s probably useful. If it’s worse than random noise, it’s rejected.
Unlike SelectKBest which picks the “top K”, Boruta finds ALL features that are genuinely useful, which could be 3 or 30 depending on your data.
How It Works
Boruta is an all-relevant feature selection method that uses shadow features (randomized copies of original features) as a benchmark for importance.
The algorithm:
- Create shadow features by shuffling original features
- Train a model on [original + shadow] features
- Compare each feature’s importance to the max shadow importance
- Features consistently beating shadows are “confirmed”
- Features consistently losing to shadows are “rejected”
- Repeat until all features are decided or max iterations reached
Constructors
| Constructor | Summary |
|---|---|
Boruta(Func<Matrix<T>, Vector<T>, Vector<T>> importanceFunc, int maxIterations, double alpha, int? randomState, int[] columnIndices) |
Creates a new instance of Boruta. |
Properties
| Property | Summary |
|---|---|
BorutaDecision[] Decisions { get; } |
Gets the decisions for each feature. |
Vector<T> MeanImportances { get; } |
Gets the mean importance scores for each feature. |
bool SupportsInverseTransform { get; } |
Gets whether this transformer supports inverse transformation. |
int Iterations { get; } |
Gets the number of iterations performed. |
int[] SelectedIndices { get; } |
Gets the indices of confirmed features. |
Methods
| Method | Summary |
|---|---|
Matrix<T> FitTransform(Matrix<T> data, Vector<T> target) |
Fits and transforms the data. |
bool[] GetSupportMask() |
Gets a boolean mask indicating which features are confirmed. |
string[] GetFeatureNamesOut(string[] inputFeatureNames) |
Gets the output feature names after transformation. |
void Fit(Matrix<T> data, Vector<T> target) |
Fits Boruta by comparing feature importances to shadow features. |