Search in sources :

Example 1 with BMDistribution

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();
}
Also used : DynamicProgramming(edu.neu.ccs.pyramid.multilabel_classification.DynamicProgramming) MultiLabel(edu.neu.ccs.pyramid.dataset.MultiLabel) BMDistribution(edu.neu.ccs.pyramid.multilabel_classification.cbm.BMDistribution)

Aggregations

MultiLabel (edu.neu.ccs.pyramid.dataset.MultiLabel)1 DynamicProgramming (edu.neu.ccs.pyramid.multilabel_classification.DynamicProgramming)1 BMDistribution (edu.neu.ccs.pyramid.multilabel_classification.cbm.BMDistribution)1