- double[] actual = new double[4];
- actual[0] = hmm.getStateTransitionProbability(475, hmm.MATCHTODELETE);
- actual[1] = hmm.getStateTransitionProbability(8, hmm.MATCHTOINSERT);
- actual[2] = hmm.getStateTransitionProbability(80, hmm.INSERTTOINSERT);
- actual[3] = hmm.getStateTransitionProbability(475, hmm.DELETETOMATCH);
-
- double[] expected = new double[4];
- expected[0] = Double.NEGATIVE_INFINITY;
- expected[1] = 0.00662894243;
- expected[2] = 0.46183388908;
- expected[3] = 1;
-
- for (int i = 0; i < 4; i++)
- {
- assertEquals(actual[i], expected[i], 0.001d);
- }
+ // * in model file treated as negative infinity
+ double stp = hmm.getStateTransitionProbability(475,
+ HiddenMarkovModel.MATCHTODELETE);
+ assertEquals(stp, Double.NEGATIVE_INFINITY);
+
+ // file value is 5.01631, saved as e^-5.01631
+ stp = hmm.getStateTransitionProbability(8,
+ HiddenMarkovModel.MATCHTOINSERT);
+ assertEquals(stp, Math.pow(Math.E, -5.01631), 0.0001D);
+
+ stp = hmm.getStateTransitionProbability(36,
+ HiddenMarkovModel.MATCHTODELETE);
+ assertEquals(stp, Math.pow(Math.E, -5.73865), 0.0001D);
+
+ stp = hmm.getStateTransitionProbability(22,
+ HiddenMarkovModel.INSERTTOMATCH);
+ assertEquals(stp, Math.pow(Math.E, -0.61958), 0.0001D);
+
+ stp = hmm.getStateTransitionProbability(80,
+ HiddenMarkovModel.INSERTTOINSERT);
+ assertEquals(stp, Math.pow(Math.E, -0.77255), 0.0001D);
+
+ stp = hmm.getStateTransitionProbability(475,
+ HiddenMarkovModel.DELETETOMATCH);
+ assertEquals(stp, 1D, 0.0001D);
+
+ stp = hmm.getStateTransitionProbability(218,
+ HiddenMarkovModel.DELETETODELETE);
+ assertEquals(stp, Math.pow(Math.E, -0.95510), 0.0001D);