[−][src]Struct finalfrontier::SGD
Stochastic gradient descent
This data type applies stochastic gradient descent on sentences.
Methods
impl<T> SGD<T> where
T: Trainer,
[src]
T: Trainer,
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<S>(&mut self, sentence: &S, lr: f32) where
S: ?Sized,
T: TrainIterFrom<S> + Trainer + NegativeSamples,
[src]
S: ?Sized,
T: TrainIterFrom<S> + Trainer + NegativeSamples,
Update the model parameters using the given sentence.
This applies a gradient descent step on the sentence, with the given learning rate.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,