1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18

   
pub trait UnsupervisedLearn<T, U>
{
    fn train(self: &mut Self, input: &T);

    fn predict(self: &Self, input: &T) -> U;
}

pub trait SupervisedLearn<T, U>
{
    /// Predict output from inputs.
    fn predict(self: &Self, input: &T) -> Result<U, ()>; // Result<U, &str>;

    /// Train the model using inputs and targets.
    fn train<'a, 'b>(self: &'a mut Self, input: &'b T, target: &'b U); //Result<(), ()>;
}