AntColonyFS<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Wrapper

Ant Colony Optimization for feature selection.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

Imagine ants searching for food. When an ant finds a good path, it leaves a scent (pheromone) that attracts other ants. Over time, better paths get stronger scents. Here, “paths” are feature subsets, and “food quality” is model performance. Features that are part of good subsets accumulate more pheromone and are more likely to be selected.

How It Works

Ant Colony Optimization (ACO) is a swarm intelligence algorithm inspired by how ants find optimal paths using pheromone trails. In feature selection, ants construct feature subsets, and pheromone is deposited on good feature combinations.

Constructors

Constructor Summary
AntColonyFS(int nFeaturesToSelect, int nAnts, int nIterations, double alpha, double beta, double evaporationRate, Func<Matrix<T>, Vector<T>, int[], T> scorer, int? randomState, int[] columnIndices)

Properties

Property Summary
Vector<T> FeatureScores { get; }
Vector<T> Pheromones { 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)