zoo.automl.model.tcmf package

Submodules

zoo.automl.model.tcmf.DeepGLO module

class zoo.automl.model.tcmf.DeepGLO.DeepGLO(vbsize=150, hbsize=256, num_channels_X=[32, 32, 32, 32, 1], num_channels_Y=[32, 32, 32, 32, 1], kernel_size=7, dropout=0.2, rank=64, kernel_size_Y=7, lr=0.0005, val_len=24, end_index=-24, normalize=False, start_date='2016-1-1', freq='H', covariates=None, use_time=True, dti=None, svd=False, period=None, forward_cov=False)[source]

Bases: object

calculate_newX_loss_vanilla(Xn, Fn, Yn, Xf, alpha)[source]
create_Ycov()[source]
get_prediction_time_covs(rg, horizon, last_step)[source]
get_time_covs(start_date, num_ts)[source]
predict(ind=None, last_step=100, future=10, normalize=False, bsize=90)[source]
predict_future(model, inp, future=10, bsize=90)[source]
predict_future_batch(model, inp, future=10)[source]
predict_global(ind, last_step=100, future=10, normalize=False, bsize=90)[source]
predict_horizon(ind=None, future=10, normalize=False, bsize=90, num_workers=1)[source]
recover_future_X(last_step, future, num_epochs=50, alpha=0.5, vanilla=True, tol=1e-07)[source]
rolling_validation(Ymat, tau=24, n=7, bsize=90, alpha=0.3)[source]
step_factF_loss(inp, out, last_vindex, last_hindex, reg=0.0)[source]
step_factX_loss(inp, out, last_vindex, last_hindex, reg=0.0)[source]
step_temporal_loss_X(inp, last_vindex, last_hindex)[source]
temporal_to_tensor2d(T)[source]
tensor2d_to_temporal(T)[source]
train_Xseq(Ymat, num_epochs=20, early_stop=False, tenacity=3)[source]
train_Yseq(num_epochs=20, num_workers=1)[source]
train_all_models(Ymat, init_epochs=100, alt_iters=10, y_iters=200, tenacity=7, mod=5, max_FX_epoch=300, max_TCN_epoch=300, num_workers=1)[source]
train_factors(reg_X=0.0, reg_F=0.0, mod=5, early_stop=False, tenacity=3, ind=None, seed=False)[source]
zoo.automl.model.tcmf.DeepGLO.get_model(A, y, lamb=0)[source]

Regularized least-squares

zoo.automl.model.tcmf.data_loader module

class zoo.automl.model.tcmf.data_loader.TCMFDataLoader(Ymat, covariates=None, Ycov=None, vbsize=200, hbsize=100, end_index=20000, val_len=30, shuffle=False)[source]

Bases: object

Data Loader Class for DeepGLO

next_batch()[source]

Returns: data is returned as pytorch tensor of shape nd*cd*td where nd is vbsize, hb is hsize and cd is the number os channels (depends on covariates) inp: input batch out: one shifted output batch vindex: strating vertical index of input batch hindex: starting horizontal index of input batch

supply_test()[source]

Supplies validation set in the same format as above

zoo.automl.model.tcmf.local_model module

class zoo.automl.model.tcmf.local_model.Chomp1d(chomp_size)[source]

Bases: torch.nn.modules.module.Module

forward(x)[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class zoo.automl.model.tcmf.local_model.LocalModel(Ymat, num_inputs=1, num_channels=[32, 32, 32, 32, 32, 1], kernel_size=7, dropout=0.2, vbsize=300, hbsize=128, lr=0.0005, val_len=10, test=True, end_index=120, normalize=False, start_date='2016-1-1', freq='H', covariates=None, use_time=False, dti=None, Ycov=None)[source]

Bases: object

static convert_covariates(data, covs)[source]
static convert_from_output(T)[source]
static convert_to_input(data)[source]
static convert_ycovs(data, ycovs)[source]
static loss(out, target)[source]
predict_future(data_in, covariates=None, ycovs=None, future=10, bsize=40, normalize=False, num_workers=1)[source]

data_in: input past data in same format of Ymat covariates: input past covariates ycovs: input past individual covariates future: number of time-points to predict bsize: batch size for processing (determine according to gopu memory limits) normalize: should be set according to the normalization used in the class initialization num_workers: number of workers to run prediction. if num_workers > 1, then prediction will run in distributed mode and there has to be an activate RayContext.

static predict_future_batch(data, covariates=None, ycovs=None, future=10, model=None)[source]
rolling_validation(Ymat, tau=24, n=7, bsize=90, alpha=0.3)[source]
train_model(num_epochs=300, num_workers=1, early_stop=False, tenacity=10)[source]
train_model_local(num_epochs=300, early_stop=False, tenacity=10)[source]

early_stop: set true for using early stop tenacity: patience for early_stop

class zoo.automl.model.tcmf.local_model.TemporalBlock(n_inputs, n_outputs, kernel_size, stride, dilation, padding, dropout=0.1, init=True)[source]

Bases: torch.nn.modules.module.Module

forward(x)[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

init_weights()[source]
class zoo.automl.model.tcmf.local_model.TemporalBlockLast(n_inputs, n_outputs, kernel_size, stride, dilation, padding, dropout=0.2, init=True)[source]

Bases: torch.nn.modules.module.Module

forward(x)[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

init_weights()[source]
class zoo.automl.model.tcmf.local_model.TemporalConvNet(num_inputs, num_channels, kernel_size=2, dropout=0.1, init=True)[source]

Bases: torch.nn.modules.module.Module

forward(x)[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

zoo.automl.model.tcmf.local_model_distributed_trainer module

zoo.automl.model.tcmf.time module

class zoo.automl.model.tcmf.time.TimeCovariates(start_date, num_ts=100, freq='H', normalized=True)[source]

Bases: object

get_covariates()[source]

Module contents