Trainer

Struct Trainer 

Source
pub struct Trainer<'a> { /* private fields */ }
Expand description

NeuralNetwork::train(..) builder. Allows optional setting of training hyperparameters.

Implementations§

Source§

impl<'a> Trainer<'a>

Source

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.

Source

pub fn cost(&mut self, cost: Cost) -> &mut Trainer<'a>

Sets cost.

cost determines cost function of network.

Source

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.

Source

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.

Source

pub fn batch_size(&mut self, batch_size: Proportion) -> &mut Trainer<'a>

Sets batch_size.

Source

pub fn learning_rate(&mut self, learning_rate: f32) -> &mut Trainer<'a>

Sets learning_rate.

Source

pub fn l2(&mut self, lambda: f32) -> &mut Trainer<'a>

Sets lambda ($ \lambda $) for l2.

If $ \lambda $ set, implements L2 regularization with $ \lambda $ value.

Source

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.

Source

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.

Source

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.

Source

pub fn learning_rate_interval( &mut self, learning_rate_interval: MeasuredCondition, ) -> &mut Trainer<'a>

Sets learning_rate_interval.

Source

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.

Source

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.

Source

pub fn tracking(&mut self) -> &mut Trainer<'a>

Sets tracking.

tracking determines whether to output percentage progress during backpropgation.

Source

pub fn go(&mut self)

Begins training.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V