This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import statsmodels.api as sm | |
fit1 = sm.tsa.statespace.SARIMAX(train.Spend, order=(7, 1, 2), seasonal_order=(0, 1, 2, 7)).fit(use_boxcox=True) | |
test['SARIMA'] = fit1.predict(start="2019-07-23", end="2019-09-23", dynamic=True) | |
plt.figure(figsize=(16, 8)) | |
plt.plot(train['Spend'], label='Train') | |
plt.plot(test['Spend'], label='Test') | |
plt.plot(test['SARIMA'], label='SARIMA') | |
plt.legend(loc='best') | |
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from statsmodels.tsa.api import ExponentialSmoothing | |
fit1 = ExponentialSmoothing(np.asarray(train['Spend']) ,seasonal_periods=7 ,trend='add', seasonal='add').fit(use_boxcox=True) | |
test['Holt_Winter'] = fit1.forecast(len(test)) | |
plt.figure(figsize=(16,8)) | |
plt.plot( train['Spend'], label='Train') | |
plt.plot(test['Spend'], label='Test') | |
plt.plot(test['Holt_Winter'], label='Holt_Winter') | |
plt.legend(loc='best') | |
plt.show() |
OlderNewer