1

我正在尝试对数据集使用多元时间序列。如何预测未来 10 周的数据点?

import pandas as pd
from statsmodels.tsa.vector_ar.var_model import VAR

df = pd.read_csv('SomeData.csv') # 10 years worth of weekly data
df.columns: weekly,col1,col2
dtypes: weekly is datetime64[ns], col1,col2 with numerical values
df = df.set_index('weekly')


# Make final predictions
model = VAR(endog=ds)
model_fit = model.fit()
yhat = model_fit.forecast(model_fit.y, steps=1)
print(yhat)
# I get this from above [[1.71417524  2.65237582 8.17163656]]

看起来我只得到单个预测数据点。如何在 python 中预测特定周的下周数据?我已经完成了培训和验证,我没有把它放在这里。有没有我可以在 Python 中传递时间序列的参数?好像找不到?我以前没有使用过“statsmodels”包,我也尝试过查看文档。非常感谢帮助!

4

0 回答 0