pub trait Optimizer<Input, Output, M: OptimizableModel<Input, Output>> {
// Required method
fn fit(
&mut self,
model: &mut M,
x: &Input,
y: &Output,
) -> Result<(), ModelError>;
}
Expand description
The Optimizer
trait defines the interface for optim algorithms.
Implementations of this trait can be used to train machine learning models
that conform to the OptimizableModel
trait. Different optim strategies
can be implemented to find optimal parameters for a given model.
§Type Parameters
Input
- The type of input data used to train the modelOutput
- The type of output data that the model produces
Required Methods§
Sourcefn fit(
&mut self,
model: &mut M,
x: &Input,
y: &Output,
) -> Result<(), ModelError>
fn fit( &mut self, model: &mut M, x: &Input, y: &Output, ) -> Result<(), ModelError>
Fits the provided model to the training data.
§Arguments
model
- A mutable reference to a model that implements theDLModel
traitx
- A reference to the input datay
- A reference to the expected output data
§Returns
Result<(), ModelError>
- Ok(()) if fitting was successful, or an error if it failed