Crates.io | leastsquares |
lib.rs | leastsquares |
version | 0.1.0 |
source | src |
created_at | 2024-08-12 20:22:15.516645 |
updated_at | 2024-08-12 20:22:15.516645 |
description | Miller Updating Regression |
homepage | https://github.com/mkysylov/leastsquares |
repository | https://github.com/mkysylov/leastsquares |
max_upload_size | |
id | 1335122 |
size | 27,125 |
This library contains an implementation of the least squares method that allows for dynamic updating of the data, i.e. as observations become available, they can be added to the model without loading the entire data set in memory.
This is a rewrite of MillerUpdatingRegression from Java to Rust.
Example:
let mut model = MillerUpdatingRegression::empty(3, true, f64::EPSILON);
let x1 = [0.0, 1.0, 2.0];
let y1 = 3.0;
model.add_observation(&x1, y1)?;
let x2 = [4.0, 5.0, 6.0];
let y2 = 7.0;
model.add_observation(&x2, y2)?;
let result = model.regress()?;
println!("{:?}", result.parameters);
println!("{}", result.mean_squared_error());