FireflyFS<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Wrapper

Firefly Algorithm for feature selection optimization.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

Imagine fireflies in a field at night. Brighter fireflies attract dimmer ones. In feature selection, “brightness” is how good a feature subset is, and fireflies move toward better solutions while also randomly exploring new combinations.

How It Works

Uses the Firefly Algorithm (FA) metaheuristic inspired by the flashing behavior of fireflies. Brighter fireflies (better solutions) attract others, with attraction decreasing with distance.

Constructors

Constructor Summary
FireflyFS(int nFeaturesToSelect, int populationSize, int maxIterations, double alpha, double beta0, double gamma, Func<Matrix<T>, Vector<T>, int[], T> fitnessFunction, int? randomState, int[] columnIndices)

Properties

Property Summary
Vector<T> FeatureImportances { 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)