Class UndirectedModel

  extended by cc.mallet.grmm.types.FactorGraph
      extended by cc.mallet.grmm.types.UndirectedModel
All Implemented Interfaces:
Factor,, java.lang.Cloneable
Direct Known Subclasses:
ACRF.UnrolledGraph, UndirectedGrid

public class UndirectedModel
extends FactorGraph

Class for pairwise undirected graphical models, also known as pairwise Markov random fields. This is a thin wrapper over FactorGraph, with only a few methods added that don't make sense for non-pairwise graphs. Created: Dec 21, 2005

$Id:,v 1.1 2007/10/22 21:37:44 mccallum Exp $
Serialized Form

Constructor Summary
UndirectedModel(int capacity)
UndirectedModel(Variable[] vars)
Method Summary
 void addFactor(Factor factor)
          Adds a factor to the model.
static UndirectedModel createBoltzmannMachine(double[][] weights, double[] biases)
          Creates an undirected model that corresponds to a Boltzmann machine with the given weights and biases.
 java.util.Set getEdgeSet()
 boolean isConnected(Variable v1, Variable v2)
Methods inherited from class cc.mallet.grmm.types.FactorGraph
addFactor, afterFactorAdd, allFactorsContaining, allFactorsContaining, allFactorsOf, allFactorsOf, almostEquals, almostEquals, argmax, assignmentIterator, asTable, beforeFactorAdd, clear, containsVar, divideBy, dump, dump, dumpToString, duplicate, entropy, exponentiate, extractMax, extractMax, extractMax, factorOf, factorOf, factorOf, factorOf, factorProduct, factors, factorsIterator, findVariable, get, getAdjacentVertices, getDegree, getFactor, getIndex, getIndex, getInferenceCache, getVariable, isAdjacent, isNaN, logify, logValue, logValue, logValue, marginalize, marginalize, marginalize, marginalizeOut, marginalizeOut, multiply, multiplyBy, normalize, numVariables, prettyOutputString, printAsDot, printAsDot, remove, remove, sample, sampleContinuousVars, setInferenceCache, slice, slice, sum, toString, value, value, variablesIterator, variablesSet, varSet, varSetIterator
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public UndirectedModel()


public UndirectedModel(Variable[] vars)


public UndirectedModel(int capacity)
Method Detail


public java.util.Set getEdgeSet()


public void addFactor(Factor factor)
Description copied from class: FactorGraph
Adds a factor to the model.

If a factor has already been added for the variables in the given clique, the effects of this method are (currently) undefined.

All convenience methods for adding factors eventually call through to this one, so this is the method for subclasses to override if they wish to perform additional actions when a factor is added to the graph.

addFactor in class FactorGraph
factor - A factor over the variables in clique.


public static UndirectedModel createBoltzmannMachine(double[][] weights,
                                                     double[] biases)
Creates an undirected model that corresponds to a Boltzmann machine with the given weights and biases.

weights -
biases -
An appropriate UndirectedModel.


public boolean isConnected(Variable v1,
                           Variable v2)