Trait Optimizer

Source
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 model
  • Output - The type of output data that the model produces

Required Methods§

Source

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 the DLModel trait
  • x - A reference to the input data
  • y - A reference to the expected output data
§Returns
  • Result<(), ModelError> - Ok(()) if fitting was successful, or an error if it failed

Implementors§