crf.update: Update CRF potentials

Description Usage Arguments Details Value See Also

View source: R/train.R

Description

Update node and edge potentials of CRF model

Usage

1
2
3
4
5
6
7
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( ∑_{f} par[node.par[n,i,f]] * node.fea[f,n] + ∑_{k} par[k] * node.ext[[k]][n,i] )

and the edge potential is updated as follows:

edge.pot[[e]][i,j] = exp( ∑_{f} par[edge.par[[e]][i,j,f]] * edge.fea[f,e] + ∑_{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


CRF documentation built on Dec. 1, 2019, 3:02 a.m.