concision_neural/train/traits/trainers.rs
1/*
2 appellation: trainers <module>
3 authors: @FL03
4*/
5use crate::train::Trainer;
6
7use crate::Model;
8use concision_data::DatasetBase;
9
10pub trait ModelTrainer<T> {
11 type Model: Model<T>;
12 /// returns a model trainer prepared to train the model; this is a convenience method
13 /// that creates a new trainer instance and returns it. Trainers are lazily evaluated
14 /// meaning that the training process won't begin until the user calls the `begin` method.
15 fn trainer<'a, U, V>(
16 &mut self,
17 dataset: DatasetBase<U, V>,
18 model: &'a mut Self::Model,
19 ) -> Trainer<'a, Self::Model, T, DatasetBase<U, V>>
20 where
21 Self: Sized,
22 T: Default,
23 for<'b> &'b mut Self::Model: Model<T>,
24 {
25 Trainer::new(model, dataset)
26 }
27}