ParticleSwarmFS<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Wrapper

Particle Swarm Optimization for feature selection.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

Imagine a flock of birds searching for food. Each bird remembers where it found the best food, and the flock shares information about the best location found by any bird. They balance exploring new areas with returning to known good spots. Here, “food” is the best feature subset.

How It Works

Particle Swarm Optimization (PSO) simulates a swarm of particles moving through the search space. Each particle represents a candidate feature subset and moves based on its own best position and the swarm’s best position.

Constructors

Constructor Summary
ParticleSwarmFS(int nFeaturesToSelect, int nParticles, int nIterations, double inertiaWeight, double cognitiveCoefficient, double socialCoefficient, Func<Matrix<T>, Vector<T>, int[], T> scorer, int? randomState, int[] columnIndices)

Properties

Property Summary
Vector<T> FeatureScores { get; }
bool SupportsInverseTransform { get; }
double CognitiveCoefficient { get; }
double InertiaWeight { get; }
double SocialCoefficient { 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)