pub struct Trainer<'a> { /* private fields */ }Expand description
NeuralNetwork::train(..) builder. Allows optional setting of training hyperparameters.
Implementations§
Source§impl<'a> Trainer<'a>
impl<'a> Trainer<'a>
Sourcepub fn evaluation_data(
&mut self,
evaluation_data: EvaluationData<'a>,
) -> &mut Trainer<'a>
pub fn evaluation_data( &mut self, evaluation_data: EvaluationData<'a>, ) -> &mut Trainer<'a>
Sets evaluation_data.
evaluation_data determines how to set the evaluation data.
Sourcepub fn cost(&mut self, cost: Cost) -> &mut Trainer<'a>
pub fn cost(&mut self, cost: Cost) -> &mut Trainer<'a>
Sets cost.
cost determines cost function of network.
Sourcepub fn halt_condition(
&mut self,
halt_condition: HaltCondition,
) -> &mut Trainer<'a>
pub fn halt_condition( &mut self, halt_condition: HaltCondition, ) -> &mut Trainer<'a>
Sets halt_condition.
halt_condition sets after which Iteration/Duration or reached accuracy to stop training.
Sourcepub fn log_interval(
&mut self,
log_interval: MeasuredCondition,
) -> &mut Trainer<'a>
pub fn log_interval( &mut self, log_interval: MeasuredCondition, ) -> &mut Trainer<'a>
Sets log_interval.
log_interval sets some amount of Iterations/Duration to print the cost and accuracy of the neural net.
Sourcepub fn batch_size(&mut self, batch_size: Proportion) -> &mut Trainer<'a>
pub fn batch_size(&mut self, batch_size: Proportion) -> &mut Trainer<'a>
Sets batch_size.
Sourcepub fn learning_rate(&mut self, learning_rate: f32) -> &mut Trainer<'a>
pub fn learning_rate(&mut self, learning_rate: f32) -> &mut Trainer<'a>
Sets learning_rate.
Sourcepub fn l2(&mut self, lambda: f32) -> &mut Trainer<'a>
pub fn l2(&mut self, lambda: f32) -> &mut Trainer<'a>
Sets lambda ($ \lambda $) for l2.
If $ \lambda $ set, implements L2 regularization with $ \lambda $ value.
Sourcepub fn early_stopping_condition(
&mut self,
early_stopping_condition: MeasuredCondition,
) -> &mut Trainer<'a>
pub fn early_stopping_condition( &mut self, early_stopping_condition: MeasuredCondition, ) -> &mut Trainer<'a>
Sets early_stopping_condition.
early_stopping_condition sets some amount of Iterations/Duration to stop after without notable cost improvement.
Sourcepub fn evaluation_min_change(
&mut self,
evaluation_min_change: Proportion,
) -> &mut Trainer<'a>
pub fn evaluation_min_change( &mut self, evaluation_min_change: Proportion, ) -> &mut Trainer<'a>
Sets evaluation_min_change.
Minimum change required to log positive evaluation change.
Sourcepub fn learning_rate_decay(
&mut self,
learning_rate_decay: f32,
) -> &mut Trainer<'a>
pub fn learning_rate_decay( &mut self, learning_rate_decay: f32, ) -> &mut Trainer<'a>
Sets learning_rate_decay.
learning_rate_decay is the mulipliers by which to decay the learning rate.
Sourcepub fn learning_rate_interval(
&mut self,
learning_rate_interval: MeasuredCondition,
) -> &mut Trainer<'a>
pub fn learning_rate_interval( &mut self, learning_rate_interval: MeasuredCondition, ) -> &mut Trainer<'a>
Sets learning_rate_interval.
Sourcepub fn checkpoint_interval(
&mut self,
checkpoint_interval: MeasuredCondition,
) -> &mut Trainer<'a>
pub fn checkpoint_interval( &mut self, checkpoint_interval: MeasuredCondition, ) -> &mut Trainer<'a>
Sets checkpoint_interval.
checkpoint_interval sets how often (if at all) to serialize and output neural network to .txt file.
Sourcepub fn name(&mut self, name: &'a str) -> &mut Trainer<'a>
pub fn name(&mut self, name: &'a str) -> &mut Trainer<'a>
Sets name
name sets what to pretend to checkpoint files. Used to differentiate between nets when checkpointing multiple.
Auto Trait Implementations§
impl<'a> Freeze for Trainer<'a>
impl<'a> RefUnwindSafe for Trainer<'a>
impl<'a> Send for Trainer<'a>
impl<'a> Sync for Trainer<'a>
impl<'a> Unpin for Trainer<'a>
impl<'a> !UnwindSafe for Trainer<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more