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 each Variable 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 object s and a list ps. The shape of s is (B,), where B is the mini-batch size. i-th element of s, 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 to len(xs), and shape of each ps[i] is the mini-batch size of the corresponding xs[i]. That means, ps[i].shape == xs[i].shape[0:1].

Return type

tuple