inferlo.pairwise.junction_tree.sample_junction_tree

inferlo.pairwise.junction_tree.sample_junction_tree(model, num_samples: int) ndarray[source]

IID sampling using Junction Tree decomposition.

Decomposes graph into junction tree, builds equivalent model on that tree, samples from that model and restores answer for the original model.

Parameters:
  • model – Model, for which to perform sampling.

  • num_samples – Number of samples.

Returns:

np.array of type np.int32 and shape (num_samples, gr_size). Every row is an independent sample.