AutoTS (deprecated)

Warning

The API in this page will be deprecated soon. Please refer to our new AutoTS API.

AutoTSTrainer

AutoTSTrainer trains a time series pipeline (including data processing, feature engineering, and model) with AutoML.

class bigdl.chronos.autots.deprecated.forecast.AutoTSTrainer[source]

Bases:

The Automated Time Series Forecast Trainer

Initialize the AutoTS Trainer.

Parameters
  • horizon – steps to look forward

  • dt_col – the datetime column

  • target_col – the target column to forecast

  • extra_features_col – extra feature columns

fit()[source]

Fit a time series forecasting pipeline w/ automl

Parameters
  • train_df – the input dataframe (as pandas.dataframe)

  • validation_df – the validation dataframe (as pandas.dataframe)

  • recipe – the configuration of searching

  • metric – the evaluation metric to optimize

  • uncertainty – whether to enable uncertainty calculation (will output an uncertainty sigma)

  • upload_dir – Optional URI to sync training results and checkpoints. We only support hdfs URI for now.

:return a TSPipeline

TSPipeline

A pipeline for time series forecasting.

class bigdl.chronos.autots.deprecated.forecast.TSPipeline[source]

Bases: object

A pipeline for time series forecasting.

Initialize an emtpy TSPipeline. Usually it is not called by user directly. A TSPipeline is either obtained from AutoTrainer.fit or TSPipeline.load

save(pipeline_file)[source]

Save the pipeline to a file

Parameters

pipeline_file – the file path

Returns

static load(pipeline_file)[source]

Load pipeline from a file

Parameters

pipeline_file – the pipeline file

Returns

a TSPipeline object

fit(input_df, validation_df=None, uncertainty: bool = False, epochs=1, **user_config)[source]

Incremental Fitting

Parameters
  • input_df – the input dataframe

  • validation_df – the validation dataframe

  • uncertainty – whether to calculate uncertainty

  • epochs – number of epochs to train

  • user_config – user configurations

Returns

predict(input_df)[source]

Prediction.

Parameters

input_df – the input dataframe

Returns

the forecast results

evaluate(input_df, metrics=['mse'], multioutput='raw_values')[source]

Evaluation

Parameters
  • input_df – the input dataframe

  • metrics – the evaluation metrics

  • multioutput – output mode of multiple output, whether to aggregate

Returns

the evaluation results

Recipe

Recipe is used for search configuration for AutoTSTrainer.

class bigdl.chronos.autots.deprecated.config.recipe.SmokeRecipe[source]

Bases:

A very simple Recipe for smoke test that runs one epoch and one iteration with only 1 random sample.

class bigdl.chronos.autots.deprecated.config.recipe.MTNetSmokeRecipe[source]

Bases:

A very simple Recipe for smoke test that runs one epoch and one iteration with only 1 random sample.

class bigdl.chronos.autots.deprecated.config.recipe.TCNSmokeRecipe[source]

Bases:

A very simple Recipe for smoke test that runs one epoch and one iteration with only 1 random sample.

class bigdl.chronos.autots.deprecated.config.recipe.PastSeqParamHandler[source]

Bases: object

Utility to handle PastSeq Param

static get_past_seq_config(look_back)[source]

Generate pass sequence config based on look_back.

Parameters

look_back – look_back configuration

Returns

search configuration for past sequence

class bigdl.chronos.autots.deprecated.config.recipe.GridRandomRecipe[source]

Bases:

A recipe involves both grid search and random search.

Constructor. :param num_rand_samples: number of hyper-param configurations sampled randomly :param look_back: the length to look back, either a tuple with 2 int values,

which is in format is (min len, max len), or a single int, which is a fixed length to look back.

Parameters
  • training_iteration – no. of iterations for training (n epochs) in trials

  • epochs – no. of epochs to train in each iteration

class bigdl.chronos.autots.deprecated.config.recipe.LSTMSeq2SeqRandomRecipe[source]

Bases:

A recipe involves both grid search and random search, only for Seq2SeqPytorch. Note: This recipe is specifically designed for third-party model searching, rather than TimeSequencePredictor.

Constructor. set the param to a list for grid search. set the param to a tuple with length = 2 for random search.

Parameters
  • input_feature_num – (int) no. of input feature

  • output_feature_num – (int) no. of ouput feature

  • future_seq_len – (int) no. of steps to be predicted (i.e. horizon)

  • num_rand_samples – (int) number of hyper-param configurations sampled randomly

  • epochs – (int) no. of epochs to train in each iteration

  • training_iteration – (int) no. of iterations for training (n epochs) in trials

  • batch_size – (tuple|list) grid search candidates for batch size

  • lr – (tuple|list) learning rate

  • lstm_hidden_dim – (tuple|list) lstm hidden dim for both encoder and decoder

  • lstm_layer_num – (tuple|list) no. of lstm layer for both encoder and decoder

  • dropout – (tuple|list) dropout for lstm layer

  • teacher_forcing – (list) if to use teacher forcing machanism during training

class bigdl.chronos.autots.deprecated.config.recipe.LSTMGridRandomRecipe[source]

Bases:

A recipe involves both grid search and random search, only for LSTM.

Constructor.

Parameters
  • lstm_1_units – random search candidates for num of lstm_1_units

  • lstm_2_units – grid search candidates for num of lstm_1_units

  • batch_size – grid search candidates for batch size

  • num_rand_samples – number of hyper-param configurations sampled randomly

  • look_back – the length to look back, either a tuple with 2 int values, which is in format is (min len, max len), or a single int, which is a fixed length to look back.

  • training_iteration – no. of iterations for training (n epochs) in trials

  • epochs – no. of epochs to train in each iteration

class bigdl.chronos.autots.deprecated.config.recipe.Seq2SeqRandomRecipe[source]

Bases:

A recipe involves both grid search and random search, only for LSTM.

Constructor.

Parameters
  • lstm_1_units – random search candidates for num of lstm_1_units

  • lstm_2_units – grid search candidates for num of lstm_1_units

  • batch_size – grid search candidates for batch size

  • num_rand_samples – number of hyper-param configurations sampled randomly

  • look_back – the length to look back, either a tuple with 2 int values, which is in format is (min len, max len), or a single int, which is a fixed length to look back.

  • training_iteration – no. of iterations for training (n epochs) in trials

  • epochs – no. of epochs to train in each iteration

class bigdl.chronos.autots.deprecated.config.recipe.MTNetGridRandomRecipe[source]

Bases:

Grid+Random Recipe for MTNet

Constructor.

Parameters
  • num_rand_samples – number of hyper-param configurations sampled randomly

  • training_iteration – no. of iterations for training (n epochs) in trials

  • epochs – no. of epochs to train in each iteration

  • time_step – random search candidates for model param “time_step”

  • long_num – random search candidates for model param “long_num”

  • ar_size – random search candidates for model param “ar_size”

  • batch_size – grid search candidates for batch size

  • cnn_height – random search candidates for model param “cnn_height”

  • cnn_hid_size – random search candidates for model param “cnn_hid_size”

class bigdl.chronos.autots.deprecated.config.recipe.TCNGridRandomRecipe[source]

Bases:

Grid+Random Recipe for TCN

Constructor.

Parameters
  • num_rand_samples – number of hyper-param configurations sampled randomly

  • training_iteration – no. of iterations for training (n epochs) in trials

  • batch_size – grid search candidates for batch size

  • hidden_size – grid search candidates for hidden size of each layer

  • levels – the number of layers

  • kernel_size – the kernel size of each layer

  • dropout – dropout rate (1 - keep probability)

  • lr – learning rate

class bigdl.chronos.autots.deprecated.config.recipe.RandomRecipe[source]

Bases:

Pure random sample Recipe. Often used as baseline.

Constructor.

Parameters

num_rand_samples – number of hyper-param configurations sampled randomly

:param look_back:the length to look back, either a tuple with 2 int values,

which is in format is (min len, max len), or a single int, which is a fixed length to look back.

Parameters
  • reward_metric – the rewarding metric value, when reached, stop trial

  • training_iteration – no. of iterations for training (n epochs) in trials

  • epochs – no. of epochs to train in each iteration

class bigdl.chronos.autots.deprecated.config.recipe.BayesRecipe[source]

Bases:

A Bayes search Recipe. (Experimental)

Constructor.

Parameters
  • num_samples – number of hyper-param configurations sampled

  • look_back – the length to look back, either a tuple with 2 int values, which is in format is (min len, max len), or a single int, which is a fixed length to look back.

  • reward_metric – the rewarding metric value, when reached, stop trial

  • training_iteration – no. of iterations for training (n epochs) in trials

  • epochs – no. of epochs to train in each iteration

class bigdl.chronos.autots.deprecated.config.recipe.XgbRegressorGridRandomRecipe(num_rand_samples=1, n_estimators=[8, 15], max_depth=[10, 15], n_jobs=- 1, tree_method='hist', random_state=2, seed=0, lr=(0.0001, 0.1), subsample=0.8, colsample_bytree=0.8, min_child_weight=[1, 2, 3], gamma=0, reg_alpha=0, reg_lambda=1)[source]

Bases: bigdl.chronos.autots.deprecated.config.base.Recipe

Grid + Random Recipe for XGBoost Regressor.

Constructor. For XGBoost hyper parameters, refer to https://xgboost.readthedocs.io/en/latest/python/python_api.html for details.

Parameters
  • num_rand_samples – number of hyper-param configurations sampled randomly

  • n_estimators – number of gradient boosted trees.

  • max_depth – max tree depth

  • n_jobs – number of parallel threads used to run xgboost.

  • tree_method – specify which tree method to use.

  • random_state – random number seed.

  • seed – seed used to generate the folds

  • lr – learning rate

  • subsample – subsample ratio of the training instance

  • colsample_bytree – subsample ratio of columns when constructing each tree.

  • min_child_weight – minimum sum of instance weight(hessian) needed in a child.

  • gamma – minimum loss reduction required to make a further partition on a leaf node of the tree.

  • reg_alpha – L1 regularization term on weights (xgb’s alpha).

  • reg_lambda – L2 regularization term on weights (xgb’s lambda).

class bigdl.chronos.autots.deprecated.config.recipe.XgbRegressorSkOptRecipe(num_rand_samples=10, n_estimators_range=(50, 1000), max_depth_range=(2, 15), lr=(0.0001, 0.1), min_child_weight=[1, 2, 3])[source]

Bases: bigdl.chronos.autots.deprecated.config.base.Recipe

A recipe using SkOpt search algorithm for XGBoost Regressor.

Constructor.

Parameters
  • num_rand_samples – number of hyper-param configurations sampled randomly

  • n_estimators_range – range of number of gradient boosted trees.

  • max_depth_range – range of max tree depth

  • lr – learning rate

  • min_child_weight – minimum sum of instance weight(hessian) needed in a child.