public DoubleVector predict(DoubleVector features) {
// clamp the features to the visible units, calculate the joint
// probability for each hidden state and put it into the vector
DoubleVector probabilities = emissionProbabilityMatrix
.multiplyVectorRow(features);
double max = probabilities.max();
for (int state = 0; state < probabilities.getDimension(); state++) {
probabilities.set(state, FastMath.exp(probabilities.get(state) - max)
* hiddenPriorProbability.get(state));
}
// normalize again