Created
June 10, 2021 13:45
-
-
Save Steboss89/16687c7293148470234084a77e5d584b to your computer and use it in GitHub Desktop.
linear Regression model in rusty_machine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MODEL! | |
let mut linearRegression = LinRegressor::default(); | |
// train | |
linearRegression.train(&x_train_matrix, &y_train_vector); | |
// predictions | |
let preds = linearRegression.predict(&x_test_matrix).unwrap(); | |
// convert to matrix both preds and y_test | |
let preds_matrix = Matrix::new(test_size, 1, preds); | |
let y_preds_matrix = Matrix::new(test_size, 1, y_test); | |
// compute the mse | |
let mse = neg_mean_squared_error(&preds_matrix, &y_preds_matrix); | |
println!("Final negMSE (the higher the better) {:?}", mse); | |
// return the mse | |
mse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment