nn

Struct Trainer

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

Used to specify options that dictate how a network will be trained

Implementations§

Source§

impl<'a, 'b> Trainer<'a, 'b>

Trainer is used to chain together options that specify how to train a network. All of the options are optional because the Trainer struct has default values built in for each option. The go() method must be called however or the network will not be trained.

Source

pub fn rate(&mut self, rate: f64) -> &mut Trainer<'a, 'b>

Specifies the learning rate to be used when training (default is 0.3) This is the step size that is used in the backpropagation algorithm.

Source

pub fn momentum(&mut self, momentum: f64) -> &mut Trainer<'a, 'b>

Specifies the momentum to be used when training (default is 0.0)

Source

pub fn log_interval( &mut self, log_interval: Option<u32>, ) -> &mut Trainer<'a, 'b>

Specifies how often (measured in batches) to log the current error rate (mean squared error) during training. Some(x) means log after every x batches and None means never log

Source

pub fn halt_condition( &mut self, halt_condition: HaltCondition, ) -> &mut Trainer<'a, 'b>

Specifies when to stop training. Epochs(x) will stop the training after x epochs (one epoch is one loop through all of the training examples) while MSE(e) will stop the training when the error rate is at or below e. Timer(d) will halt after the duration d has elapsed.

Source

pub fn learning_mode( &mut self, learning_mode: LearningMode, ) -> &mut Trainer<'a, 'b>

Specifies what mode to train the network in. Incremental means update the weights in the network after every example.

Source

pub fn go(&mut self) -> f64

When go is called, the network will begin training based on the options specified. If go does not get called, the network will not get trained!

Trait Implementations§

Source§

impl<'a, 'b> Debug for Trainer<'a, 'b>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, 'b> Freeze for Trainer<'a, 'b>

§

impl<'a, 'b> RefUnwindSafe for Trainer<'a, 'b>

§

impl<'a, 'b> Send for Trainer<'a, 'b>

§

impl<'a, 'b> Sync for Trainer<'a, 'b>

§

impl<'a, 'b> Unpin for Trainer<'a, 'b>

§

impl<'a, 'b> !UnwindSafe for Trainer<'a, 'b>

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, 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.