callback module — DIRESA documentation

# callback module

DIRESA callback classes/functions

Author:

  Geert De Paepe

Email:

  geert.de.paepe@vub.be

License:

  MIT License

class callback.LossWeightAnnealing(*args: Any, **kwargs: Any)

  https://keras.io/guides/writing_your_own_callbacks/ https://medium.com/dive-into-ml-ai/adaptive-weighing-of-loss-functions-for-multiple-output-keras-models-71a1b0aca66e

  __init__(weight, loss_name, target_loss=3e-06, anneal_step=0.1, start_epoch=5)
    Parameters:

      - weight – keras.backend.variable with initial loss weight

      - loss_name – name of the loss function to apply the annealing

      - target_loss – target loss, weight is increased until loss < target

      - anneal_step – annealing step size for increasing weight

      - start_epoch – epoch from which annealing starts

  on_epoch_end(epoch, logs=None)

    Executed during training on each epoch end Increases weight with anneal_step as from start_epoch until unweighted loss is smaller than target Prints loss weight, reconstruction loss and unweighted loss :param epoch: number of epoch :param logs: dict containing the loss values

  on_epoch_begin(epoch, logs=None)