FireflyAlgorithm<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Metaheuristic

Firefly Algorithm for feature selection.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

Imagine fireflies searching for the best spot in a forest. Brighter fireflies (better solutions) attract dimmer ones, so all fireflies gradually move toward the brightest areas. In feature selection, “brightness” represents how good a set of features is.

How It Works

Firefly Algorithm is inspired by the flashing behavior of fireflies. Brighter fireflies attract dimmer ones, with attraction decreasing with distance. This creates a natural clustering toward optimal solutions.

Constructors

Constructor Summary
FireflyAlgorithm(int nFeaturesToSelect, int populationSize, int maxIterations, double alpha, double beta0, double gamma, int? randomState, int[] columnIndices)

Properties

Property Summary
Vector<T> FeatureScores { get; }
bool SupportsInverseTransform { get; }
int MaxIterations { get; }
int NFeaturesToSelect { get; }
int PopulationSize { 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)