Esempio n. 1
0
def hw_forecast(df,future,lag=12,method='mul',**kwargs):
    
    forecast=len(df)-1+future
    m=es(df,seasonal=method,trend=method,seasonal_periods=lag,**kwargs)
    model=m.fit(optimized=True)
    
    return model.predict(start=0,end=forecast)
Esempio n. 2
0
def hw_smooth(df,future,lag=12,method='mul',**kwargs):
    
    forecast=len(df)-1+future    
    
    m=es(df,seasonal=method,trend=method,seasonal_periods=lag,**kwargs)
    model=m.fit(optimized=True)
    plt.plot(model.predict(start=0,end=forecast),label='fitted', \
             color=pick_a_color())
    plt.plot(df.index,df,label='actual',color=pick_a_color())
    plt.legend(loc='best')
    plt.show()