Struct zero_sum::impls::tak::evaluator::AnnEvaluator
[−]
[src]
pub struct AnnEvaluator { /* fields omitted */ }
Uses an artificial neural network to evaluate the tak state. The network has three hidden layers using ReLU activation, and uses TanH activation on the output. It uses ADADELTA to perform gradient descent.
This is largely an experimental evaluator. While it has demonstrated its potential as a stronger
evaluator of tak positions than the StaticEvaluator
, it is an order of magnitude slower, making
it unfit for use in a real-time game.
Methods
impl AnnEvaluator
[src]
fn new() -> AnnEvaluator
Creates a new evaluator, randomly initializing the network.
fn from_file(filename: &str) -> Result<AnnEvaluator, String>
Loads in a network state previously serialized with the to_file
method.
fn to_file(&self, filename: &str)
Writes the current network state to a file.
fn train_batch(
&mut self,
positions: &[State],
labels: &[Evaluation],
error: Option<&mut f32>
)
&mut self,
positions: &[State],
labels: &[Evaluation],
error: Option<&mut f32>
)
Trains the network on positions
, against labels
. Optionally will return the average amount of
error per input in error
.
fn train_batch_tdleaf(
&mut self,
positions: &[State],
error: Option<&mut f32>,
thread_count: usize
)
&mut self,
positions: &[State],
error: Option<&mut f32>,
thread_count: usize
)
Use temporal difference learning (TD-Leaf algorithm) to train the system through self-play.
positions
are used as starting points for self-play. Optionally returns the average amount of
error per input in error
.
Trait Implementations
impl Clone for AnnEvaluator
[src]
fn clone(&self) -> AnnEvaluator
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Evaluator for AnnEvaluator
[src]
type State = State
type Evaluation = Evaluation
fn evaluate(&self, state: &State) -> Evaluation
Returns the evaluation of state
.
fn evaluate_plies(
&self,
state: &Self::State,
plies: &[<Self::State as State>::Ply]
) -> Self::Evaluation
&self,
state: &Self::State,
plies: &[<Self::State as State>::Ply]
) -> Self::Evaluation
Returns the evaluation of state
after executing plies
. Read more