Getting Started

You will need to import the Forecaster object and initialize it with an array of actual observed values and an array of corresponding dates. It’s generally a good idea to keep the dates sorted from least-to-most recent and ensure there are missing observations. As long as these arrays are in some kind of collection (whether it be list, numpy array, pandas series, etc.), the object should process them correctly.

from scalecast.Forecaster import Forecaster
array_of_dates = ['2021-01-01','2021-01-02','2021-01-03']
array_of_values = [1,2,3]
f = Forecaster(y=array_of_values, current_dates=array_of_dates)

One of the best parts of using scalecast is the ability to automatically tune and test models. The easiest way to do that is to use a grid and collection of models:

from scalecast.Forecaster import Forecaster
from scalecast import GridGenerator
models = ('mlr','elasticnet','mlp')
GridGenerator.get_example_grid() # writes the grids.py file to your working directory
array_of_dates = ['2021-01-01','2021-01-02','2021-01-03','2021-01-04','2021-01-05']
array_of_values = [1,2,3,4,5]
f = Forecaster(y=array_of_values, current_dates=array_of_dates)
f.generate_future_dates(5) # forecast length of 5
f.add_time_trend()
f.tune_test_forecast(models)
f.plot(ci=True) # see the forecasts

If you are working on Jupyter notebook and are forecasting many series, you can try something like this.

from scalecast.Forecaster import Forecaster
from scalecast import GridGenerator
from scalecast.notebook import tune_test_forecast, results_vis
import pandas_datareader as pdr # pip install pandas-datareader
f_dict = {}
models = ('mlr','elasticnet','mlp')
GridGenerator.get_example_grid() # writes the grids.py file to your working directory

for sym in ('UNRATE','GDP'):
  df = pdr.get_data_fred(sym, start = '2000-01-01')
  f = Forecaster(y=df[sym],current_dates=df.index)
  f.generate_future_dates(12) # forecast 12 periods to the future
  f.set_test_length(12) # test models on 12 periods
  f.set_validation_length(4) # validate on the previous 4 periods
  f.add_time_trend()
  f.add_seasonal_regressors('quarter',raw=False,dummy=True)
  tune_test_forecast(f,models) # adds a progress bar that is nice for notebooks
  f_dict[sym] = f

results_vis(f_dict) # toggle through results with jupyter widgets

These are simple procedures that barely scratch the surface of what scalecast can do! Happy reading!