use of edu.neu.ccs.pyramid.multilabel_classification.cbm.BMDistribution in project pyramid by cheng-li.
the class CalibrationTest method pred.
private static String pred(CBM cbm, MultiLabelClfDataSet dataSet, int top) {
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < dataSet.getNumDataPoints(); i++) {
double[] marginals = cbm.predictClassProbs(dataSet.getRow(i));
DynamicProgramming dynamicProgramming = new DynamicProgramming(marginals);
BMDistribution bmDistribution = cbm.computeBM(dataSet.getRow(i), 0.001);
for (int k = 0; k < top; k++) {
MultiLabel multiLabel = dynamicProgramming.nextHighestVector();
double score = bmDistribution.logProbability(multiLabel);
stringBuilder.append("" + i + ": " + multiLabel.toSimpleString()).append(" (").append(score).append(")").append("\n");
}
}
return stringBuilder.toString();
}
Aggregations