pytabkit.models.training package

Submodules

pytabkit.models.training.auc_mu module

Computation of the measure ‘AUC Mu’. This measure requires installation of the numpy and sklearn libraries.

This code corresponds to the paper: Kleiman, R., Page, D. AUC Mu: A Performance Metric for Multi-Class Machine Learning Models, Proceedings of the 2019 International Conference on Machine Learning (ICML).

pytabkit.models.training.auc_mu.auc_mu_impl(y_true, y_score, A=None, W=None)

Compute the multi-class measure AUC Mu from prediction scores and labels.

Parameters

y_truearray, shape = [n_samples]

The true class labels in the range [0, n_samples-1]

y_scorearray, shape = [n_samples, n_classes]

Target scores, where each row is a categorical distribution over the n_classes.

Aarray, shape = [n_classes, n_classes], optional

The partition (or misclassification cost) matrix. If None A is the argmax partition matrix. Entry A_{i,j} is the cost of classifying an instance as class i when the true class is j. It is expected that diagonal entries in A are zero and off-diagonal entries are positive.

Warray, shape = [n_classes, n_classes], optional

The weight matrix for incorporating class skew into AUC Mu. If None, the standard AUC Mu is calculated. If W is specified, it is expected to be a lower triangular matrix where entrix W_{i,j} is a positive float from 0 to 1 for the partial score between classes i and j. Entries not in the lower triangular portion of W must be 0 and the sum of all entries in W must be 1.

Returns

auc_mu : float

References

pytabkit.models.training.coord module

class pytabkit.models.training.coord.HyperparamManager

Bases: object

class HyperGetter

Bases: object

__init__(tc, hyper_name, base_value_pattern, sched_pattern)
Parameters:
  • tc (HyperparamManager)

  • hyper_name (str)

  • base_value_pattern (str)

  • sched_pattern (str)

__init__(**config)
add_reg_term(loss)
get_hyper_sched_values()
get_more_info_dict()
Return type:

Dict

register_hyper(name, scope, default=None, default_sched=<function HyperparamManager.<lambda>>)
Parameters:

name (str)

update_hyper_sched_values()
update_hypers(learner)

pytabkit.models.training.lightning_callbacks module

class pytabkit.models.training.lightning_callbacks.HyperparamCallback

Bases: Callback

__init__(hp_manager)
on_before_backward(trainer, pl_module, loss)

Called before loss.backward().

Parameters:
  • trainer (Trainer)

  • pl_module (LightningModule)

  • loss (Tensor)

Return type:

None

on_fit_end(trainer, pl_module)

Called when fit ends.

Parameters:
  • trainer (Trainer)

  • pl_module (LightningModule)

Return type:

None

on_train_batch_start(trainer, pl_module, batch, batch_idx)

Called when the train batch begins.

Parameters:
  • trainer (Trainer)

  • pl_module (LightningModule)

  • batch (Any)

  • batch_idx (int)

Return type:

None

class pytabkit.models.training.lightning_callbacks.L1L2RegCallback

Bases: Callback

__init__(hp_manager, model)
Parameters:
on_after_backward(trainer, pl_module)

Called after loss.backward() and before optimizers are stepped.

Parameters:
  • trainer (Trainer)

  • pl_module (LightningModule)

Return type:

None

class pytabkit.models.training.lightning_callbacks.ModelCheckpointCallback

Bases: Callback

__init__(n_tt_splits, n_tv_splits, n_ens, use_best_mean_epoch, val_metric_name, restore_best=False)
Parameters:
  • n_tt_splits (int)

  • n_tv_splits (int)

  • n_ens (int)

  • use_best_mean_epoch (bool)

  • val_metric_name (str)

  • restore_best (bool)

on_fit_end(trainer, pl_module)

Called when fit ends.

Parameters:
  • trainer (Trainer)

  • pl_module (LightningModule)

Return type:

None

on_fit_start(trainer, pl_module)

Called when fit begins.

Parameters:
  • trainer (Trainer)

  • pl_module (LightningModule)

Return type:

None

on_validation_end(trainer, pl_module)

Called when the validation loop ends.

Parameters:
  • trainer (Trainer)

  • pl_module (LightningModule)

Return type:

None

restore(pl_module)
Parameters:

pl_module (LightningModule)

Return type:

None

class pytabkit.models.training.lightning_callbacks.ParamCheckpointer

Bases: object

__init__(n_tv_splits, n_tt_splits, n_ens)
Parameters:
  • n_tv_splits (int)

  • n_tt_splits (int)

  • n_ens (int)

restore(parallel_idx, model_idx, model)
Parameters:
  • parallel_idx (int)

  • model_idx (int)

  • model (Layer)

restore_all(model)
Parameters:

model (Layer)

save(parallel_idx, model_idx, model)
Parameters:
  • parallel_idx (int)

  • model_idx (int)

  • model (Layer)

save_all(model)
Parameters:

model (Layer)

class pytabkit.models.training.lightning_callbacks.StopAtEpochsCallback

Bases: Callback

__init__(stop_epochs, n_models, n_ens, model, logger=None)
Parameters:
  • stop_epochs (List[List[Dict[str, int] | int]])

  • n_models (int)

  • n_ens (int)

  • model (Layer)

  • logger (Logger | None)

on_fit_start(trainer, pl_module)

Called when fit begins.

Parameters:
  • trainer (Trainer)

  • pl_module (LightningModule)

Return type:

None

on_train_epoch_end(trainer, pl_module)

Called when the train epoch ends.

To access all batch outputs at the end of the epoch, you can cache step outputs as an attribute of the pytorch_lightning.core.LightningModule and access them in this hook:

class MyLightningModule(L.LightningModule):
    def __init__(self):
        super().__init__()
        self.training_step_outputs = []

    def training_step(self):
        loss = ...
        self.training_step_outputs.append(loss)
        return loss


class MyCallback(L.Callback):
    def on_train_epoch_end(self, trainer, pl_module):
        # do something with all training_step outputs, for example:
        epoch_mean = torch.stack(pl_module.training_step_outputs).mean()
        pl_module.log("training_epoch_mean", epoch_mean)
        # free up the memory
        pl_module.training_step_outputs.clear()
Parameters:
  • trainer (Trainer)

  • pl_module (LightningModule)

Return type:

None

pytabkit.models.training.lightning_modules module

class pytabkit.models.training.lightning_modules.TabNNModule

Bases: LightningModule

__init__(n_epochs=256, logger=None, fit_params=None, **config)

Pytorch Lightning Module for building and training a pytorch NN for tabular data. The core of the module is the NNCreatorInterface, which is used to create the model, the callbacks, the hyperparameter manager and the dataloaders. The TabNNModule is responsible for the training loop, (optional) validation and inference.

Parameters:
  • n_epochs (int)

  • logger (Logger | None)

  • fit_params (List[Dict[str, Any]] | None)

compile_model(ds, idxs_list, interface_resources)

Method to create the model and all other training dependencies given the dataset and the assigned resources. Once this is called, the module is ready for training.

Parameters:
configure_optimizers()

Choose what optimizers and learning-rate schedulers to use in your optimization. Normally you’d need one. But in the case of GANs or similar you might have multiple. Optimization with multiple optimizers only works in the manual optimization mode.

Return:

Any of these 6 options.

  • Single optimizer.

  • List or Tuple of optimizers.

  • Two lists - The first list has multiple optimizers, and the second has multiple LR schedulers (or multiple lr_scheduler_config).

  • Dictionary, with an "optimizer" key, and (optionally) a "lr_scheduler" key whose value is a single LR scheduler or lr_scheduler_config.

  • None - Fit will run without any optimizer.

The lr_scheduler_config is a dictionary which contains the scheduler and its associated configuration. The default configuration is shown below.

lr_scheduler_config = {
    # REQUIRED: The scheduler instance
    "scheduler": lr_scheduler,
    # The unit of the scheduler's step size, could also be 'step'.
    # 'epoch' updates the scheduler on epoch end whereas 'step'
    # updates it after a optimizer update.
    "interval": "epoch",
    # How many epochs/steps should pass between calls to
    # `scheduler.step()`. 1 corresponds to updating the learning
    # rate after every epoch/step.
    "frequency": 1,
    # Metric to monitor for schedulers like `ReduceLROnPlateau`
    "monitor": "val_loss",
    # If set to `True`, will enforce that the value specified 'monitor'
    # is available when the scheduler is updated, thus stopping
    # training if not found. If set to `False`, it will only produce a warning
    "strict": True,
    # If using the `LearningRateMonitor` callback to monitor the
    # learning rate progress, this keyword can be used to specify
    # a custom logged name
    "name": None,
}

When there are schedulers in which the .step() method is conditioned on a value, such as the torch.optim.lr_scheduler.ReduceLROnPlateau scheduler, Lightning requires that the lr_scheduler_config contains the keyword "monitor" set to the metric name that the scheduler should be conditioned on.

Metrics can be made available to monitor by simply logging it using self.log('metric_to_track', metric_val) in your LightningModule.

Note:

Some things to know:

  • Lightning calls .backward() and .step() automatically in case of automatic optimization.

  • If a learning rate scheduler is specified in configure_optimizers() with key "interval" (default “epoch”) in the scheduler configuration, Lightning will call the scheduler’s .step() method automatically in case of automatic optimization.

  • If you use 16-bit precision (precision=16), Lightning will automatically handle the optimizer.

  • If you use torch.optim.LBFGS, Lightning handles the closure function automatically for you.

  • If you use multiple optimizers, you will have to switch to ‘manual optimization’ mode and step them yourself.

  • If you need to control how often the optimizer steps, override the optimizer_step() hook.

create_callbacks()

Helper method to return callbacks for the trainer.fit callback argument.

get_predict_dataloader(ds)

Helper method to create a dataloader for inference.

Parameters:

ds (DictDataset)

on_fit_end()

Called at the very end of fit.

If on DDP it is called on every process

on_fit_start()

Called at the very beginning of fit.

If on DDP it is called on every process

on_predict_model_eval()

Called when the predict loop starts.

The predict loop by default calls .eval() on the LightningModule before it starts. Override this hook to change the behavior.

Return type:

None

on_test_model_eval()

Called when the test loop starts.

The test loop by default calls .eval() on the LightningModule before it starts. Override this hook to change the behavior. See also on_test_model_train().

Return type:

None

on_test_model_train()

Called when the test loop ends.

The test loop by default restores the training mode of the LightningModule to what it was before starting testing. Override this hook to change the behavior. See also on_test_model_eval().

Return type:

None

on_validation_epoch_end()

Called in the validation loop at the very end of the epoch.

on_validation_model_eval()

Called when the validation loop starts.

The validation loop by default calls .eval() on the LightningModule before it starts. Override this hook to change the behavior. See also on_validation_model_train().

Return type:

None

on_validation_model_train()

Called when the validation loop ends.

The validation loop by default restores the training mode of the LightningModule to what it was before starting validation. Override this hook to change the behavior. See also on_validation_model_eval().

Return type:

None

on_validation_start()

Called at the beginning of validation.

predict_step(batch, batch_idx, dataloader_idx=0)

Step function called during predict(). By default, it calls forward(). Override to add any processing logic.

The predict_step() is used to scale inference on multi-devices.

To prevent an OOM error, it is possible to use BasePredictionWriter callback to write the predictions to disk or database after each batch or on epoch end.

The BasePredictionWriter should be used while using a spawn based accelerator. This happens for Trainer(strategy="ddp_spawn") or training on 8 TPU cores with Trainer(accelerator="tpu", devices=8) as predictions won’t be returned.

Args:

batch: The output of your data iterable, normally a DataLoader. batch_idx: The index of this batch. dataloader_idx: The index of the dataloader that produced this batch.

(only if multiple dataloaders used)

Return:

Predicted output (optional).

Example

class MyModel(LightningModule):

    def predict_step(self, batch, batch_idx, dataloader_idx=0):
        return self(batch)

dm = ...
model = MyModel()
trainer = Trainer(accelerator="gpu", devices=2)
predictions = trainer.predict(model, dm)
Parameters:
  • batch (Any)

  • batch_idx (int)

  • dataloader_idx (int)

Return type:

Any

restore_ckpt_for_val_metric_name(val_metric_name)
Parameters:

val_metric_name (str)

to(*args, **kwargs)

See torch.nn.Module.to().

Parameters:
  • args (Any)

  • kwargs (Any)

Return type:

TabNNModule

training_step(batch, batch_idx)

Here you compute and return the training loss and some additional metrics for e.g. the progress bar or logger.

Args:

batch: The output of your data iterable, normally a DataLoader. batch_idx: The index of this batch. dataloader_idx: The index of the dataloader that produced this batch.

(only if multiple dataloaders used)

Return:
  • Tensor - The loss tensor

  • dict - A dictionary which can include any keys, but must include the key 'loss' in the case of automatic optimization.

  • None - In automatic optimization, this will skip to the next batch (but is not supported for multi-GPU, TPU, or DeepSpeed). For manual optimization, this has no special meaning, as returning the loss is not required.

In this step you’d normally do the forward pass and calculate the loss for a batch. You can also do fancier things like multiple forward passes or something model specific.

Example:

def training_step(self, batch, batch_idx):
    x, y, z = batch
    out = self.encoder(x)
    loss = self.loss(out, x)
    return loss

To use multiple optimizers, you can switch to ‘manual optimization’ and control their stepping:

def __init__(self):
    super().__init__()
    self.automatic_optimization = False


# Multiple optimizers (e.g.: GANs)
def training_step(self, batch, batch_idx):
    opt1, opt2 = self.optimizers()

    # do training_step with encoder
    ...
    opt1.step()
    # do training_step with decoder
    ...
    opt2.step()
Note:

When accumulate_grad_batches > 1, the loss returned here will be automatically normalized by accumulate_grad_batches internally.

validation_step(batch, batch_idx)

Operates on a single batch of data from the validation set. In this step you’d might generate examples or calculate anything of interest like accuracy.

Args:

batch: The output of your data iterable, normally a DataLoader. batch_idx: The index of this batch. dataloader_idx: The index of the dataloader that produced this batch.

(only if multiple dataloaders used)

Return:
  • Tensor - The loss tensor

  • dict - A dictionary. Can include any keys, but must include the key 'loss'.

  • None - Skip to the next batch.

# if you have one val dataloader:
def validation_step(self, batch, batch_idx): ...


# if you have multiple val dataloaders:
def validation_step(self, batch, batch_idx, dataloader_idx=0): ...

Examples:

# CASE 1: A single validation dataset
def validation_step(self, batch, batch_idx):
    x, y = batch

    # implement your own
    out = self(x)
    loss = self.loss(out, y)

    # log 6 example images
    # or generated text... or whatever
    sample_imgs = x[:6]
    grid = torchvision.utils.make_grid(sample_imgs)
    self.logger.experiment.add_image('example_images', grid, 0)

    # calculate acc
    labels_hat = torch.argmax(out, dim=1)
    val_acc = torch.sum(y == labels_hat).item() / (len(y) * 1.0)

    # log the outputs!
    self.log_dict({'val_loss': loss, 'val_acc': val_acc})

If you pass in multiple val dataloaders, validation_step() will have an additional argument. We recommend setting the default value of 0 so that you can quickly switch between single and multiple dataloaders.

# CASE 2: multiple validation dataloaders
def validation_step(self, batch, batch_idx, dataloader_idx=0):
    # dataloader_idx tells you which dataset this is.
    x, y = batch

    # implement your own
    out = self(x)

    if dataloader_idx == 0:
        loss = self.loss0(out, y)
    else:
        loss = self.loss1(out, y)

    # calculate acc
    labels_hat = torch.argmax(out, dim=1)
    acc = torch.sum(y == labels_hat).item() / (len(y) * 1.0)

    # log the outputs separately for each dataloader
    self.log_dict({f"val_loss_{dataloader_idx}": loss, f"val_acc_{dataloader_idx}": acc})
Note:

If you don’t need to validate you don’t need to implement this method.

Note:

When the validation_step() is called, the model has been put in eval mode and PyTorch gradients have been disabled. At the end of validation, the model goes back to training mode and gradients are enabled.

pytabkit.models.training.lightning_modules.postprocess_multiquantile(y_pred, val_metric_name=None, sort_quantile_predictions=True, **config)
Parameters:
  • y_pred (Tensor)

  • val_metric_name (str | None)

  • sort_quantile_predictions (bool)

pytabkit.models.training.logging module

class pytabkit.models.training.logging.Logger

Bases: object

__init__(verbosity_level)
force_log(content)
Parameters:

content (str)

get_verbosity_level()
log(verbosity, content)
Parameters:
  • verbosity (int)

  • content (str)

class pytabkit.models.training.logging.StdoutLogger

Bases: Logger

__init__(verbosity_level=0)
force_log(content)
Parameters:

content (str)

pytabkit.models.training.metrics module

class pytabkit.models.training.metrics.Metrics

Bases: object

__init__(metric_names, val_metric_name, task_type)
static apply(y_pred, y, metric_name)
Parameters:
  • y_pred (Tensor)

  • y (Tensor)

  • metric_name (str)

Return type:

Tensor

static apply_sklearn_classification_metric(y_pred, y, metric_function, needs_pred_probs, two_class_single_column=True)
Parameters:
  • y_pred (Tensor)

  • y (Tensor)

  • metric_function (Callable)

  • needs_pred_probs (bool)

  • two_class_single_column (bool)

static avg_preds(y_preds, task_type)
Parameters:

y_preds (List[Tensor])

compute_metrics_dict(y_preds, y, use_ens)
Parameters:
  • y_preds (List[Tensor]) – y predictions by (possibly multiple) ensemble members

  • y (Tensor) – actual labels (one-hot encoded in case of classification)

  • use_ens (bool) – Whether to also compute metrics for ensembled predictions

Returns:

Returns a NestedDict indexed by [str(n_models), str(start_idx), metric_name]

Return type:

NestedDict

containing the respective metric values (float) for an ensemble using y_preds[start_idx:start_idx+n_models] In the ensembling case, n_models > 1 is also used, but only with start_idx = 0

compute_val_score(val_metrics_dict)
Parameters:

val_metrics_dict (NestedDict)

Return type:

float

static default_eval_metric_name(task_type)
static default_val_metric_name(task_type)
static defaults(y_cat_sizes, val_metric_name=None)
Parameters:

val_metric_name (str | None)

Return type:

Metrics

pytabkit.models.training.metrics.apply_reduction(res, reduction)
pytabkit.models.training.metrics.auc_ovr_torchmetrics(y_pred, y)
Parameters:
  • y_pred (Tensor)

  • y (Tensor)

pytabkit.models.training.metrics.brier_loss(y_pred, y, reduction='mean')
Parameters:
  • y_pred (Tensor)

  • y (Tensor)

pytabkit.models.training.metrics.cos_loss(y_pred, y, reduction='mean')
pytabkit.models.training.metrics.cross_entropy(y_pred, y, reduction='mean')
Parameters:
  • y_pred (Tensor)

  • y (Tensor)

pytabkit.models.training.metrics.expected_calibration_error(y_pred, y)
Parameters:
  • y_pred (Tensor)

  • y (Tensor)

pytabkit.models.training.metrics.get_y_probs(y, n_classes)

Returns the empirical probabilities of all classes in y. :param y: Tensor of shape […, n_batch, 1] and dtype torch.long or another integer dtype, containing class labels in {0, 1, …, n_classes-1} :param n_classes: Total number of classes :return: returns a tensor of shape […, n_classes]

Parameters:
  • y (Tensor)

  • n_classes (int)

Return type:

Tensor

pytabkit.models.training.metrics.insert_missing_class_columns(y_pred, train_ds)

If train_ds.tensors[‘y’] does not contain some of the classes specified in train_ds.tensor_infos[‘y’] and if y_pred does not contain columns for these missing classes, add columns for the missing classes to y_pred, with small probabilities. :param y_pred: Tensor of logits, shape [n_batch, n_classes] :param train_ds: Dataset used for training the model that produced y_pred. :return: Returns y_pred with possibly some columns inserted.

Parameters:
Return type:

Tensor

pytabkit.models.training.metrics.mean_interleave(input, repeats, dim)
pytabkit.models.training.metrics.mse(y_pred, y, reduction='mean')
pytabkit.models.training.metrics.multi_pinball_loss(y_pred, y, quantiles, reduction='mean')
Parameters:
  • y_pred (Tensor)

  • y (Tensor)

  • quantiles (List[float])

pytabkit.models.training.metrics.pinball_loss(y_pred, y, quantile, reduction='mean')
Parameters:
  • y_pred (Tensor)

  • y (Tensor)

  • quantile (float)

pytabkit.models.training.metrics.remove_missing_classes(y_pred, y)

Removes missing classes from y_pred and y. For example, if y_pred.shape[-1] == 4 but y only contains the values 0 and 2, the columns y_pred[…, 1] and y_pred[…, 3] will be removed and the values (0, 2) will be mapped to (0, 1). :param y_pred: Predictions of shape (n_samples, n_classes) (should be logits because probabilities will not be normalized anymore after removing columns). :param y: classes of shape (n_samples,) :return: y_pred and y with missing classes removed

Parameters:
  • y_pred (Tensor)

  • y (Tensor)

Return type:

Tuple[Tensor, Tensor]

pytabkit.models.training.metrics.softmax_kldiv(y_pred, y, reduction='mean')
Parameters:
  • y_pred (Tensor)

  • y (Tensor)

pytabkit.models.training.metrics.to_one_hot(y, num_classes, label_smoothing_eps=0.0)

pytabkit.models.training.nn_creator module

class pytabkit.models.training.nn_creator.NNCreator

Bases: object

__init__(fit_params=None, **config)
Parameters:

fit_params (List[Dict[str, Any]] | None)

create_callbacks(model, logger, val_metric_names)
Parameters:
  • model (Layer)

  • logger (Logger)

  • val_metric_names (List[str])

create_dataloaders(ds)
Parameters:

ds (DictDataset)

create_model(ds, idxs_list)
Parameters:
get_criterions()
Return type:

Tuple[Callable, List[str]]

setup_from_dataset(ds, idxs_list, interface_resources)
Parameters:
pytabkit.models.training.nn_creator.get_realmlp_auto_batch_size(n_train)
Parameters:

n_train (int)

pytabkit.models.training.scheduling module

class pytabkit.models.training.scheduling.AltCoslogFunc

Bases: object

__init__(n_cycles)
Parameters:

n_cycles (int)

class pytabkit.models.training.scheduling.ConstantSchedule

Bases: TimeSchedule

__init__(val)
call_time_(t)
Parameters:

t (float)

class pytabkit.models.training.scheduling.CoslogFunc

Bases: object

__init__(n_cycles)
Parameters:

n_cycles (int)

class pytabkit.models.training.scheduling.EpochLengthSqMomSchedule

Bases: Schedule

__init__(min_value=0.95, base_value=0.5)
Parameters:
  • min_value (float)

  • base_value (float)

get_value()
update(learner)
class pytabkit.models.training.scheduling.ExponentialSchedule

Bases: TimeSchedule

__init__(start, end)
call_time_(t)
Parameters:

t (float)

class pytabkit.models.training.scheduling.FirstToLastSchedule

Bases: TimeSchedule

__init__(n_params)
call_time_(t)
Parameters:

t (float)

class pytabkit.models.training.scheduling.FunctionSchedule

Bases: TimeSchedule

__init__(f)
call_time_(t)
Parameters:

t (float)

class pytabkit.models.training.scheduling.GenCoslogFunc

Bases: object

__init__(n_cycles, base)
Parameters:
  • n_cycles (int)

  • base (float)

class pytabkit.models.training.scheduling.LearnerProgress

Bases: object

__init__()
get_fit_progress()
class pytabkit.models.training.scheduling.ProductSchedule_

Bases: Schedule

__init__(first, second)
Parameters:
get_value()
update(learner)
class pytabkit.models.training.scheduling.ProductTimeSchedule_

Bases: TimeSchedule

__init__(first, second)
Parameters:
call_time_(t)
Parameters:

t (float)

class pytabkit.models.training.scheduling.ScaledSchedule

Bases: TimeSchedule

__init__(base_schedule, ymin=0.0, ymax=1.0, tmin=0.0, tmax=1.0)
Parameters:

base_schedule (TimeSchedule)

call_time_(t)
Parameters:

t (float)

class pytabkit.models.training.scheduling.Schedule

Bases: object

get_value()
update(learner)
class pytabkit.models.training.scheduling.ScheduleSequence

Bases: TimeSchedule

__init__(lengths, schedules)
call_time_(t)
Parameters:

t (float)

class pytabkit.models.training.scheduling.StepFunctionSchedule

Bases: Schedule

__init__(f)
get_value()
update(learner)
class pytabkit.models.training.scheduling.SumSchedule_

Bases: Schedule

__init__(first, second)
Parameters:
get_value()
update(learner)
class pytabkit.models.training.scheduling.SumTimeSchedule_

Bases: TimeSchedule

__init__(first, second)
Parameters:
call_time_(t)
Parameters:

t (float)

class pytabkit.models.training.scheduling.TimeSchedule

Bases: Schedule

__init__()
call_time_(t)
Parameters:

t (float)

get_value()
reversed()
scaled(ymin=0.0, ymax=1.0, tmin=0.0, tmax=1.0)
update(learner)
pytabkit.models.training.scheduling.combine_scheds(lengths, schedules)
pytabkit.models.training.scheduling.connect_cos_scheds(times, values)
pytabkit.models.training.scheduling.connect_lin_scheds(times, values)
pytabkit.models.training.scheduling.cos_func(x)
pytabkit.models.training.scheduling.cos_warm_func(x)
pytabkit.models.training.scheduling.get_cos_sched()
Return type:

FunctionSchedule

pytabkit.models.training.scheduling.get_cos_warm_sched()
Return type:

FunctionSchedule

pytabkit.models.training.scheduling.get_id_sched()
Return type:

FunctionSchedule

pytabkit.models.training.scheduling.get_lin_sched()
Return type:

FunctionSchedule

pytabkit.models.training.scheduling.get_schedule(sched_name)
Parameters:

sched_name (str)

Return type:

Schedule

pytabkit.models.training.scheduling.identity_func(x)
pytabkit.models.training.scheduling.lin_func(x)
pytabkit.models.training.scheduling.sched_prod(first, second)
pytabkit.models.training.scheduling.sched_sum(first, second)

Module contents