【发布时间】:2019-02-01 00:15:42
【问题描述】:
我正在尝试使用 ExponentialSmoothing(使用 pandas)来预测电力需求。
我编写的代码及其输出附在此消息的末尾。
关于为什么这会产生所有 NaN 的任何线索?训练是每小时间隔的,我假设每天(24 次测量)季节性。
提前致谢,
胡安·弗洛雷斯
print('modeling')
t1=time.time()
model = ExponentialSmoothing(KWHTr, trend='add', seasonal='add',
seasonal_periods=24).fit()
t2=time.time()
print('modeling time: ', t2-t1, 'sec')
print('predicting')
start_date = KWHVa.index[0]
end_date = KWHVa.index[-1]
print('period: (', start_date, '-', end_date,')')
pred=KWHVa.copy()
pred = model.predict(start=start_date, end=end_date)
print(pred)
print('*')
输出:
modeling
modeling time: 109.9684362411499 sec
predicting
period: (2017-10-29 10:00:00 - 2017-11-02 13:00:00 )
2017-10-29 10:00:00 NaN
2017-10-29 11:00:00 NaN
2017-10-29 12:00:00 NaN
2017-10-29 13:00:00 NaN
2017-10-29 14:00:00 NaN
..
2017-11-02 09:00:00 NaN
2017-11-02 10:00:00 NaN
2017-11-02 11:00:00 NaN
2017-11-02 12:00:00 NaN
2017-11-02 13:00:00 NaN
Freq: H, Length: 100, dtype: float64
*
【问题讨论】:
标签: python pandas dataframe time-series forecasting