ols_regression 0.1.0

Polynomial regression with normal equations using nalgebra
Documentation
use nalgebra::DVector;
use ols_regression::{arg_data, cost, fit, pretty};
use std::env;

fn main() {
    let args: Vec<String> = env::args().collect();
    let x_arg = arg_data(&args, 1);
    let y_arg = arg_data(&args, 2);
    let degree = args
        .get(3)
        .expect("Could not get polynomial degree")
        .clone()
        .parse::<usize>()
        .expect("Polynomial degree parsing failed!");

    let x = DVector::from_vec(x_arg);
    let y = DVector::from_vec(y_arg);

    let coefficients = fit(&x, &y, degree);
    println!(
        "expression: {:?}\nerror: {}",
        pretty(&coefficients),
        cost(x, y, &coefficients)
    );
}