Skip to contents

Prints a progress bar and the metrics for training and validation.

Resuming

This callback can be resumed without any problems.

Super class

CallbackSet -> CallbackSetProgress

Methods

Inherited methods


CallbackSetProgress$new()

Creates a new instance of this R6 class.

Usage

CallbackSetProgress$new(digits = 2)

Arguments

digits

integer(1)
The number of digits to print for the measures.


CallbackSetProgress$on_begin()

Starts this run's timer.

Usage

CallbackSetProgress$on_begin()


CallbackSetProgress$on_epoch_begin()

Initializes the progress bar for training.

Usage

CallbackSetProgress$on_epoch_begin()


CallbackSetProgress$on_batch_end()

Increments the training progress bar.

Usage

CallbackSetProgress$on_batch_end()


CallbackSetProgress$on_before_valid()

Creates the progress bar for validation.

Usage

CallbackSetProgress$on_before_valid()


CallbackSetProgress$on_batch_valid_end()

Increments the validation progress bar.

Usage

CallbackSetProgress$on_batch_valid_end()


CallbackSetProgress$on_epoch_end()

Prints a summary of the training and validation process.

Usage

CallbackSetProgress$on_epoch_end()


CallbackSetProgress$on_end()

Prints the time at the end of training, and how long training took in total. A resumed run also reports how much of that total it contributed itself.

Usage

CallbackSetProgress$on_end()


CallbackSetProgress$state_dict()

Returns the seconds trained so far, so that a resumed run reports the time of all runs together rather than only its own.

Usage

CallbackSetProgress$state_dict()


CallbackSetProgress$load_state_dict()

Loads the time that the previous runs took.

Usage

CallbackSetProgress$load_state_dict(state_dict)

Arguments

state_dict

(named list())
The state dict as retrieved via $state_dict().


CallbackSetProgress$clone()

The objects of this class are cloneable with this method.

Usage

CallbackSetProgress$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

task = tsk("iris")

learner = lrn("classif.mlp", epochs = 5, batch_size = 1,
  callbacks = t_clbk("progress"), validate = 0.3)
learner$param_set$set_values(
  measures_train = msrs(c("classif.acc", "classif.ce")),
  measures_valid = msr("classif.ce")
)

learner$train(task)
#> Epoch 1/5 started (2026-09-01 11:21:17)
#> Validation for epoch 1 started (2026-09-01 11:21:17)
#> 
#> [Summary epoch 1]
#> ------------------
#> Measures (Train):
#>  * classif.acc = 0.23
#>  * classif.ce = 0.77
#> Measures (Valid):
#>  * classif.ce = 0.78
#> 
#> Epoch 2/5 started (2026-09-01 11:21:17)
#> Validation for epoch 2 started (2026-09-01 11:21:18)
#> 
#> [Summary epoch 2]
#> ------------------
#> Measures (Train):
#>  * classif.acc = 0.62
#>  * classif.ce = 0.38
#> Measures (Valid):
#>  * classif.ce = 0.53
#> 
#> Epoch 3/5 started (2026-09-01 11:21:18)
#> Validation for epoch 3 started (2026-09-01 11:21:18)
#> 
#> [Summary epoch 3]
#> ------------------
#> Measures (Train):
#>  * classif.acc = 0.70
#>  * classif.ce = 0.30
#> Measures (Valid):
#>  * classif.ce = 0.60
#> 
#> Epoch 4/5 started (2026-09-01 11:21:18)
#> Validation for epoch 4 started (2026-09-01 11:21:19)
#> 
#> [Summary epoch 4]
#> ------------------
#> Measures (Train):
#>  * classif.acc = 0.60
#>  * classif.ce = 0.40
#> Measures (Valid):
#>  * classif.ce = 0.60
#> 
#> Epoch 5/5 started (2026-09-01 11:21:19)
#> Validation for epoch 5 started (2026-09-01 11:21:19)
#> 
#> [Summary epoch 5]
#> ------------------
#> Measures (Train):
#>  * classif.acc = 0.72
#>  * classif.ce = 0.28
#> Measures (Valid):
#>  * classif.ce = 0.60
#> 
#> Finished training for 5 epochs (2026-09-01 11:21:19, 2.2s total)