pystruct.inference.inference_lp

pystruct.inference.inference_lp(unary_potentials, pairwise_potentials, edges, relaxed=False, return_energy=False)

Inference with build-in LP solver using GLPK backend.

Parameters :

unary_potentials : nd-array

Unary potentials of energy function.

pairwise_potentials : nd-array

Pairwise potentials of energy function.

edges : nd-array

Edges of energy function.

relaxed : bool (default=False)

Whether to return the relaxed solution (True) or round to the next integer solution (False).

return_energy : bool (default=False)

Additionally return the energy of the returned solution (according to the solver). If relaxed=False, this is the energy of the relaxed, not the rounded solution.

Returns :

labels : nd-array

Approximate (usually) MAP variable assignment. If relaxed=False, this is a tuple of unary and edge ‘marginals’.