DoubleQLearningAgent<T>

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

Double Q-Learning agent using two Q-tables to reduce overestimation bias.

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

Implements: IGradientComputable<T, Vector<T>, Vector<T>>

For Beginners

Q-Learning tends to overestimate Q-values because it uses max(Q) for both selecting and evaluating actions. Double Q-Learning fixes this by using two separate Q-tables and randomly switching which one is updated.

Key innovation:

  • Two Q-tables: Q1 and Q2
  • Decorrelation: Use Q1 to select action, Q2 to evaluate (or vice versa)
  • Reduced Bias: Prevents overestimation from max operator

Famous for: Hado van Hasselt 2010, foundation for Double DQN

How It Works

Double Q-Learning maintains two Q-tables and uses one to select actions and the other to evaluate them, reducing maximization bias.

Example

// Create a tabular Double Q-Learning agent to reduce overestimation bias
var options = new DoubleQLearningOptions<double> { LearningRate = 0.1, StateSize = 4, ActionSize = 2 };
var agent = new DoubleQLearningAgent<double>(options);
            
// Select an action for the current state
var state = new Vector<double>(new double[] { 0.5, -0.3, 1.0, 0.2 });
var action = agent.SelectAction(state);

Constructors

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

Properties

Property Summary
int FeatureCount { get; }

Methods

Method Summary
ModelMetadata<T> GetModelMetadata()
T Train()
Vector<T> ComputeGradients(Vector<T> input, Vector<T> target, ILossFunction<T> lossFunction)
Vector<T> SelectAction(Vector<T> state, bool training)
byte[] Serialize() Auto-generated common model serialization surface.
void ApplyGradients(Vector<T> gradients, T learningRate)
void Deserialize(byte[] data) Auto-generated common model deserialization surface.
void LoadModel(string filepath)
void SaveModel(string filepath)
void StoreExperience(Vector<T> state, Vector<T> action, T reward, Vector<T> nextState, bool done)