Linear-Regression-ML

Linear regression algorithm that predicts future values depending on existing data

``` use linearregression::{linearregression, predict}

fn main() { /* Some data */ let data: Vec<(f32, f32)> = vec![ (17.9, 2013.0), (17.63, 2014.0), (14.95, 2015.0), (15.14, 2016.0), (16.24, 2017.0), (17.6, 2018.0), (17.47, 2019.0), (15.84, 2020.0), (18.7, 2021.0) ];

for price in &data { println!("Year: {}, GDP = ${:.3}B", price.1, price.0); }

// Linear regression prints the equation and returns k and b let eq = linear_regression(&data);

// Test cases for different x values predict(&eq, 2022.0); }

```

Example: - Vertices data: [
 (0.0, 2.1),
 (1.0, 1.92),
 (2.0, 1.84),
 (3.0, 1.71),
 (4.0, 1.64)
]

- Regression line: y = -0.113x + 2.068