【问题标题】:ARIMA with more than one attribute python具有多个属性python的ARIMA
【发布时间】:2019-04-15 11:43:52
【问题描述】:

在这里,我有一个包含两个属性的数据集。我总共有 200 天,每天都有 TotalTransactionNumberPrice 属性,例如:

    Day, Price,TotalTransactionNumber
    10/18/2015 0:00,262.9,118916
    10/19/2015 0:00,264.42,151128
    10/20/2015 0:00,270.22,147335
    10/21/2015 0:00,267.33,149446
    10/22/2015 0:00,274.41,146556
    10/23/2015 0:00,277.46,142066
    10/24/2015 0:00,282.66,140943
    10/25/2015 0:00,283.07,131191

在这里,我正在尝试使用 ARIMA,但我不知道如何使用它。在这种情况下,我试图猜测价格值。 如果只是价格,这个代码sn-p可以,但我不知道如何修改它。

from statsmodels.tsa.arima_model import ARIMA
import pandas as pd

series = pd.read_csv('prices.csv')
X = series.values
train, test = X[0:size], X[size:len(X)]
history = [x for x in train]
predictions = list()
for t in range(len(test)):
    model = ARIMA(history, order=(5,1,0))
    model_fit = model.fit(disp=0)
    output = model_fit.forecast()
    yhat = output[0]
    predictions.append(yhat)
    obs = test[t]
    history.append(obs)
    print('predicted=%f, expected=%f' % (yhat, obs))

【问题讨论】:

    标签: python-3.x time-series arima


    【解决方案1】:

    TL;DR:了解ARIMAexog 参数。


    据我所知,您从这个非常好的教程中获得了代码:

    https://machinelearningmastery.com/arima-for-time-series-forecasting-with-python/
    

    嗯,ARIMA 是一种分析和预测时间序列的统计方法。因此,起初它应该只处理来自时间序列本身的数据。但是,还有另一种称为 ARIMAX 的模型,它处理的外生数据可以补充通过主要时间序列观察到的数据。

    statsmodels的情况下,ARIMAX只是ARIMA在设置了参数exog时的特定情况。

    您应该尝试解决这个问题,注意 PriceTotalTransactionNumber 之间的任何“隐藏”关联。

    【讨论】:

      猜你喜欢
      • 2020-06-17
      • 1970-01-01
      • 2011-02-13
      • 1970-01-01
      • 2018-07-17
      • 2022-10-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多