Sampling method for low-treewidth graphs
Generating samples from the distribution
sample.junction(crf, size)
crf
: The CRFsize
: The sample sizeThis function will return a matrix with size
rows and crf$n.nodes
columns, in which each row is a sampled configuration.
Exact sampling for low-treewidth graphs using junction trees
library(CRF) data(Small) s <- sample.junction(Small$crf, 100)