Decoding: Computing the most likely configuration
decode.exactExact decoding for small graphs with brute-force searchdecode.chainExact decoding for chain-structured graphs with the Viterbi algorithmdecode.treeExact decoding for tree- and forest-structured graphs with max-product belief propagationdecode.conditionalConditional decoding (takes another decoding method as input)decode.cutsetExact decoding for graphs with a small cutset using cutset conditioningdecode.junctionExact decoding for low-treewidth graphs using junction treesdecode.sampleApproximate decoding using sampling (takes a sampling method as input)decode.marginalApproximate decoding using inference (takes an inference method as input)decode.lbpApproximate decoding using max-product loopy belief propagationdecode.trbpApproximate decoding using max-product tree-reweighted belief propagtiondecode.greedyApproximate decoding with greedy algorithmdecode.icmApproximate decoding with the iterated conditional modes algorithmdecode.blockApproximate decoding with the block iterated conditional modes algorithmdecode.ilpExact decoding with an integer linear programming formulation and approximate using LP relaxationInference: Computing the partition function and marginal probabilities
infer.exactExact inference for small graphs with brute-force countinginfer.chainExact inference for chain-structured graphs with the forward-backward algorithminfer.treeExact inference for tree- and forest-structured graphs with sum-product belief propagationinfer.conditionalConditional inference (takes another inference method as input)infer.cutsetExact inference for graphs with a small cutset using cutset conditioninginfer.junctionExact decoding for low-treewidth graphs using junction treesinfer.sampleApproximate inference using sampling (takes a sampling method as input)infer.lbpApproximate inference using sum-product loopy belief propagationinfer.trbpApproximate inference using sum-product tree-reweighted belief propagationSampling: Generating samples from the distribution
sample.exactExact sampling for small graphs with brute-force inverse cumulative distributionsample.chainExact sampling for chain-structured graphs with the forward-filter backward-sample algorithmsample.treeExact sampling for tree- and forest-structured graphs with sum-product belief propagation and backward-samplingsample.conditionalConditional sampling (takes another sampling method as input)sample.cutsetExact sampling for graphs with a small cutset using cutset conditioningsample.junctionExact sampling for low-treewidth graphs using junction treessample.gibbsApproximate sampling using a single-site Gibbs samplerTraining: Given data, computing the most likely estimates of the parameters
Tools: Tools for building and manipulating CRF data
make.crfGenerate CRF from the adjacent matrixmake.featuresMake the data structure of CRF featuresmake.parMake the data structure of CRF parametersduplicate.crfDuplicate an existing CRFclamp.crfGenerate clamped CRF by fixing the states of some nodesclamp.resetReset clamped CRF by changing the states of clamped nodessub.crfGenerate sub CRF by selecting some nodesmrf.updateUpdate node and edge potentials of MRF modelcrf.updateUpdate node and edge potentials of CRF modelMark Schmidt. UGM: Matlab code for undirected graphical models.
library(CRF)
data(Small)
decode.exact(Small$crf)
infer.exact(Small$crf)
sample.exact(Small$crf, 100)Run the code above in your browser using DataLab