BetaPolicy<T>

Models & Types · AiDotNet.ReinforcementLearning.Policies

Policy using Beta distribution for bounded continuous action spaces. Network outputs alpha and beta parameters for each action dimension. Actions are naturally bounded to [0, 1] and can be scaled to any [min, max] range.

Inheritance: ModelBase<T, Vector<T>, Vector<T>> → PolicyBase<T> → BetaPolicy<T>

Implements: IGeneratedParameterRegistrar<T>

Example

// Create a Beta policy for bounded continuous actions in [0, 1]
var network = new NeuralNetwork<double>();
var policy = new BetaPolicy<double>(network, actionSize: 2, new EpsilonGreedyExploration<double>());
            
// Sample an action bounded between 0 and 1
var state = new Vector<double>(new double[] { 0.5, -0.3, 1.0, 0.2 });
var action = policy.SelectAction(state, training: true);

Constructors

Constructor Summary
BetaPolicy() Initializes a new instance of the BetaPolicy class.
BetaPolicy(BetaPolicyOptions<T> options) Builds the policy from options: a dense ReLU network of the options’ hidden widths from StateSize inputs to α and β for each action dimension (2 × ActionSize outputs).
BetaPolicy(INeuralNetwork<T> policyNetwork, BetaPolicyOptions<T> options) Initializes a new instance of the BetaPolicy class from its options: action size, exploration strategy, action bounds and Seed.
BetaPolicy(INeuralNetwork<T> policyNetwork, int actionSize, IExplorationStrategy<T> explorationStrategy, double actionMin, double actionMax, Random random)

Methods

Method Summary
IReadOnlyList<INeuralNetwork<T>> GetNetworks() Gets the neural networks used by this policy.
T ComputeLogProb(Vector<T> state, Vector<T> action) Computes the log probability of an action under the Beta distribution policy.
Vector<T> SelectAction(Vector<T> state, bool training) Selects an action by sampling from Beta distributions.
void Reset() Resets the exploration strategy.