Skip to content

Instantly share code, notes, and snippets.

@lylayang
Created March 23, 2020 03:32
Show Gist options
  • Save lylayang/0cb97e6f59efd07c2bfa65521c0f0589 to your computer and use it in GitHub Desktop.
Save lylayang/0cb97e6f59efd07c2bfa65521c0f0589 to your computer and use it in GitHub Desktop.
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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment