pub struct SimpleLinearRegression {
pub slope: f64,
pub intercept: f64,
}
impl SimpleLinearRegression {
pub fn new() -> Self {
SimpleLinearRegression {
slope: 0.0,
intercept: 0.0,
}
}
pub fn fit(&mut self, x: &[f64], y: &[f64]) {
let _n = x.len() as f64;
let _sum_x = x.iter().sum::<f64>();
let _sum_y = y.iter().sum::<f64>();
let xy_pairs = x.iter().zip(y.iter()); let xy_products: Vec<f64> = xy_pairs.map(|(&xi, &yi)| xi * yi).collect(); let _sum_xy: f64 = xy_products.iter().sum();
}
}