crf.update {CRF}R Documentation

Update CRF potentials

Description

Update node and edge potentials of CRF model

Usage

crf.update(
  crf,
  node.fea = NULL,
  edge.fea = NULL,
  node.ext = NULL,
  edge.ext = NULL
)

Arguments

crf

The CRF

node.fea

The node features matrix with dimension (n.nf, n.nodes)

edge.fea

The edge features matrix with dimension (n.ef, n.edges)

node.ext

The extended information of node features

edge.ext

The extended information of edge features

Details

This function updates node.pot and edge.pot of CRF model by using the current values of parameters and features.

There are two ways to model the relationship between parameters and features. The first one exploits the special structure of features to reduce the memory usage. However it may not suitable for all circumstances. The other one is more straighforward by explicitly specifying the coefficients of each parameter to calculate the potentials, and may use much more memory. Two approaches can be used together.

The first way uses the objects node.par and edge.par to define the structure of features and provides the feature information in variables node.fea and edge.fea. The second way directly provides the feature information in variables node.ext and edge.ext without any prior assumption on feature structure. node.ext is a list and each element has the same structure as node.pot. edge.ext is a list and each element has the same structure as edge.pot.

In detail, the node potential is updated as follows:

node.pot[n,i] = exp( \sum_{f} par[node.par[n,i,f]] * node.fea[f,n] + \sum_{k} par[k] * node.ext[[k]][n,i] )

and the edge potential is updated as follows:

edge.pot[[e]][i,j] = exp( \sum_{f} par[edge.par[[e]][i,j,f]] * edge.fea[f,e] + \sum_{k} par[k] * edge.ext[[k]][[e]][i,j] )

Value

This function will directly modify the CRF and return the same CRF.

See Also

crf.nll, train.crf


[Package CRF version 0.4-3 Index]