}
else
{
- list.add(Double.valueOf(next));
+ double prob = Double.valueOf(next);
+ prob = Math.pow(Math.E, -prob);
+ list.add(prob);
}
}
return list;
StringBuilder file = new StringBuilder();
appendFileProperties(file);
appendModel(file);
-
file.append("//");
PrintWriter output = new PrintWriter(exportLocation);
for (double value : list)
{
String strValue;
- if (value == Double.NEGATIVE_INFINITY)
+ if (value > 0)
{
- strValue = "*";
+ strValue = String.format("%.5f", value);
+
+ }
+ else if (value == -0.00000d)
+ {
+ strValue = "0.00000";
}
else
{
- strValue = String.format("%.5f", value);
+ strValue = "*";
}
strList.add(strValue);
List<String> strMatches;
List<Double> doubleMatches;
doubleMatches = hmm.getNode(node).getMatchEmissions();
+ convertListToLogSpace(doubleMatches);
strMatches = doubleListToStringList(doubleMatches, 5);
matchLine += addData(10, 9, strMatches);
List<String> strInserts;
List<Double> doubleInserts;
doubleInserts = hmm.getNode(node).getInsertEmissions();
+ convertListToLogSpace(doubleInserts);
strInserts = doubleListToStringList(doubleInserts, 5);
insertLine += addData(17, 9, strInserts);
List<String> strTransitions;
List<Double> doubleTransitions;
doubleTransitions = hmm.getNode(node).getStateTransitions();
+ convertListToLogSpace(doubleTransitions);
strTransitions = doubleListToStringList(doubleTransitions, 5);
transitionLine += addData(17, 9, strTransitions);
return null;
}
+
+ void convertListToLogSpace(List<Double> list)
+ {
+
+ for (int i = 0; i < list.size(); i++)
+ {
+ double prob = list.get(i);
+ double logProb = -1 * Math.log(prob);
+
+ list.set(i, logProb);
+ }
+
+
+ }
}