Sklearn Regression Metrics


A code snippet showing how to output a range of evaluation metrics for regression models using Sklearn.

 1|  from sklearn.metrics import mean_squared_error, mean_absolute_error, max_error, explained_variance_score, mean_absolute_percentage_error
 3|  print('RMSE:',mean_squared_error(y_test, y_pred, squared = False))
 4|  print('MAE:',mean_absolute_error(y_test, y_pred))
 5|  print('MAPE:',mean_absolute_percentage_error(y_test, y_pred))
 6|  print('Max Error:',max_error(y_test, y_pred))
 7|  print('Explained Variance Score:',explained_variance_score(y_test, y_pred))
Did you find this snippet useful?

Sign up for free to to add this to your code library