1.方式
MAE, MSE, RMSE, R-Squared
The MSE, MAE, RMSE, and R-Squared are mainly used metrics to evaluate the prediction error rates
and model performance in regression analysis.
MAE (Mean absolute error) represents the difference between the original and predicted values
extracted by averaged the absolute difference over the data set.
MSE (Mean Squared Error) represents the difference between the original and predicted values
extracted by squared the average difference over the data set.
RMSE (Root Mean Squared Error) is the error rate by the square root of MSE.
R-squared (Coefficient of determination) represents the coefficient of how well the values fit compared
to the original values. The value from 0 to 1 interpreted as percentages. The higher the value is, the better the model is.
2.准备数据
import numpy as np
import sklearn.metrics as metrics
import ma