EpsilonGreedyBanditAgent<T>

Models & Types ยท AiDotNet.ReinforcementLearning.Agents.Bandits

Epsilon-Greedy Multi-Armed Bandit agent.

Inheritance: ReinforcementLearningAgentBase<T> โ†’ EpsilonGreedyBanditAgent<T>

For Beginners

The epsilon-greedy bandit is the simplest exploration strategy. Imagine choosing between multiple slot machines (arms) at a casino. Most of the time (1-epsilon), you pick the machine that has paid the best so far (exploit). But sometimes (epsilon%), you pick a random machine to discover if there is something better (explore). Common starting epsilon is 0.1 (10% exploration). Used in A/B testing and ad selection.

Example

// Create an epsilon-greedy bandit agent for multi-armed bandit problems
var options = new EpsilonGreedyBanditOptions<double> { NumArms = 10, Epsilon = 0.1 };
var agent = new EpsilonGreedyBanditAgent<double>(options);
            
// Select an arm to pull
var state = new Vector<double>(new double[] { 1.0 });
var action = agent.SelectAction(state);

Constructors

Constructor Summary
EpsilonGreedyBanditAgent() Initializes a new instance with default settings.
EpsilonGreedyBanditAgent(EpsilonGreedyBanditOptions<T> options)

Properties

Property Summary
int FeatureCount { get; }

Methods

Method Summary
Dictionary<string, T> GetMetrics()
ModelMetadata<T> GetModelMetadata()
T Train()
Task TrainAsync()
Task<Vector<T>> PredictAsync(Vector<T> input)
Vector<T> Predict(Vector<T> input)
Vector<T> SelectAction(Vector<T> state, bool training)
byte[] Serialize() Auto-generated common model serialization surface.
void Deserialize(byte[] data) Auto-generated common model deserialization surface.
void LoadModel(string filepath)
void ResetEpisode()
void SaveModel(string filepath)
void StoreExperience(Vector<T> state, Vector<T> action, T reward, Vector<T> nextState, bool done)