inferlo.GaussianModel

class inferlo.GaussianModel[source]

Gaussian graphical model

A Gaussian graphical model is defined by an undirected graph G = (V;E), where V is the set of nodes and E is the set of edges, and a collection of jointly Gaussian random variables x= (x_i; i in V). The probability density is given by p(x) ∝ exp{-1/2*x^T*J*x + h^T*x} where J is a symmetric, positive definite matrix, that is sparse so as to respect the graph G: if {i,j} not in E, then J_{i,j} = 0

For more information please refer to ‘Walk-SumsandBeliefPropagationinGaussianGraphicalModels’ by Dmitry M. Malioutov, Jason K. Johnson, Alan S. Willsky : http://ssg.mit.edu/group/willsky/publ_pdfs/185_pub_MLR.pdf

__init__(J: array, h: array, domain=None)[source]
Parameters:
  • num_variables – Number of variables in the model.

  • domain – Default domain of each variable.

Methods

__init__(J, h[, domain])

add_factor(factor)

Adds factor.

copy()

Makes a copy of itself.

draw_factor_graph(ax)

Draws the factor graph.

evaluate(x)

Returns value of non-normalized pdf in point.

from_model(model)

Creates copy of a given model.

get_factor_graph()

Builds factor graph for the model.

get_factors()

Returns all factors.

get_max_domain_size()

Returns the biggest domain size over all variables.

get_symbolic_variables()

Prepares variables for usage in expressions.

get_variable(idx)

Returns variable by its index.

get_variables()

Returns all variables.

infer(**kwargs)

Performs inference.

max_likelihood([algorithm])

Finds most probable state.

max_likelihood_bruteforce()

Evaluates most likely state in a very inefficient way.

part_func_bruteforce()

Evaluates partition function in very inefficient way.

sample(num_samples[, algorithm])

Generates samples.

Attributes

G

J

h

n

infer(**kwargs)[source]

Performs inference.