Time Series 简明教程
Time Series - Error Metrics
对模型的性能进行量化以便将其用作反馈和比较对我们来说很重要。在本教程中,我们使用了最常见的错误指标之一:均方根误差。还有其他各种可用错误指标。本章将简要讨论它们。
It is important for us to quantify the performance of a model to use it as a feedback and comparison. In this tutorial we have used one of the most popular error metric root mean squared error. There are various other error metrics available. This chapter discusses them in brief.
Mean Square Error
它是预测值与真值之间差值的平方平均值。Sklearn 以函数形式提供它。它的单位与真值和预测值的平方相同,并且始终为正。
It is the average of square of difference between the predicted values and true values. Sklearn provides it as a function. It has the same units as the true and predicted values squared and is always positive.
MSE = \frac{1}{n} displaystyle\sum\limits_{t=1}^n \lgroup y' {t}\:-y {t}\rgroup^{2}
MSE = \frac{1}{n} \displaystyle\sum\limits_{t=1}^n \lgroup y'{t}\:-y{t}\rgroup^{2}
其中,$y'_{t}$ 是预测值,
Where $y'_{t}$ is the predicted value,
$y_{t}$ 是实际值,
$y_{t}$ is the actual value, and
n 是测试集中值的总数。
n is the total number of values in test set.
从方程式中可以清楚地看出,对于较大误差或异常值,MSE 具有更大的惩罚性。
It is clear from the equation that MSE is more penalizing for larger errors, or the outliers.
Root Mean Square Error
它是均方误差的平方根。它也总是为正,并且在数据范围内。
It is the square root of the mean square error. It is also always positive and is in the range of the data.
RMSE = \sqrt{\frac{1}{n} displaystyle\sum\limits_{t=1}^n \lgroup y' {t}-y {t}\rgroup ^2}
RMSE = \sqrt{\frac{1}{n} \displaystyle\sum\limits_{t=1}^n \lgroup y'{t}-y{t}\rgroup ^2}
其中,$y'_{t}$ 是预测值,
Where, $y'_{t}$ is predicted value
$y_{t}$ 表示实际值,而
$y_{t}$ is actual value, and
n 是测试集中值的总数。
n is total number of values in test set.
它具有单位功率,因此与 MSE 相比更具可解释性。RMSE 对较大误差的惩罚也更大。我们在教程中使用了 RMSE 度量。
It is in the power of unity and hence is more interpretable as compared to MSE. RMSE is also more penalizing for larger errors. We have used RMSE metric in our tutorial.
Mean Absolute Error
这是预测值和真值之间绝对差值的平均值。它的单位与预测值和真值相同,且始终为正。
It is the average of absolute difference between predicted values and true values. It has the same units as predicted and true value and is always positive.
MAE = \frac{1}{n}\displaystyle\sum\limits_{t=1}^{t=n} | y'{t}-y_{t}\lvert
其中,$y'_{t}$ 是预测值,
Where, $y'_{t}$ is predicted value,
$y_{t}$ 表示实际值,而
$y_{t}$ is actual value, and
n 是测试集中值的总数。
n is total number of values in test set.
Mean Percentage Error
这是预测值和真值之间绝对差值的平均值除以真值的百分比。
It is the percentage of average of absolute difference between predicted values and true values, divided by the true value.
MAPE = \frac{1}{n}\displaystyle\sum\limits_{t=1}^n\frac{y' {t}-y {t}}{y_{t}}*100\: \%
MAPE = \frac{1}{n}\displaystyle\sum\limits_{t=1}^n\frac{y'{t}-y{t}}{y_{t}}*100\: \%
其中,$y'_{t}$ 是预测值,
Where, $y'_{t}$ is predicted value,
$y_{t}$ 是实际值,n 是测试集中值的总数。
$y_{t}$ is actual value and n is total number of values in test set.
然而,使用此误差的缺点是正误差和负误差可能会相互抵消。因此,需要使用平均绝对百分比误差。
However, the disadvantage of using this error is that the positive error and negative errors can offset each other. Hence mean absolute percentage error is used.
Mean Absolute Percentage Error
这是预测值和真值之间绝对差值的平均值除以真值的百分比。
It is the percentage of average of absolute difference between predicted values and true values, divided by the true value.
MAPE = \frac{1}{n}\displaystyle\sum\limits_{t=1}^n\frac{|y' {t}-y {t}\lvert}{y_{t}}*100\: \%
MAPE = \frac{1}{n}\displaystyle\sum\limits_{t=1}^n\frac{|y'{t}-y{t}\lvert}{y_{t}}*100\: \%
其中 $y'_{t}$ 是预测值
Where $y'_{t}$ is predicted value
$y_{t}$ 表示实际值,而
$y_{t}$ is actual value, and
n 是测试集中值的总数。
n is total number of values in test set.