chainer.functions.argmax_crf1d¶
-
chainer.functions.
argmax_crf1d
(cost, xs)[source]¶ Computes a state that maximizes a joint probability of the given CRF.
- Parameters
cost (
Variable
or N-dimensional array) – A \(K \times K\) matrix which holds transition cost between two labels, where \(K\) is the number of labels.xs (list of Variable) – Input vector for each label.
len(xs)
denotes the length of the sequence, and eachVariable
holds a \(B \times K\) matrix, where \(B\) is mini-batch size, \(K\) is the number of labels. Note that \(B\)s in all the variables are not necessary the same, i.e., it accepts the input sequences with different lengths.
- Returns
A tuple of
Variable
objects
and alist
ps
. The shape ofs
is(B,)
, whereB
is the mini-batch size. i-th element ofs
,s[i]
, represents log-likelihood of i-th data.ps
is a list of N-dimensional array, and denotes the state that maximizes the point probability.len(ps)
is equal tolen(xs)
, and shape of eachps[i]
is the mini-batch size of the correspondingxs[i]
. That means,ps[i].shape == xs[i].shape[0:1]
.- Return type