strafe_trait/
regression.rs

1// "Whatever you do, work at it with all your heart, as working for the Lord,
2// not for human masters, since you know that you will receive an inheritance
3// from the Lord as a reward. It is the Lord Christ you are serving."
4// (Col 3:23-24)
5
6use std::sync::Arc;
7
8use nalgebra::DMatrix;
9
10use crate::{Statistic, StatisticalEstimate};
11
12pub type LinearEstimatorClosure = Arc<dyn Fn(&DMatrix<f64>) -> DMatrix<f64>>;
13
14pub trait Regression {
15    fn coefficients(&self) -> Vec<Box<dyn StatisticalEstimate<f64, f64>>>;
16    fn estimate_function(
17        &self,
18    ) -> Box<dyn StatisticalEstimate<LinearEstimatorClosure, DMatrix<f64>>>;
19    fn residuals(&self) -> DMatrix<f64>;
20    fn predictions(&self) -> Box<dyn StatisticalEstimate<DMatrix<f64>, DMatrix<f64>>>;
21    fn variance_covariance_matrix(&self) -> DMatrix<f64>;
22    fn determination(&self) -> Box<dyn Statistic>;
23}