CRF-package {CRF} | R Documentation |
Library of Conditional Random Fields model
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.exact
Exact decoding for small graphs with brute-force search
decode.chain
Exact decoding for chain-structured graphs with the Viterbi algorithm
decode.tree
Exact decoding for tree- and forest-structured graphs with max-product 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 low-treewidth 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 max-product loopy belief propagation
decode.trbp
Approximate decoding using max-product tree-reweighted 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 brute-force counting
infer.chain
Exact inference for chain-structured graphs with the forward-backward algorithm
infer.tree
Exact inference for tree- and forest-structured graphs with sum-product 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 low-treewidth graphs using junction trees
infer.sample
Approximate inference using sampling (takes a sampling method as input)
infer.lbp
Approximate inference using sum-product loopy belief propagation
infer.trbp
Approximate inference using sum-product tree-reweighted belief propagation
Sampling: Generating samples from the distribution
sample.exact
Exact sampling for small graphs with brute-force inverse cumulative distribution
sample.chain
Exact sampling for chain-structured graphs with the forward-filter backward-sample algorithm
sample.tree
Exact sampling for tree- and forest-structured graphs with sum-product belief propagation and backward-sampling
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 low-treewidth graphs using junction trees
sample.gibbs
Approximate 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.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
Ling-Yun Wu wulingyun@gmail.com
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.
library(CRF)
data(Small)
decode.exact(Small$crf)
infer.exact(Small$crf)
sample.exact(Small$crf, 100)