gpt4 book ai didi

r - 精度函数

转载 作者:行者123 更新时间:2023-12-02 00:46:53 25 4
gpt4 key购买 nike

我正在进行 TS 分析。这两种精度有什么区别:

fit<-auto.arima(tsdata)
fcast<-forecast(fit,6)
accuracy(fcast) #### First Accuracy

fit<-auto.arima(tsdata)
fcast<-forecast(fit,6)
accuracy(fcast,actual values) #### Second Accuracy

当我没有像第一种情况那样在精度函数中指定实际值时,精度函数如何工作。

其次,计算准确度的正确方法是什么?

最佳答案

在这个答案中,我假设您正在使用 forecast 包中的函数。答案在 accuracy 的描述中:

Returns range of summary measures of the forecast accuracy. If x is provided, the function measures out-of-sample (test set) forecast accuracy based on x-f. If x is not provided, the function only produces in-sample (training set) accuracy measures of the forecasts based on f["x"]-fitted(f). All measures are defined and discussed in Hyndman and Koehler (2006).

在您的例子中,x 是函数的第二个参数。因此,简而言之,accuracy(fcst) 提供了基于训练集的预测误差估计。

例如:假设您有 12 个月,并预测 future 6 个月。然后,如果您使用 accuracy(fcst),您会得到模型在 12 个月内(​​仅)的错误。

现在,我们假设 x = 您预测的 6 个月的实际需求。而且您没有使用这些数据来构建 Arima 模型。在这种情况下,accuracy(fcst, x) 为您提供测试集误差,这是衡量您将来使用此模型获得的结果的更好衡量标准(与训练集误差相比)。

最佳做法是使用测试集误差,因为此度量不太容易产生偏差(与“隐藏”测试集相比,您很可能会在训练集上获得“更好”的预测结果,但这些结果将一种“过度拟合”)。如果你有一个测试集,你应该使用测试集作为第二个参数。

关于r - 精度函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43048018/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com