ThompsonSamplingSelector<T>

Models & Types · AiDotNet.Preprocessing.FeatureSelection.Bandit

Thompson Sampling based Feature Selection.

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

Implements: IFixedCountFeatureSelector<T>, ISupervisedFeatureSelector<T>

For Beginners

Thompson Sampling treats each feature as a “slot machine” with unknown payout. Instead of tracking a single estimate, we maintain a probability distribution (Beta distribution) representing our belief about each feature’s quality. We sample from these distributions and pick the feature with the highest sample. This naturally balances exploration (trying uncertain features) and exploitation (using features we know are good).

How It Works

Selects features using Thompson Sampling, a Bayesian approach to the multi-armed bandit problem that maintains probability distributions over feature quality.

Constructors

Constructor Summary
ThompsonSamplingSelector(int nFeaturesToSelect, int nIterations, int? randomState, int[] columnIndices)

Properties

Property Summary
bool SupportsInverseTransform { get; }
double[] Alphas { get; }
double[] Betas { get; }
double[] PosteriorMeans { get; }
int NFeaturesToSelect { get; }
int NIterations { 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)