SimulatedAnnealingFS<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Wrapper

Simulated Annealing for feature selection.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

Like heating metal and slowly cooling it to remove defects, SA starts “hot” (accepting almost any change) and gradually cools (becoming pickier). Early on, it accepts worse solutions to explore widely. Later, it focuses on refining the best solutions found. This helps avoid getting stuck in suboptimal solutions.

How It Works

Simulated Annealing (SA) is inspired by the annealing process in metallurgy. It explores the search space by accepting worse solutions with decreasing probability as the “temperature” cools, helping escape local optima.

Constructors

Constructor Summary
SimulatedAnnealingFS(int nFeaturesToSelect, int nIterations, double initialTemperature, double coolingRate, Func<Matrix<T>, Vector<T>, int[], double> scorer, int? randomState, int[] columnIndices)

Properties

Property Summary
bool SupportsInverseTransform { get; }
double CoolingRate { get; }
double InitialTemperature { get; }
double[] FeatureScores { 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)