concision_data/trainer/
impl_trainer.rs1use super::Trainer;
7use crate::dataset::DatasetBase;
8use crate::{IntoDataset, Records};
9use concision_core::Model;
10
11impl<'a, M, T, R> Trainer<'a, M, T, R>
12where
13 M: Model<T>,
14 R: Records,
15{
16 pub fn new(model: &'a mut M, dataset: R) -> Self
17 where
18 R: IntoDataset<R::Inputs, R::Targets>,
19 T: Default,
20 {
21 Self {
22 dataset: dataset.into_dataset(),
23 model,
24 loss: T::default(),
25 }
26 }
27 pub const fn loss(&self) -> &T {
29 &self.loss
30 }
31 pub fn loss_mut(&mut self) -> &mut T {
33 &mut self.loss
34 }
35 pub const fn dataset(&self) -> &DatasetBase<R::Inputs, R::Targets> {
37 &self.dataset
38 }
39 pub fn dataset_mut(&mut self) -> &mut DatasetBase<R::Inputs, R::Targets> {
41 &mut self.dataset
42 }
43
44 pub fn begin(&self) -> &Self {
45 todo!("Define a generic training loop...")
46 }
47}