public class CliqueTree
extends java.lang.Object
This is instantiated once per model, so that it can keep caches of important stuff like messages and local factors during many game playing sample steps. It assumes that the model that is passed in is by-reference, and that it can change between inference calls in small ways, so that cacheing of some results is worthwhile.
Modifier and Type | Class and Description |
---|---|
static class |
CliqueTree.MarginalResult
Little data structure for passing around the results of marginal computations.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
VARIABLE_OBSERVED_VALUE |
Constructor and Description |
---|
CliqueTree(GraphicalModel model,
ConcatVector weights)
Create an Inference object for a given set of weights, and a model.
|
Modifier and Type | Method and Description |
---|---|
int[] |
calculateMAP()
This assumes that factors represent joint probabilities.
|
CliqueTree.MarginalResult |
calculateMarginals()
This assumes that factors represent joint probabilities.
|
double[][] |
calculateMarginalsJustSingletons()
This will calculate marginals, but skip the stuff that is created for gradient descent: joint marginals and
partition functions.
|
public static final java.lang.String VARIABLE_OBSERVED_VALUE
public CliqueTree(GraphicalModel model, ConcatVector weights)
The object is around to facilitate cacheing as an eventual optimization, when models are changing in minor ways and inference is required several times. Work is done lazily, so is left until actual inference is requested.
model
- the model to be computed over, subject to change in the futureweights
- the weights to dot product with model features to get log-linear factors, is cloned internally so
that no changes to the weights vector will be reflected by the CliqueTree. If you want to change
the weights, you must create a new CliqueTree.public CliqueTree.MarginalResult calculateMarginals()
public double[][] calculateMarginalsJustSingletons()
public int[] calculateMAP()