sbi.diagnostics.calc_misspecification_mmd

sbi.diagnostics.calc_misspecification_mmd#

calc_misspecification_mmd(x_obs, x, inference=None, mode='x_space', n_shuffle=1000, max_samples=1000, mmd_mode='biased')[source]#

Misspecification test based on MMD in data- or embedding space.

Parameters:
  • x_obs (Tensor) – observed data

  • x (Tensor) – synthetic data

  • inference (PosteriorEstimatorTrainer | None) – sbi inference object (only used if mode == “embedding”)

  • mode (str) – space of MMD calculation (“x_space” or “embedding”)

  • n_shuffle (int) – number of shuffles for computing mmds under H_0

  • max_samples (int) – maximum number of samples to use (when we have too many synthetic samples x)

  • mmd_mode (str) – approximation of MMD calculation (“biased” or “unbiased”)

Returns:

p-value of the misspecification test (MMDs under H_0, mmd)

Return type:

p_val, (mmd_baseline,mmd)