CRFpackage {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 loglinear 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.exact
Exact decoding for small graphs with bruteforce search 
decode.chain
Exact decoding for chainstructured graphs with the Viterbi algorithm 
decode.tree
Exact decoding for tree and foreststructured graphs with maxproduct belief propagation 
decode.conditional
Conditional decoding (takes another decoding method as input) 
decode.cutset
Exact decoding for graphs with a small cutset using cutset conditioning 
decode.junction
Exact decoding for lowtreewidth graphs using junction trees 
decode.sample
Approximate decoding using sampling (takes a sampling method as input) 
decode.marginal
Approximate decoding using inference (takes an inference method as input) 
decode.lbp
Approximate decoding using maxproduct loopy belief propagation 
decode.trbp
Approximate decoding using maxproduct treereweighted belief propagtion 
decode.greedy
Approximate decoding with greedy algorithm 
decode.icm
Approximate decoding with the iterated conditional modes algorithm 
decode.block
Approximate decoding with the block iterated conditional modes algorithm 
decode.ilp
Exact decoding with an integer linear programming formulation and approximate using LP relaxation
Inference: Computing the partition function and marginal probabilities

infer.exact
Exact inference for small graphs with bruteforce counting 
infer.chain
Exact inference for chainstructured graphs with the forwardbackward algorithm 
infer.tree
Exact inference for tree and foreststructured graphs with sumproduct belief propagation 
infer.conditional
Conditional inference (takes another inference method as input) 
infer.cutset
Exact inference for graphs with a small cutset using cutset conditioning 
infer.junction
Exact decoding for lowtreewidth graphs using junction trees 
infer.sample
Approximate inference using sampling (takes a sampling method as input) 
infer.lbp
Approximate inference using sumproduct loopy belief propagation 
infer.trbp
Approximate inference using sumproduct treereweighted belief propagation
Sampling: Generating samples from the distribution

sample.exact
Exact sampling for small graphs with bruteforce inverse cumulative distribution 
sample.chain
Exact sampling for chainstructured graphs with the forwardfilter backwardsample algorithm 
sample.tree
Exact sampling for tree and foreststructured graphs with sumproduct belief propagation and backwardsampling 
sample.conditional
Conditional sampling (takes another sampling method as input) 
sample.cutset
Exact sampling for graphs with a small cutset using cutset conditioning 
sample.junction
Exact sampling for lowtreewidth graphs using junction trees 
sample.gibbs
Approximate sampling using a singlesite Gibbs sampler
Training: Given data, computing the most likely estimates of the parameters
Tools: Tools for building and manipulating CRF data

make.crf
Generate CRF from the adjacent matrix 
make.features
Make the data structure of CRF features 
make.par
Make the data structure of CRF parameters 
duplicate.crf
Duplicate an existing CRF 
clamp.crf
Generate clamped CRF by fixing the states of some nodes 
clamp.reset
Reset clamped CRF by changing the states of clamped nodes 
sub.crf
Generate sub CRF by selecting some nodes 
mrf.update
Update node and edge potentials of MRF model 
crf.update
Update node and edge potentials of CRF model
Author(s)
LingYun 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. 282289, 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)