inferlo.pairwise.inference.mean_field.infer_mean_field

inferlo.pairwise.inference.mean_field.infer_mean_field(model: PairWiseFiniteModel, iters_wait=10, max_iter=100, num_attempts=1) InferenceResult[source]

Inference with Naive Mean Field.

Uses Naive Mean Field Algorithm. Time complexity is proportional to gr_size * num_iters, where gr_size is number of variables, num_iters is number of iterations.

Parameters:
  • model – Potts model for which to perform inference.

  • iters_wait – Algorithm stops if result doesn’t improve for that long.

  • max_iter – Maximal number of iterations.

  • num_attempts – How many times try optimization from new random point.

Returns:

InferenceResult object. log_pf is guaranteed to be lower bound for logarithm of the true partition function. marg_prob is approximation for marginal probabilities.