问题描述
我的ETF Boil ARIMA建模代码(ProShares Ultra Bloomberg NG ETF)遇到一些问题。我的问题是,当我最终设置ARIMA并在测试阵列上运行它时,它在所有插槽中都给出了一个数字,并且没有给出我想要的预测。我只是UND的一名学生,试图对股价进行一些预测,所以我可以对此做一个简短的介绍。我没有Python的超高级技能,到目前为止,我几乎一直在关注这本书。以下是通过Anaconda在我的Jupyter笔记本中的代码。任何帮助都将是惊人的。
pip install pandas
pip install matplotlib
pip install statsmodels
pip install sklearn
import sys
import pandas as pd
import matplotlib.pyplot as plt
import numpy
from statsmodels.tsa.arima_model import ARIMA
from pandas.plotting import autocorrelation_plot
from matplotlib import pyplot
import pmdarima.arima as pmd
data = pd.read_csv(r'/Users/Thomsen/Desktop/Coding/BOIL.csv',index_col=0)
data.tail()
BOIL = data.drop(columns =['High','Low','Close','Adj Close','Volume'])
BOIL.tail(5)
BOIL.head(5)
boilNow = BOIL.plot()
fig1 = boilNow.get_figure()
fig1.savefig('BOILNow.png')
TestSet = BOIL.tail(20)
print(TestSet)
BOILbd = BOIL[:-20]
print(BOILbd)
BOILbd.tail()
BOILbd.plot()
boilmodelset = BOILbd.plot()
fig2 = boilNow.get_figure()
fig2.savefig('BOILpre.png')
def arimamodel(timeseriesarray):
autoarima_model = pmd.auto_arima(timeseriesarray,start_p=1,start_q=1,test="adf",trace=True)
return autoarima_model
arima_model = arimamodel(BOILbd)
arima_model.summary()
TestSet['ARIMA']=arima_model.predict(len(TestSet))
TestSet.head()
t = BOIL
random = arimamodel(t)
random.summary()
t["Arima"] = random.forecast(len(t))
pmd.auto_arima(BOILbd,start_P=1,start_Q=1,max_p=5,max_q=5,max_P=5,max_Q=5,suppress_warnings=True,D = 10,max_D=10)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)