public DoubleMatrix predict(DoubleMatrix features, DoubleMatrix featuresPerState) { return ViterbiUtils.decode(theta, features, featuresPerState, classes); }
double[] localScores = computeScores(classes, features.getRowVector(0), weights); localScores = computeScores(classes, featuresPerState.getRowVector(i + j), weights); for (int currLabel = 0; currLabel < localScores.length; currLabel++) {
public DoubleVector predict(DoubleVector feature, DoubleVector[] featuresPerState) { return ViterbiUtils.decode(theta, new SparseDoubleRowMatrix(Collections.singletonList(feature)), new SparseDoubleRowMatrix(featuresPerState), classes).getRowVector(0); }
/** * Decodes the given observation sequence (features) with the current HMM. * This discovers the best hidden state sequence Q that is derived by * executing the Viterbi algorithm with the given observations and the HMM's * parameters lambda. This is a proxy to {@link ViterbiUtils} * {@link #decode(DoubleVector[], DoubleVector[])}. * * @param observationSequence the given sequence of features. * @return a matrix containing the predicted hidden state on each row vector. */ public DoubleMatrix decode(DoubleVector[] observationSequence, DoubleVector[] featuresPerHiddenState) { return ViterbiUtils.decode(emissionProbabilityMatrix, new SparseDoubleRowMatrix(observationSequence), new SparseDoubleRowMatrix(featuresPerHiddenState), numHiddenStates); }