autots.models package

Submodules

autots.models.basics module

Naives and Others Requiring No Additional Packages Beyond Numpy and Pandas

class autots.models.basics.AverageValueNaive(name: str = 'AverageValueNaive', frequency: str = 'infer', prediction_interval: float = 0.9, holiday_country: str = 'US', random_seed: int = 2020, verbose: int = 0, method: str = 'Median', **kwargs)

Bases: autots.evaluator.auto_model.ModelObject

Naive forecasting predicting a dataframe of the series’ median values

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

fit(df, future_regressor=[])

Train algorithm given data supplied.

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Returns dict of new parameters for parameter tuning

get_params()

Return dict of current parameters.

predict(forecast_length: int, future_regressor=[], just_point_forecast=False)

Generates forecast data immediately following dates of index supplied to .fit()

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

class autots.models.basics.LastValueNaive(name: str = 'LastValueNaive', frequency: str = 'infer', prediction_interval: float = 0.9, holiday_country: str = 'US', random_seed: int = 2020, **kwargs)

Bases: autots.evaluator.auto_model.ModelObject

Naive forecasting predicting a dataframe of the last series value

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

fit(df, future_regressor=[])

Train algorithm given data supplied

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Returns dict of new parameters for parameter tuning

get_params()

Return dict of current parameters

predict(forecast_length: int, future_regressor=[], just_point_forecast=False)

Generates forecast data immediately following dates of index supplied to .fit()

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

class autots.models.basics.MotifSimulation(name: str = 'MotifSimulation', frequency: str = 'infer', prediction_interval: float = 0.9, holiday_country: str = 'US', random_seed: int = 2020, phrase_len: str = '5', comparison: str = 'magnitude_pct_change_sign', shared: bool = False, distance_metric: str = 'l2', max_motifs: float = 50, recency_weighting: float = 0.1, cutoff_threshold: float = 0.9, cutoff_minimum: int = 20, point_method: str = 'median', verbose: int = 1, **kwargs)

Bases: autots.evaluator.auto_model.ModelObject

More dark magic created by the evil mastermind of this project. Basically a highly-customized KNN

Warning: if you are forecasting many steps (large forecast_length), and interested in probabilistic upper/lower forecasts, then set recency_weighting <= 0, and have a larger cutoff_minimum

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

  • phrase_len (int) – length of motif vectors to compare as samples

  • comparison (str) – method to process data before comparison, ‘magnitude’ is original data

  • shared (bool) – whether to compare motifs across all series together, or separately

  • distance_metric (str) – passed through to sklearn pairwise_distances

  • max_motifs (float) – number of motifs to compare per series. If less 1, used as % of length training data

  • recency_weighting (float) – amount to the value of more recent data.

  • cutoff_threshold (float) – lowest value of distance metric to allow into forecast

  • cutoff_minimum (int) – minimum number of motif vectors to include in forecast.

  • point_method (str) – summarization method to choose forecast on, ‘sample’, ‘mean’, ‘sign_biased_mean’, ‘median’

fit(df, future_regressor=[])

Train algorithm given data supplied.

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Return dict of new parameters for parameter tuning.

get_params()

Return dict of current parameters.

predict(forecast_length: int, future_regressor=[], just_point_forecast=False)

Generates forecast data immediately following dates of index supplied to .fit()

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

class autots.models.basics.SeasonalNaive(name: str = 'SeasonalNaive', frequency: str = 'infer', prediction_interval: float = 0.9, holiday_country: str = 'US', random_seed: int = 2020, verbose: int = 0, lag_1: int = 7, lag_2: int = None, method: str = 'LastValue', **kwargs)

Bases: autots.evaluator.auto_model.ModelObject

Naive forecasting predicting a dataframe with seasonal (lag) forecasts.

Concerto No. 2 in G minor, Op. 8, RV 315

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

  • method (str) – Either ‘LastValue’ (use last value of lag n) or ‘Mean’ (avg of all lag n)

  • lag_1 (int) – The lag of the seasonality, should int > 1.

  • lag_2 (int) – Optional second lag of seasonality which is averaged with first lag to produce forecast.

fit(df, future_regressor=[])

Train algorithm given data supplied.

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Return dict of new parameters for parameter tuning.

get_params()

Return dict of current parameters.

predict(forecast_length: int, future_regressor=[], just_point_forecast: bool = False)

Generate forecast data immediately following dates of .fit().

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

class autots.models.basics.ZeroesNaive(name: str = 'ZeroesNaive', frequency: str = 'infer', prediction_interval: float = 0.9, holiday_country: str = 'US', random_seed: int = 2020, verbose: int = 0, **kwargs)

Bases: autots.evaluator.auto_model.ModelObject

Naive forecasting predicting a dataframe of zeroes (0’s)

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

fit(df, future_regressor=[])

Train algorithm given data supplied

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Returns dict of new parameters for parameter tuning

get_params()

Return dict of current parameters

predict(forecast_length: int, future_regressor=[], just_point_forecast=False)

Generates forecast data immediately following dates of index supplied to .fit()

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

autots.models.dnn module

Neural Nets.

class autots.models.dnn.KerasRNN(rnn_type: str = 'LSTM', kernel_initializer: str = 'lecun_uniform', hidden_layer_sizes: tuple = (32, 32, 32), optimizer: str = 'adam', loss: str = 'huber', epochs: int = 50, batch_size: int = 32, verbose: int = 1, random_seed: int = 2020)

Bases: object

Wrapper for Tensorflow Keras based RNN.

Parameters
  • rnn_type (str) – Keras cell type ‘GRU’ or default ‘LSTM’

  • kernel_initializer (str) – passed to first keras LSTM or GRU layer

  • hidden_layer_sizes (tuple) – of len 1 or 3 passed to first keras LSTM or GRU layers

  • optimizer (str) – Passed to keras model.compile

  • loss (str) – Passed to keras model.compile

  • epochs (int) – Passed to keras model.fit

  • batch_size (int) – Passed to keras model.fit

  • verbose (int) – 0, 1 or 2. Passed to keras model.fit

  • random_seed (int) – passed to tf.random.set_seed()

fit(X, Y)

Train the model on dataframes of X and Y.

predict(X)

Predict on dataframe of X.

autots.models.ensemble module

Tools for generating and forecasting with ensembles of models.

autots.models.ensemble.Best3Ensemble(ensemble_params, forecasts_list, forecasts, lower_forecasts, upper_forecasts, forecasts_runtime, prediction_interval)

Generate mean forecast for ensemble of models.

autots.models.ensemble.DistEnsemble(ensemble_params, forecasts_list, forecasts, lower_forecasts, upper_forecasts, forecasts_runtime, prediction_interval)

Generate forecast for distance ensemble.

autots.models.ensemble.EnsembleForecast(ensemble_str, ensemble_params, forecasts_list, forecasts, lower_forecasts, upper_forecasts, forecasts_runtime, prediction_interval)

Return PredictionObject for given ensemble method.

autots.models.ensemble.EnsembleTemplateGenerator(initial_results, forecast_length: int = 14, ensemble: str = 'simple')

Generate ensemble templates given a table of results.

autots.models.ensemble.HDistEnsemble(ensemble_params, forecasts_list, forecasts, lower_forecasts, upper_forecasts, forecasts_runtime, prediction_interval)

Generate forecast for per_series per distance ensembling.

autots.models.ensemble.HorizontalEnsemble(ensemble_params, forecasts_list, forecasts, lower_forecasts, upper_forecasts, forecasts_runtime, prediction_interval)

Generate forecast for per_series ensembling.

autots.models.ensemble.HorizontalTemplateGenerator(per_series, model_results, forecast_length: int = 14, ensemble: str = 'horizontal', subset_flag: bool = True, per_series2=None)

Generate horizontal ensemble templates given a table of results.

autots.models.gluonts module

GluonTS

Excellent models, released by Amazon, scale well. Except it is really the only thing I use that runs mxnet, and it takes a while to train these guys…

class autots.models.gluonts.GluonTS(name: str = 'GluonTS', frequency: str = 'infer', prediction_interval: float = 0.9, regression_type: str = None, holiday_country: str = 'US', random_seed: int = 2020, verbose: int = 0, gluon_model: str = 'DeepAR', epochs: int = 20, learning_rate: float = 0.001, context_length=10, forecast_length: int = 14)

Bases: autots.evaluator.auto_model.ModelObject

GluonTS based on mxnet.

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

  • regression_type (str) – Not yet implemented

  • gluon_model (str) – Model Structure to Use - [‘DeepAR’, ‘NPTS’, ‘DeepState’, ‘WaveNet’,’DeepFactor’, ‘Transformer’,’SFF’, ‘MQCNN’]

  • epochs (int) – Number of neural network training epochs. Higher generally results in better, then over fit.

  • learning_rate (float) – Neural net training parameter

  • context_length (str) – int window, ‘2ForecastLength’, or ‘nForecastLength’

  • forecast_length (int) – Length to forecast. Unlike in other methods, this must be provided before fitting model

fit(df, future_regressor=[])

Train algorithm given data supplied.

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Return dict of new parameters for parameter tuning.

get_params()

Return dict of current parameters.

predict(forecast_length: int, future_regressor=[], just_point_forecast=False)

Generates forecast data immediately following dates of index supplied to .fit()

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

autots.models.prophet module

Facebook’s Prophet

Since Prophet install can be finicky on Windows, it will be an optional dependency.

class autots.models.prophet.FBProphet(name: str = 'FBProphet', frequency: str = 'infer', prediction_interval: float = 0.9, holiday: bool = False, regression_type: str = None, holiday_country: str = 'US', random_seed: int = 2020, verbose: int = 0, n_jobs: int = None)

Bases: autots.evaluator.auto_model.ModelObject

Facebook’s Prophet

‘thou shall count to 3, no more, no less, 3 shall be the number thou shall count, and the number of the counting shall be 3. 4 thou shall not count, neither count thou 2, excepting that thou then preceed to 3.’ -Python

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

  • holiday (bool) – If true, include holidays

  • regression_type (str) – type of regression (None, ‘User’)

fit(df, future_regressor=[])

Train algorithm given data supplied.

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Return dict of new parameters for parameter tuning.

get_params()

Return dict of current parameters.

predict(forecast_length: int, future_regressor=[], just_point_forecast: bool = False)

Generates forecast data immediately following dates of index supplied to .fit()

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

autots.models.sklearn module

Sklearn dependent models

Decision Tree, Elastic Net, Random Forest, MLPRegressor, KNN, Adaboost

class autots.models.sklearn.ComponentAnalysis(name: str = 'ComponentAnalysis', frequency: str = 'infer', prediction_interval: float = 0.9, holiday_country: str = 'US', random_seed: int = 2020, verbose: int = 0, n_components: int = 10, forecast_length: int = 14, model: str = 'GLS', model_parameters: dict = {}, decomposition: str = 'PCA', n_jobs: int = -1)

Bases: autots.evaluator.auto_model.ModelObject

Forecasting on principle components.

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

  • model (str) – An AutoTS model str

  • model_parameters (dict) – parameters to pass to AutoTS model

  • n_components (int) – int or ‘NthN’ number of components to use

  • decomposition (str) – decomposition method to use from scikit-learn

fit(df, future_regressor=[])

Train algorithm given data supplied.

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Return dict of new parameters for parameter tuning.

get_params()

Return dict of current parameters.

predict(forecast_length: int, future_regressor=[], just_point_forecast: bool = False)

Generate forecast data immediately following dates of .fit().

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

class autots.models.sklearn.RollingRegression(name: str = 'RollingRegression', frequency: str = 'infer', prediction_interval: float = 0.9, regression_type: str = None, holiday_country: str = 'US', verbose: int = 0, random_seed: int = 2020, regression_model: dict = {'model': 'Adaboost', 'model_params': {'base_estimator': 'DecisionTree', 'learning_rate': 1.0, 'loss': 'linear', 'n_estimators': 50}}, holiday: bool = False, mean_rolling_periods: int = 30, macd_periods: int = None, std_rolling_periods: int = 7, max_rolling_periods: int = 7, min_rolling_periods: int = 7, ewm_alpha: float = 0.5, additional_lag_periods: int = 7, abs_energy: bool = False, rolling_autocorr_periods: int = None, add_date_part: str = None, polynomial_degree: int = None, x_transform: str = None, n_jobs: int = -1, **kwargs)

Bases: autots.evaluator.auto_model.ModelObject

General regression-framed approach to forecasting using sklearn.

Who are you who are so wise in the ways of science? I am Arthur, King of the Britons. -Python

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

  • holiday (bool) – If true, include holiday flags

  • regression_type (str) – type of regression (None, ‘User’)

fit(df, future_regressor=[])

Train algorithm given data supplied.

Parameters
  • df (pandas.DataFrame) – Datetime Indexed

  • future_regressor (pandas.DataFrame or Series) – Datetime Indexed

get_new_params(method: str = 'random')

Return dict of new parameters for parameter tuning.

get_params()

Return dict of current parameters.

predict(forecast_length: int, future_regressor=[], just_point_forecast: bool = False)

Generate forecast data immediately following dates of index supplied to .fit().

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

class autots.models.sklearn.WindowRegression(name: str = 'WindowRegression', frequency: str = 'infer', prediction_interval: float = 0.9, holiday_country: str = 'US', random_seed: int = 2020, verbose: int = 0, window_size: int = 10, regression_model: dict = {'model': 'Adaboost', 'model_params': {'base_estimator': 'DecisionTree', 'learning_rate': 1.0, 'loss': 'linear', 'n_estimators': 50}}, input_dim: str = 'multivariate', output_dim: str = '1step', normalize_window: bool = False, shuffle: bool = True, forecast_length: int = 1, max_windows: int = 5000, n_jobs: int = -1, **kwargs)

Bases: autots.evaluator.auto_model.ModelObject

Regression use the last n values as the basis of training data.

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

  • transfer_learning (#) – str = None,

  • transfer_learning_transformation (#) – dict = None,

  • regression_type (#) – str = None,

fit(df, future_regressor=[])

Train algorithm given data supplied.

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Return dict of new parameters for parameter tuning.

get_params()

Return dict of current parameters.

predict(forecast_length: int, future_regressor=[], just_point_forecast: bool = False)

Generate forecast data immediately following dates of .fit().

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

autots.models.sklearn.date_part(DTindex, method: str = 'simple')

Create date part columns from pd.DatetimeIndex.

Parameters
  • DTindex (pd.DatetimeIndex) – datetime index to provide dates

  • method (str) – expanded, recurring, or simple simple - just day, year, month, weekday expanded - all available futures recurring - all features that should commonly repeat without aging

Returns

pd.Dataframe with DTindex

autots.models.sklearn.generate_regressor_params(models: list = ['RandomForest', 'ElasticNet', 'MLP', 'DecisionTree', 'KNN', 'Adaboost', 'SVM', 'BayesianRidge', 'xgboost', 'KerasRNN', 'HistGradientBoost', 'LightGBM'], model_probs: list = [0.05, 0.05, 0.14, 0.25, 0.1, 0.14, 0.02, 0.08, 0.01, 0.05, 0.01, 0.1])

Generate new parameters for input to regressor.

autots.models.sklearn.last_window(df, window_size: int = 10, input_dim: str = 'multivariate', normalize_window: bool = False)
autots.models.sklearn.retrieve_regressor(regression_model: dict = {'model': 'Adaboost', 'model_params': {'base_estimator': 'DecisionTree', 'learning_rate': 1.0, 'loss': 'linear', 'n_estimators': 50}}, verbose: int = 0, verbose_bool: bool = False, random_seed: int = 2020, n_jobs: int = 1)

Convert a model param dict to model object for regression frameworks.

autots.models.sklearn.rolling_x_regressor(df, mean_rolling_periods: int = 30, macd_periods: int = None, std_rolling_periods: int = 7, max_rolling_periods: int = None, min_rolling_periods: int = None, ewm_alpha: float = 0.5, additional_lag_periods: int = 7, abs_energy: bool = False, rolling_autocorr_periods: int = None, add_date_part: str = None, holiday: bool = False, holiday_country: str = 'US', polynomial_degree: int = None)

Generate more features from initial time series.

macd_periods ignored if mean_rolling is None.

Returns a dataframe of statistical features. Will need to be shifted by 1 or more to match Y for forecast.

autots.models.sklearn.window_maker(df, window_size: int = 10, input_dim: str = 'multivariate', normalize_window: bool = False, shuffle: bool = True, output_dim: str = 'forecast_length', forecast_length: int = 1, max_windows: int = 5000)

Convert a dataset into slices with history and y forecast.

autots.models.statsmodels module

Statsmodels based forecasting models.

class autots.models.statsmodels.ARIMA(name: str = 'ARIMA', frequency: str = 'infer', prediction_interval: float = 0.9, p: int = 0, d: int = 1, q: int = 0, regression_type: str = None, holiday_country: str = 'US', random_seed: int = 2020, verbose: int = 0, n_jobs: int = None, **kwargs)

Bases: autots.evaluator.auto_model.ModelObject

ARIMA from Statsmodels.

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

  • p (int) – is the number of autoregressive steps,

  • d (int) – is the number of differences needed for stationarity

  • q (int) – is the number of lagged forecast errors in the prediction.

  • regression_type (str) – type of regression (None, ‘User’, or ‘Holiday’)

  • n_jobs (int) – passed to joblib for multiprocessing. Set to none for context manager.

fit(df, future_regressor=[])

Train algorithm given data supplied .

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Return dict of new parameters for parameter tuning.

large p,d,q can be very slow (a p of 30 can take hours)

get_params()

Return dict of current parameters.

predict(forecast_length: int, future_regressor=[], just_point_forecast=False)

Generate forecast data immediately following dates of index supplied to .fit().

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

class autots.models.statsmodels.DynamicFactor(name: str = 'DynamicFactor', frequency: str = 'infer', prediction_interval: float = 0.9, regression_type: str = None, holiday_country: str = 'US', random_seed: int = 2020, verbose: int = 0, k_factors: int = 1, factor_order: int = 0, **kwargs)

Bases: autots.evaluator.auto_model.ModelObject

DynamicFactor from Statsmodels

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

  • regression_type (str) – type of regression (None, ‘User’, or ‘Holiday’)

fit(df, future_regressor=[])

Train algorithm given data supplied.

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Return dict of new parameters for parameter tuning.

get_params()

Return dict of current parameters.

predict(forecast_length: int, future_regressor=[], just_point_forecast=False)

Generates forecast data immediately following dates of index supplied to .fit()

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or

if just_point_forecast == True, a dataframe of point forecasts

maModel = DynamicFactor(df_train, freq = ‘MS’, k_factors = 2, factor_order=2).fit() maPred = maModel.predict()

class autots.models.statsmodels.ETS(name: str = 'ETS', frequency: str = 'infer', prediction_interval: float = 0.9, damped: bool = False, trend: str = None, seasonal: str = None, seasonal_periods: int = None, holiday_country: str = 'US', random_seed: int = 2020, verbose: int = 0, n_jobs: int = None, **kwargs)

Bases: autots.evaluator.auto_model.ModelObject

Exponential Smoothing from Statsmodels

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

  • damped (bool) – passed through to statsmodel ETS

  • trend (str) – passed through to statsmodel ETS

  • seasonal (bool) – passed through to statsmodel ETS

  • seasonal_periods (int) – passed through to statsmodel ETS

fit(df, future_regressor=[])

Train algorithm given data supplied

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Return dict of new parameters for parameter tuning.

get_params()

Return dict of current parameters.

predict(forecast_length: int, future_regressor=[], just_point_forecast=False)

Generates forecast data immediately following dates of index supplied to .fit()

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

class autots.models.statsmodels.GLM(name: str = 'GLM', frequency: str = 'infer', prediction_interval: float = 0.9, holiday_country: str = 'US', random_seed: int = 2020, regression_type: str = None, family='Gaussian', constant: bool = False, verbose: int = 1, n_jobs: int = None, **kwargs)

Bases: autots.evaluator.auto_model.ModelObject

Simple linear regression from statsmodels

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

  • regression_type (str) – type of regression (None, ‘User’)

fit(df, future_regressor=[])

Train algorithm given data supplied

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Return dict of new parameters for parameter tuning.

get_params()

Return dict of current parameters.

predict(forecast_length: int, future_regressor=[], just_point_forecast=False)

Generates forecast data immediately following dates of index supplied to .fit()

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

class autots.models.statsmodels.GLS(name: str = 'GLS', frequency: str = 'infer', prediction_interval: float = 0.9, holiday_country: str = 'US', random_seed: int = 2020, **kwargs)

Bases: autots.evaluator.auto_model.ModelObject

Simple linear regression from statsmodels

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

fit(df, future_regressor=[])

Train algorithm given data supplied

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Returns dict of new parameters for parameter tuning

get_params()

Return dict of current parameters

predict(forecast_length: int, future_regressor=[], just_point_forecast=False)

Generates forecast data immediately following dates of index supplied to .fit()

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

class autots.models.statsmodels.UnobservedComponents(name: str = 'UnobservedComponents', frequency: str = 'infer', prediction_interval: float = 0.9, regression_type: str = None, holiday_country: str = 'US', random_seed: int = 2020, verbose: int = 0, level: bool = False, trend: bool = False, cycle: bool = False, damped_cycle: bool = False, irregular: bool = False, stochastic_cycle: bool = False, stochastic_trend: bool = False, stochastic_level: bool = False, **kwargs)

Bases: autots.evaluator.auto_model.ModelObject

UnobservedComponents from Statsmodels.

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

  • regression_type (str) – type of regression (None, ‘User’, or ‘Holiday’)

fit(df, future_regressor=[])

Train algorithm given data supplied

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Return dict of new parameters for parameter tuning.

get_params()

Return dict of current parameters.

predict(forecast_length: int, future_regressor=[], just_point_forecast: bool = False)

Generate forecast data immediately following dates of index supplied to .fit().

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

class autots.models.statsmodels.VAR(name: str = 'VAR', frequency: str = 'infer', prediction_interval: float = 0.9, regression_type: str = None, holiday_country: str = 'US', random_seed: int = 2020, verbose: int = 0, maxlags: int = 15, ic: str = 'fpe', **kwargs)

Bases: autots.evaluator.auto_model.ModelObject

VAR from Statsmodels.

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

  • regression_type (str) – type of regression (None, ‘User’, or ‘Holiday’)

fit(df, future_regressor=[])

Train algorithm given data supplied.

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Return dict of new parameters for parameter tuning.

get_params()

Return dict of current parameters.

predict(forecast_length: int, future_regressor=[], just_point_forecast=False)

Generates forecast data immediately following dates of index supplied to .fit()

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

class autots.models.statsmodels.VARMAX(name: str = 'VARMAX', frequency: str = 'infer', prediction_interval: float = 0.9, regression_type: str = None, holiday_country: str = 'US', random_seed: int = 2020, verbose: int = 0, order: tuple = (1, 0), trend: str = 'c', **kwargs)

Bases: autots.evaluator.auto_model.ModelObject

VARMAX from Statsmodels

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

  • regression_type (str) – type of regression (None, ‘User’, or ‘Holiday’)

fit(df, future_regressor=[])

Train algorithm given data supplied

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Return dict of new parameters for parameter tuning.

get_params()

Return dict of current parameters.

predict(forecast_length: int, future_regressor=[], just_point_forecast=False)

Generate forecast data immediately following dates of index supplied to .fit().

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

class autots.models.statsmodels.VECM(name: str = 'VECM', frequency: str = 'infer', prediction_interval: float = 0.9, regression_type: str = None, holiday_country: str = 'US', random_seed: int = 2020, verbose: int = 0, deterministic: str = 'nc', k_ar_diff: int = 1, **kwargs)

Bases: autots.evaluator.auto_model.ModelObject

VECM from Statsmodels

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

  • regression_type (str) – type of regression (None, ‘User’, or ‘Holiday’)

fit(df, future_regressor=[])

Train algorithm given data supplied.

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Return dict of new parameters for parameter tuning.

get_params()

Return dict of current parameters.

predict(forecast_length: int, future_regressor=[], just_point_forecast=False)

Generates forecast data immediately following dates of index supplied to .fit()

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

autots.models.tfp module

class autots.models.tfp.TFPRegression(name: str = 'TFPRegression', frequency: str = 'infer', prediction_interval: float = 0.9, holiday_country: str = 'US', random_seed: int = 2020, verbose: int = 1, kernel_initializer: str = 'lecun_uniform', optimizer: str = 'adam', loss: str = 'negloglike', epochs: int = 50, batch_size: int = 32, dist: str = 'normal', regression_type: str = None)

Bases: autots.evaluator.auto_model.ModelObject

Tensorflow Probability regression.

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

  • regression_type (str) – type of regression (None, ‘User’)

fit(df, future_regressor=[])

Train algorithm given data supplied

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Return dict of new parameters for parameter tuning.

get_params()

Return dict of current parameters.

predict(forecast_length: int, future_regressor=[], just_point_forecast=False)

Generates forecast data immediately following dates of index supplied to .fit()

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

class autots.models.tfp.TFPRegressor(kernel_initializer: str = 'lecun_uniform', optimizer: str = 'adam', loss: str = 'negloglike', epochs: int = 50, batch_size: int = 32, dist: str = 'normal', verbose: int = 1, random_seed: int = 2020)

Bases: object

Wrapper for Tensorflow Keras based RNN.

Parameters
  • rnn_type (str) – Keras cell type ‘GRU’ or default ‘LSTM’

  • kernel_initializer (str) – passed to first keras LSTM or GRU layer

  • hidden_layer_sizes (tuple) – of len 1 or 3 passed to first keras LSTM or GRU layers

  • optimizer (str) – Passed to keras model.compile

  • loss (str) – Passed to keras model.compile

  • epochs (int) – Passed to keras model.fit

  • batch_size (int) – Passed to keras model.fit

  • verbose (int) – 0, 1 or 2. Passed to keras model.fit

  • random_seed (int) – passed to tf.random.set_seed()

fit(X, Y)

Train the model on dataframes of X and Y.

predict(X, conf_int: float = None)

Predict on dataframe of X.

class autots.models.tfp.TensorflowSTS(name: str = 'TensorflowSTS', frequency: str = 'infer', prediction_interval: float = 0.9, regression_type: str = None, holiday_country: str = 'US', random_seed: int = 2020, verbose: int = 0, trend: str = 'local', seasonal_periods: int = None, ar_order: int = None, fit_method: str = 'hmc', num_steps: int = 200)

Bases: autots.evaluator.auto_model.ModelObject

STS from TensorflowProbability.

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

  • regression_type (str) – type of regression (None, ‘User’, or ‘Holiday’)

fit(df, future_regressor=[])

Train algorithm given data supplied.

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Return dict of new parameters for parameter tuning.

get_params()

Return dict of current parameters.

predict(forecast_length: int, future_regressor=[], just_point_forecast=False)

Generates forecast data immediately following dates of index supplied to .fit()

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor, not used

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

autots.models.tsfresh module

tsfresh - automated feature extraction

n_jobs>1 causes Windows issues, sometimes maybe

class autots.models.tsfresh.TSFreshRegressor(name: str = 'TSFreshRegressor', frequency: str = 'infer', prediction_interval: float = 0.9, regression_type: str = None, holiday_country: str = 'US', verbose: int = 0, random_seed: int = 2020, regression_model: str = 'Adaboost', max_timeshift: int = 10, feature_selection: str = None)

Bases: autots.evaluator.auto_model.ModelObject

Sklearn + TSFresh feature generation

Parameters
  • name (str) – String to identify class

  • frequency (str) – String alias of datetime index frequency or else ‘infer’

  • prediction_interval (float) – Confidence interval for probabilistic forecast

  • holiday (bool) – If true, include holiday flags

  • regression_type (str) – type of regression (None, ‘User’)

fit(df, future_regressor=[])

Train algorithm given data supplied

Parameters

df (pandas.DataFrame) – Datetime Indexed

get_new_params(method: str = 'random')

Returns dict of new parameters for parameter tuning

get_params()

Return dict of current parameters

predict(forecast_length: int, future_regressor=[], just_point_forecast: bool = False)

Generates forecast data immediately following dates of index supplied to .fit()

Parameters
  • forecast_length (int) – Number of periods of data to forecast ahead

  • regressor (numpy.Array) – additional regressor

  • just_point_forecast (bool) – If True, return a pandas.DataFrame of just point forecasts

Returns

Either a PredictionObject of forecasts and metadata, or if just_point_forecast == True, a dataframe of point forecasts

Module contents

Model Models