crf.update(crf, node.fea = NaN, edge.fea = NaN, node.ext = NaN,
edge.ext = NaN)(n.nf, n.nodes)(n.ef, n.edges)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] = \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] = \sum_{f} par[edge.par[[e]][i,j,f]] * edge.fea[f,e] + \sum_{k} par[k] * edge.ext[[k]][[e]][i,j]$$
crf.nll, train.crf