Trait rusty_machine::learning::optim::Optimizable
source · [−]pub trait Optimizable {
type Inputs;
type Targets;
fn compute_grad(
&self,
params: &[f64],
inputs: &Self::Inputs,
targets: &Self::Targets
) -> (f64, Vec<f64>);
}
Expand description
Trait for models which can be gradient-optimized.
Required Associated Types
Required Methods
sourcefn compute_grad(
&self,
params: &[f64],
inputs: &Self::Inputs,
targets: &Self::Targets
) -> (f64, Vec<f64>)
fn compute_grad(
&self,
params: &[f64],
inputs: &Self::Inputs,
targets: &Self::Targets
) -> (f64, Vec<f64>)
Compute the gradient for the model.
Implementors
sourceimpl Optimizable for LinRegressor
impl Optimizable for LinRegressor
sourceimpl Optimizable for BaseLogisticRegressor
impl Optimizable for BaseLogisticRegressor
Computing the gradient of the underlying Logistic Regression model.
The gradient is given by
XT(h(Xb) - y) / m
where h
is the sigmoid function and b
the underlying model parameters.
sourceimpl<T: Criterion> Optimizable for BaseNeuralNet<T>
impl<T: Criterion> Optimizable for BaseNeuralNet<T>
Compute the gradient of the Neural Network using the back propagation algorithm.