Evaluation

class gmmvi.experiments.evaluation.mmd.MMD(groundtruth, alpha)[source]

This class can be used for computing the Maximum Mean Discrepancy [GBR+12]. The MMD can be used to compute the discrepancy between a model sample and a groundtruth sample.

Note that instantiating this object can be quite slow, but computing the MMD using compute_MMD should be fast.

Parameters:
  • groundtruth – tf.Tensor The groundtruth sample of shape number_of_samples x dimension

  • alpha – tf.float32 A factor for scaling the diagonal bandwidth matrix (which is automatically chosen based on the groundtruth sample using the Median trick [GBR+12]).

compute_MMD(model_sample)[source]

Compute the MMD between the model_sample and the groundtruth data that was provided when instantiating this object.

Parameters:

model_sample – tf.Tensor The sample from the model of shape number_of_samples x dimension

Returns:

The MMD between model sample and groundtruth sample

Return type:

float