AForge.MachineLearning.Sarsa.Sarsa C# (CSharp) Метод

Sarsa() публичный Метод

Initializes a new instance of the Sarsa class.
The randomize parameter specifies if initial action estimates should be randomized with small values or not. Randomization of action values may be useful, when greedy exploration policies are used. In this case randomization ensures that actions of the same type are not chosen always.
public Sarsa ( int states, int actions, IExplorationPolicy explorationPolicy, bool randomize ) : System
states int Amount of possible states.
actions int Amount of possible actions.
explorationPolicy IExplorationPolicy Exploration policy.
randomize bool Randomize action estimates or not.
Результат System
        public Sarsa( int states, int actions, IExplorationPolicy explorationPolicy, bool randomize )
        {
            this.states = states;
            this.actions = actions;
            this.explorationPolicy = explorationPolicy;

            // create Q-array
            qvalues = new double[states][];
            for ( int i = 0; i < states; i++ )
            {
                qvalues[i] = new double[actions];
            }

            // do randomization
            if ( randomize )
            {
                Random rand = new Random( );

                for ( int i = 0; i < states; i++ )
                {
                    for ( int j = 0; j < actions; j++ )
                    {
                        qvalues[i][j] = rand.NextDouble( ) / 10;
                    }
                }
            }
        }

Same methods

Sarsa::Sarsa ( int states, int actions, IExplorationPolicy explorationPolicy ) : System