Models

class deepdiagnostics.models.model.Model(model_path)

Load a pre-trained model for analysis.

Parameters:

model_path (str) – relative path to a model.

class deepdiagnostics.models.SBIModel(model_path)

Load a trained model that was generated with Mackelab SBI [TCBD+20]. Read more about saving and loading requirements here.

Parameters:

model_path (str) – relative path to a model - must be a .pkl file.

predict_posterior(data, context_samples)

Sample the posterior and then

Parameters:
  • data (deepdiagnostics.data.Data) – Data module with the loaded simulation

  • context_samples (np.ndarray) – X values to test the posterior over.

Returns:

Simulator output

Return type:

np.ndarray

sample_posterior(n_samples, x_true)

Sample the posterior

Parameters:
  • n_samples (int) – Number of samples to draw

  • x_true (np.ndarray) – Context samples. (must be dims=(n_samples, M))

Returns:

Posterior samples

Return type:

np.ndarray