candle.uq_keras_utils.Contamination_Callback

candle.uq_keras_utils.Contamination_Callback#

class candle.uq_keras_utils.Contamination_Callback(x, y, a_max=0.99)#

This callback is used to update the parameters of the contamination model.

This functionality follows the EM algorithm: in the E-step latent variables are updated and in the M-step global variables are updated. The global variables correspond to ‘a’ (probability of membership to normal class), ‘sigmaSQ’ (variance of normal class) and ‘gammaSQ’ (scale of Cauchy class, modeling outliers). The latent variables correspond to ‘T_k’ (the first column corresponds to the probability of membership to the normal distribution, while the second column corresponds to the probability of membership to the Cauchy distribution i.e. outlier).

__init__(x, y, a_max=0.99)#

Initializer of the Contamination_Callback.

Parameters:
  • x (ndarray) – Array of samples (= input features) in training set.

  • y (ndarray) – Array of sample outputs in training set.

  • a_max (flaot) – Maximum value of a variable to allow

Methods

__init__(x, y[, a_max])

Initializer of the Contamination_Callback.

on_batch_begin(batch[, logs])

A backwards compatibility alias for on_train_batch_begin.

on_batch_end(batch[, logs])

A backwards compatibility alias for on_train_batch_end.

on_epoch_begin(epoch[, logs])

Called at the start of an epoch.

on_epoch_end(epoch[, logs])

Updates the parameters of the distributions in the contamination model on epoch end.

on_predict_batch_begin(batch[, logs])

Called at the beginning of a batch in predict methods.

on_predict_batch_end(batch[, logs])

Called at the end of a batch in predict methods.

on_predict_begin([logs])

Called at the beginning of prediction.

on_predict_end([logs])

Called at the end of prediction.

on_test_batch_begin(batch[, logs])

Called at the beginning of a batch in evaluate methods.

on_test_batch_end(batch[, logs])

Called at the end of a batch in evaluate methods.

on_test_begin([logs])

Called at the beginning of evaluation or validation.

on_test_end([logs])

Called at the end of evaluation or validation.

on_train_batch_begin(batch[, logs])

Called at the beginning of a training batch in fit methods.

on_train_batch_end(batch[, logs])

Called at the end of a training batch in fit methods.

on_train_begin([logs])

Called at the beginning of training.

on_train_end([logs])

Called at the end of training.

set_model(model)

set_params(params)