ncem.estimators.EstimatorNoGraph.train
- EstimatorNoGraph.train(epochs: int = 1000, epochs_warmup: int = 0, max_steps_per_epoch: Optional[int] = 20, batch_size: int = 16, validation_batch_size: int = 16, max_validation_steps: Optional[int] = 10, shuffle_buffer_size: Optional[int] = 10000, patience: int = 20, lr_schedule_min_lr: float = 1e-05, lr_schedule_factor: float = 0.2, lr_schedule_patience: int = 5, initial_epoch: int = 0, monitor_partition: str = 'val', monitor_metric: str = 'loss', log_dir: Optional[str] = None, callbacks: Optional[list] = None, early_stopping: bool = True, reduce_lr_plateau: bool = True, pretrain_decoder: bool = False, decoder_epochs: int = 1000, decoder_patience: int = 20, decoder_callbacks: Optional[list] = None, aggressive: bool = False, aggressive_enc_patience: int = 10, aggressive_epochs: int = 5, seed: int = 1234, **kwargs)
Train model.
Use validation loss and maximum number of epochs as termination criteria.
- Parameters
epochs (int) – Integer number of times to iterate over the training data arrays. If unspecified, it will default to 1000.
epochs_warmup (int) – Integer number of times to iterate over the training data arrays in warm up (without early stopping). If unspecified, it will default to 0.
max_steps_per_epoch (int, optional) – Maximal steps per epoch. If unspecified, it will default to 20.
batch_size (int) – Number of samples per gradient update. If unspecified, it will default to 16.
validation_batch_size (int) – Number of samples in validation. If unspecified, it will default to 16.
max_validation_steps (int) – Maximal steps per validation. If unspecified, it will default to 10.
shuffle_buffer_size (int, optional) – Shuffle buffer size. If unspecified, it will default to 1e4.
patience (int) – Number of epochs with no improvement. If unspecified, it will default to 20.
lr_schedule_min_lr (float) – Lower bound on the learning rate. If unspecified, it will default to 1e-5.
lr_schedule_factor (float) – Factor by which the learning rate will be reduced. new_lr = lr * factor. If unspecified, it will default to 0.2.
lr_schedule_patience (int) – Number of epochs with no improvement after which learning rate will be reduced. If unspecified, it will default to 5.
initial_epoch (int) – Epoch at which to start training (useful for resuming a previous training run). If unspecified, it will default to 0.
monitor_partition (str) – Monitor partition.
monitor_metric (str) – Monitor metric.
log_dir (str, optional) – Logging directory.
callbacks (list, optional) – List of callbacks to be called during training.
early_stopping (bool) – Whether to activate early stopping.
reduce_lr_plateau (bool) – Whether to reduce learning rate on plateau.
pretrain_decoder (bool) – Whether to pretrain the decoder model.
decoder_epochs (int) – Integer number of times to iterate over the training data arrays in decoder pretraining. If unspecified, it will default to 1000.
decoder_patience (int) – Number of epochs with no improvement in decoder pretraining. If unspecified, it will default to 20.
decoder_callbacks (list, optional) – List of callbacks to be called during decoder pretraining.
aggressive (bool) – Whether to train aggressive.
aggressive_enc_patience (int) – Number of epochs with no improvement in aggressive training. If unspecified, it will default to 10.
aggressive_epochs (int) – Integer number of times to iterate over the training data arrays in aggressive training. If unspecified, it will default to 5.
seed (int) – Random seed for reproduability.
kwargs – Arbitrary keyword arguments.