use of edu.neu.ccs.pyramid.multilabel_classification.multi_label_logistic_regression.MLLogisticRegression in project pyramid by cheng-li.
the class MLACPlattScalingTest method test2.
private static void test2() throws Exception {
MultiLabelClfDataSet dataSet = TRECFormat.loadMultiLabelClfDataSet(new File(DATASETS, "ohsumed/3/train.trec"), DataSetType.ML_CLF_SPARSE, true);
List<MultiLabel> assignments = DataSetUtil.gatherMultiLabels(dataSet);
MLLogisticTrainer trainer = MLLogisticTrainer.getBuilder().setGaussianPriorVariance(10000).build();
MLLogisticRegression logisticRegression = trainer.train(dataSet, assignments);
StopWatch stopWatch = new StopWatch();
stopWatch.start();
MLACPlattScaling plattScaling = new MLACPlattScaling(dataSet, logisticRegression);
for (int i = 0; i < 10; i++) {
System.out.println(Arrays.toString(logisticRegression.predictClassScores(dataSet.getRow(i))));
System.out.println(Arrays.toString(logisticRegression.predictClassProbs(dataSet.getRow(i))));
System.out.println(Arrays.toString(plattScaling.predictClassProbs(dataSet.getRow(i))));
System.out.println("======================");
}
}
Aggregations