API Reference
Graphical models
Classes representing different kinds of graphical models.
Gaussian graphical model |
|
Graphical model in the most general form. |
|
Abstract class representing any graphical model. |
|
Normal Factor Graph model. |
|
Pairwise finite graphical model. |
Auxiliary classes
Classes representing elementary concepts, such as variables and factors. Also contains data classes representing results of computations.
Domain consisting of finite set of numbers. |
|
Describes set of values which a variable can take. |
|
Abstract factor - function of one or more random variables. |
|
A factor of several discrete variables. |
|
A factor given explicitly by function. |
|
Inference result for discrete graphical model. |
|
Domain consisting of all real values. |
|
Random variable. |
Algorithms on graphical models
All algorithms are available through methods on graphical models. To invoke specific algorithm, you should pass its name as “algorithm” argument to corresponding methods. That’s why algorithms are not exported in top-level package.
However, we list all algorithms here for reference. Some algorithms may take additional parameters (such as number of iterations for iterative algorithm), which should be passed as keyword arguments. Use references below to get information on algorithm-specific parameters.
Inference algorithms
|
Calculates partition function using Edge Elimination. |
Belief propagation algorithm, equivalent to dai::BP. |
|
Backward Bucket Elimination algorithm. |
|
|
Inference with Gaussian Belief Propagation. |
Inference by summing up all states. |
|
Performs inference using Junction Tree decomposition. |
|
|
Inference with Naive Mean Field. |
|
Inference with Message Passing. |
Inference using DP on path decomposition. |
|
Inference using DP on tree. |
Optimization algorithms
LP relaxation of MAP problem for NFG model. |
|
Finds max likelihood for pairwise model by checking all states. |
|
|
Finds most probable state using Junction Tree decomposition. |
|
Max Likelihood for pairwise model by solving LP relaxation. |
|
This is an implementation of Lasserre hierarchy. |
|
This is an implementation of Sherali-Adams hierarchy, also called lift-and-project method. |
LP relaxation of MAP problem for pairwise model. |
|
Max Likelihood for pairwise model with DP on path decomposition. |
|
|
Max Likelihood for the pairwise model. |
Sampling algorithms
Samples from Pairwise Finite model. |
|
IID sampling using Junction Tree decomposition. |
|
Draws iid samples with dynamic programming on tree. |
Model conversion algorithms
Builds equivalent model on a junction tree. |
Algorithm on graphs
In most cases we use NetworkX to represent and manipulate graphs. However, in some cases, if the algorithm is too specific and is not available in NetworkX, or if we need it to be faster than in NetworkX, we implement it in our library. Those implementations are collected in this section. They are intended for internal usage by other algorithms rather than to be used directly by library users.
|
Depth-first search. |
Path decomposition of a graph. |
Model generators
These function generate random models of certain structure. They are useful for testing and benchmarking.
Generates random PairWiseFinteModel on a clique. |
|
|
Generates random PairWiseFinteModel on a grid. |
Builds random Ising model on given graph. |
|
Builds random pairwise model with given interaction graph. |
|
|
Generates random PairWiseFinteModel on a line graph. |
Generates random discrete graphical model of arbitrary structure. |
|
|
Generates random PairWiseFinteModel on a random tree. |
Interoperation
These classes are repossible for interoperation with other GM libraries.
Interoperation with libDAI. |
Datasets
Helpers to load public datasets with graphical models.
Dataset containing GM and true answers. |
|
Loads graphical models from named datasets. |
|
Reads files in UAI format. |