zoo.automl.model package¶
Subpackages¶
Submodules¶
zoo.automl.model.MTNet_keras module¶
zoo.automl.model.Seq2Seq module¶
zoo.automl.model.Seq2Seq_pytorch module¶
-
class
zoo.automl.model.Seq2Seq_pytorch.Decoder(output_dim, hidden_dim, layer_num, dropout)[source]¶ Bases:
torch.nn.modules.module.Module-
forward(decoder_input, hidden, cell)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
class
zoo.automl.model.Seq2Seq_pytorch.Encoder(input_dim, hidden_dim, layer_num, dropout)[source]¶ Bases:
torch.nn.modules.module.Module-
forward(input_seq)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
class
zoo.automl.model.Seq2Seq_pytorch.Seq2Seq(encoder, decoder, target_seq_len=1)[source]¶ Bases:
torch.nn.modules.module.Module-
forward(source, target=None)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
class
zoo.automl.model.Seq2Seq_pytorch.Seq2SeqPytorch(check_optional_config=True, future_seq_len=1)[source]¶ Bases:
zoo.automl.model.abstract.BaseModel-
evaluate(x, y, metric=['mse'])[source]¶ Evaluate on x, y :param x: input :param y: target :param metric: a list of metrics in string format :return: a list of metric evaluation results
-
fit_eval(x, y, validation_data=None, mc=False, verbose=0, **config)[source]¶ optimize and evaluate for one iteration for tuning :param config: tunable parameters for optimization :return:
-
zoo.automl.model.VanillaLSTM module¶
zoo.automl.model.VanillaLSTM_pytorch module¶
-
class
zoo.automl.model.VanillaLSTM_pytorch.LSTMModel(input_dim, hidden_dim, layer_num, dropout, output_dim)[source]¶ Bases:
torch.nn.modules.module.Module-
forward(input_seq)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
class
zoo.automl.model.VanillaLSTM_pytorch.VanillaLSTMPytorch(check_optional_config=True, future_seq_len=1)[source]¶ Bases:
zoo.automl.model.abstract.BaseModel-
evaluate(x, y, metric=['mse'])[source]¶ Evaluate on x, y :param x: input :param y: target :param metric: a list of metrics in string format :return: a list of metric evaluation results
-
fit_eval(x, y, validation_data, mc=False, verbose=0, **config)[source]¶ optimize and evaluate for one iteration for tuning :param config: tunable parameters for optimization :return:
-
zoo.automl.model.XGBoostRegressor module¶
zoo.automl.model.abstract module¶
-
class
zoo.automl.model.abstract.BaseModel[source]¶ Bases:
abc.ABCbase model for automl tuning
-
check_optional_config= False¶
-
evaluate(x, y, metric=None)[source]¶ Evaluate the model :param x: input :param y: target :param metric: :return: a list of metric evaluation results
-
fit_eval(x, y, validation_data=None, mc=False, verbose=0, **config)[source]¶ optimize and evaluate for one iteration for tuning :param config: tunable parameters for optimization :return:
-
future_seq_len= None¶
-
zoo.automl.model.tcmf_model module¶
-
class
zoo.automl.model.tcmf_model.TCMF[source]¶ Bases:
zoo.automl.model.abstract.BaseModelMF regularized TCN + TCN. This version is not for automated searching yet.
-
evaluate(x=None, y=None, metrics=None, num_workers=None)[source]¶ Evaluate on the prediction results and y. We predict horizon time-points ahead the input x in fit_eval before evaluation, where the horizon length equals the second dimension size of y. :param x: We don’t support input x currently. :param y: target. We interpret the second dimension of y as the horizon length for
evaluation.
- Parameters
metrics – a list of metrics in string format
num_workers – the number of workers to use in evaluate. It defaults to 1.
- Returns
a list of metric evaluation results
-
fit_eval(x, y=None, verbose=0, num_workers=None, **config)[source]¶ Fit on the training data from scratch. Since the rolling process is very customized in this model, we enclose the rolling process inside this method.
- Parameters
x – training data, an array in shape (nd, Td), nd is the number of series, Td is the time dimension
y – None. target is extracted from x directly
verbose –
num_workers – number of workers to use.
- Returns
the evaluation metric value
-
fit_incremental(x)[source]¶ Incremental fitting given a pre-trained model. :param x: incremental data :param config: fitting parameters :return:
-
predict(x=None, horizon=24, mc=False, num_workers=None)[source]¶ Predict horizon time-points ahead the input x in fit_eval :param x: We don’t support input x currently. :param horizon: horizon length to predict :param mc: :param num_workers: the number of workers to use. Note that there has to be an activate
RayContext if num_workers > 1.
- Returns
-
restore(model_file)[source]¶ restore model from model file and config. :param model_path: the model file :param config: the config :return: the restored model
-
-
class
zoo.automl.model.tcmf_model.TCMFDistributedModelWrapper(config)[source]¶ Bases:
zoo.automl.model.tcmf_model.ModelWrapper-
evaluate(x, y, metric=None, num_workers=None)[source]¶ Evaluate the model :param x: input :param y: target :param metric: :param num_workers: :return: a list of metric evaluation results
-
load(model_path, minPartitions=None)[source]¶ restore model from model file and config. :param model_path: the model file :return: the restored model
-
-
class
zoo.automl.model.tcmf_model.TCMFLocalModelWrapper(config)[source]¶ Bases:
zoo.automl.model.tcmf_model.ModelWrapper-
evaluate(x, y, metric=None, num_workers=None)[source]¶ Evaluate the model :param x: input :param y: target :param metric: :param num_workers: :return: a list of metric evaluation results
-
load(model_path)[source]¶ restore model from model file and config. :param model_path: the model file :return: the restored model
-