pyGM: Miscellaneous

pyGM.misc.boltzmann(theta_ij)[source]

Create a pairwise graphical model from a matrix of parameter values. .. math:

p(x) \propto \exp( \sum_{i \neq j} \theta_{ij} xi xj + \sum_i \theta_{ii} xi )

theta : (n,n) array of parameters

pyGM.misc.devectorize(theta, features, default=0.0, tolerance=0.0)[source]

Return a vectorization of the model with “factors”, under the specified set of base features

pyGM.misc.ising_grid(n=10, d=2, sigp=1.0, sigu=0.1)[source]

Return a basic Ising-like grid model.

n : size of grid (n x n), default 10 d : cardinality of variables (default 2) sigp : std dev of log pairwise potentials (non-diagonal terms; default 1.0) sigu : std dev of log unary potentials (default 0.1)

pyGM.misc.vectorize(factors, features, default=0.0)[source]

Return a vectorization of the model with “factors”, under the specified set of base features