osl_dynamics.inference.schedules.kl_annealing_factor#
- osl_dynamics.inference.schedules.kl_annealing_factor(epoch, curve, sharpness, n_epochs)#
Factor the KL loss is multiplied by.
The factor increases from 0 to 1 over
n_epochsand is 1 after.- Parameters:
- epochint
Epoch.
- curvestr
'linear'forepoch / n_epochsor'tanh'for0.5 * tanh(sharpness * (epoch - 0.5 * n_epochs) / n_epochs) + 0.5.- sharpnessfloat
Sharpness of the
'tanh'curve.- n_epochsint
Number of annealing epochs.
- Returns:
- factorfloat