1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
pub use ndarray::{Array, ArrayBase, Ix, Ix2, Data}; pub type Matrix<T> = Array<T, (Ix, Ix)>; pub type Vector<T> = Array<T, Ix>; pub trait NonParametricModel { type Input; type O; fn reduction(&mut self, inputs: &[Self::Input]) -> Matrix<Self::O>; } pub trait ParametricModel { type Input; type Output; fn train(inputs: &[Self::Input]); fn predict(input: &Self::Input) -> Self::Output; }