libmcts
A Monte Carlo Tree Search Library
Public Member Functions | List of all members
mcts::AvgBackpropagationStrategy Class Reference

adds the backpropagated value to a running stats object that calculates the ev, mean and variance. More...

#include <avg_backpropagation_strategy.hpp>

Inheritance diagram for mcts::AvgBackpropagationStrategy:
mcts::IBackpropagationStrategy

Public Member Functions

virtual void on_backpropagate (const double &value)
 saves an value according to some metric. More...
 
virtual double ev () const
 gets the current expected value More...
 
virtual double std_deviation () const
 gets the current standard deviation More...
 
virtual double variance () const
 gets the current variance More...
 
virtual int nb_samples () const
 gets the number of samples that are saved in the strat. More...
 
virtual IBackpropagationStrategycreate ()
 creates a new object of the same type and with the same constructor as the current object. More...
 

Detailed Description

adds the backpropagated value to a running stats object that calculates the ev, mean and variance.

Definition at line 13 of file avg_backpropagation_strategy.hpp.

Member Function Documentation

◆ create()

virtual IBackpropagationStrategy* mcts::AvgBackpropagationStrategy::create ( )
inlinevirtual

creates a new object of the same type and with the same constructor as the current object.

Returns
pointer to a new backprop strat.

Implements mcts::IBackpropagationStrategy.

Definition at line 27 of file avg_backpropagation_strategy.hpp.

27  {
28  return new AvgBackpropagationStrategy();
29  }

◆ ev()

virtual double mcts::AvgBackpropagationStrategy::ev ( ) const
inlinevirtual

gets the current expected value

Returns
current ev

Implements mcts::IBackpropagationStrategy.

Definition at line 19 of file avg_backpropagation_strategy.hpp.

19 { return stats.mean(); }

◆ nb_samples()

virtual int mcts::AvgBackpropagationStrategy::nb_samples ( ) const
inlinevirtual

gets the number of samples that are saved in the strat.

Returns
count of backpropagated values

Implements mcts::IBackpropagationStrategy.

Definition at line 25 of file avg_backpropagation_strategy.hpp.

25 { return stats.num_data_values(); }
long long num_data_values() const
number of samples from which mean etc are calculated

◆ on_backpropagate()

virtual void mcts::AvgBackpropagationStrategy::on_backpropagate ( const double &  value)
inlinevirtual

saves an value according to some metric.

Parameters
valueto store

Implements mcts::IBackpropagationStrategy.

Definition at line 17 of file avg_backpropagation_strategy.hpp.

17 { stats.push(value); }
void push(const double &x)
add a new value to the object

◆ std_deviation()

virtual double mcts::AvgBackpropagationStrategy::std_deviation ( ) const
inlinevirtual

gets the current standard deviation

Returns
current std dev

Implements mcts::IBackpropagationStrategy.

Definition at line 21 of file avg_backpropagation_strategy.hpp.

21 { return stats.standard_deviation(); }

◆ variance()

virtual double mcts::AvgBackpropagationStrategy::variance ( ) const
inlinevirtual

gets the current variance

Returns
current var

Implements mcts::IBackpropagationStrategy.

Definition at line 23 of file avg_backpropagation_strategy.hpp.

23 { return stats.variance(); }

The documentation for this class was generated from the following file: