[][src]Struct finalfrontier::SGD

pub struct SGD<T> { /* fields omitted */ }

Stochastic gradient descent

This data type applies stochastic gradient descent on sentences.

Methods

impl<T> SGD<T> where
    T: Trainer
[src]

pub fn into_model(self) -> TrainModel<T>[src]

pub fn new(model: TrainModel<T>) -> Self[src]

Construct a new SGD instance,

pub fn model(&self) -> &TrainModel<T>[src]

Get the training model associated with this SGD.

pub fn n_tokens_processed(&self) -> usize[src]

Get the number of tokens that are processed by this SGD.

pub fn train_loss(&self) -> f32[src]

Get the average training loss of this SGD.

This returns the average training loss over all instances seen by this SGD instance since its construction.

pub fn update_sentence<'b, S>(&mut self, sentence: &S, lr: f32) where
    S: ?Sized,
    T: TrainIterFrom<'b, S> + Trainer + NegativeSamples,
    &'a T::Focus: IntoIterator<Item = u64>,
    T::Focus: WordIdx
[src]

Update the model parameters using the given sentence.

This applies a gradient descent step on the sentence, with the given learning rate.

Trait Implementations

impl<T: Clone> Clone for SGD<T>[src]

Auto Trait Implementations

impl<T> Send for SGD<T> where
    T: Send

impl<T> Sync for SGD<T> where
    T: Sync

impl<T> Unpin for SGD<T> where
    T: Unpin

impl<T> !UnwindSafe for SGD<T>

impl<T> !RefUnwindSafe for SGD<T>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

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