Skip to content

Instantly share code, notes, and snippets.

@mikekeith52
Last active October 19, 2023 15:47
Show Gist options
  • Save mikekeith52/ad83ceda9b48972213d7982fe1f3b70a to your computer and use it in GitHub Desktop.
Save mikekeith52/ad83ceda9b48972213d7982fe1f3b70a to your computer and use it in GitHub Desktop.
import pandas as pd
import numpy as np
from scalecast.Forecaster import Forecaster
from pmdarima import auto_arima
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(rc={'figure.figsize':(14,7)})
df = pd.read_csv('AirPassengers.csv')
f = Forecaster(y=df['#Passengers'],current_dates=df['Month'])
f.generate_future_dates(12) # 12-month forecast horizon
f.set_test_length(.2) # 20% test set
f.set_estimator('arima') # set arima
f.manual_forecast(call_me='arima1') # forecast with arima
f.plot_test_set(ci=True) # view test results
plt.title('ARIMA Test-Set Performance',size=14)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment