| CRF-package {CRF} | R Documentation |
CRF - Conditional Random Fields
Description
Library of Conditional Random Fields model
Details
CRF is R package for various computational tasks of conditional random fields as well as other probabilistic undirected graphical models of discrete data with pairwise and unary potentials. The decoding/inference/sampling tasks are implemented for general discrete undirected graphical models with pairwise potentials. The training task is less general, focusing on conditional random fields with log-linear potentials and a fixed structure. The code is written entirely in R and C++. The initial version is ported from UGM written by Mark Schmidt.
Decoding: Computing the most likely configuration
-
decode.exactExact decoding for small graphs with brute-force search -
decode.chainExact decoding for chain-structured graphs with the Viterbi algorithm -
decode.treeExact decoding for tree- and forest-structured graphs with max-product belief propagation -
decode.conditionalConditional decoding (takes another decoding method as input) -
decode.cutsetExact decoding for graphs with a small cutset using cutset conditioning -
decode.junctionExact decoding for low-treewidth graphs using junction trees -
decode.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 propagation -
decode.trbpApproximate decoding using max-product tree-reweighted belief propagtion -
decode.greedyApproximate decoding with greedy algorithm -
decode.icmApproximate decoding with the iterated conditional modes algorithm -
decode.blockApproximate decoding with the block iterated conditional modes algorithm -
decode.ilpExact decoding with an integer linear programming formulation and approximate using LP relaxation
Inference: Computing the partition function and marginal probabilities
-
infer.exactExact inference for small graphs with brute-force counting -
infer.chainExact inference for chain-structured graphs with the forward-backward algorithm -
infer.treeExact inference for tree- and forest-structured graphs with sum-product belief propagation -
infer.conditionalConditional inference (takes another inference method as input) -
infer.cutsetExact inference for graphs with a small cutset using cutset conditioning -
infer.junctionExact decoding for low-treewidth graphs using junction trees -
infer.sampleApproximate inference using sampling (takes a sampling method as input) -
infer.lbpApproximate inference using sum-product loopy belief propagation -
infer.trbpApproximate inference using sum-product tree-reweighted belief propagation
Sampling: Generating samples from the distribution
-
sample.exactExact sampling for small graphs with brute-force inverse cumulative distribution -
sample.chainExact sampling for chain-structured graphs with the forward-filter backward-sample algorithm -
sample.treeExact sampling for tree- and forest-structured graphs with sum-product belief propagation and backward-sampling -
sample.conditionalConditional sampling (takes another sampling method as input) -
sample.cutsetExact sampling for graphs with a small cutset using cutset conditioning -
sample.junctionExact sampling for low-treewidth graphs using junction trees -
sample.gibbsApproximate sampling using a single-site Gibbs sampler
Training: Given data, computing the most likely estimates of the parameters
Tools: Tools for building and manipulating CRF data
-
make.crfGenerate CRF from the adjacent matrix -
make.featuresMake the data structure of CRF features -
make.parMake the data structure of CRF parameters -
duplicate.crfDuplicate an existing CRF -
clamp.crfGenerate clamped CRF by fixing the states of some nodes -
clamp.resetReset clamped CRF by changing the states of clamped nodes -
sub.crfGenerate sub CRF by selecting some nodes -
mrf.updateUpdate node and edge potentials of MRF model -
crf.updateUpdate node and edge potentials of CRF model
Author(s)
Ling-Yun Wu wulingyun@gmail.com
References
J. Lafferty, A. McCallum, and F. Pereira. Conditional random fields: Probabilistic models for segmenting and labeling sequence data. In the proceedings of International Conference on Machine Learning (ICML), pp. 282-289, 2001.
Mark Schmidt. UGM: A Matlab toolbox for probabilistic undirected graphical models. http://www.cs.ubc.ca/~schmidtm/Software/UGM.html, 2007.
Examples
library(CRF)
data(Small)
decode.exact(Small$crf)
infer.exact(Small$crf)
sample.exact(Small$crf, 100)