use of edu.neu.ccs.pyramid.multilabel_classification.plugin_rule.GeneralF1Predictor in project pyramid by cheng-li.
the class InstanceF1Predictor method predict.
@Override
public MultiLabel predict(Vector vector) {
double[] probs = imlGradientBoosting.predictAllAssignmentProbsWithConstraint(vector);
List<Double> probList = Arrays.stream(probs).mapToObj(a -> a).collect(Collectors.toList());
GeneralF1Predictor generalF1Predictor = new GeneralF1Predictor();
return generalF1Predictor.predict(imlGradientBoosting.getNumClasses(), imlGradientBoosting.getAssignments(), probList);
}
use of edu.neu.ccs.pyramid.multilabel_classification.plugin_rule.GeneralF1Predictor in project pyramid by cheng-li.
the class InstanceF1Predictor method showPredictBySupport.
public GeneralF1Predictor.Analysis showPredictBySupport(Vector vector, MultiLabel truth) {
// System.out.println("support procedure");
List<MultiLabel> support = cmlcrf.getSupportCombinations();
double[] probs = cmlcrf.predictCombinationProbs(vector);
GeneralF1Predictor generalF1Predictor = new GeneralF1Predictor();
MultiLabel prediction = generalF1Predictor.predict(cmlcrf.getNumClasses(), support, probs);
GeneralF1Predictor.Analysis analysis = GeneralF1Predictor.showSupportPrediction(support, probs, truth, prediction, cmlcrf.getNumClasses());
return analysis;
}
use of edu.neu.ccs.pyramid.multilabel_classification.plugin_rule.GeneralF1Predictor in project pyramid by cheng-li.
the class PluginF1 method predictBySamplingNonEmpty.
private MultiLabel predictBySamplingNonEmpty(Vector vector) {
List<MultiLabel> samples = cbm.samples(vector, numSamples);
List<MultiLabel> nonZeros = samples.stream().filter(a -> a.getNumMatchedLabels() > 0).collect(Collectors.toList());
GeneralF1Predictor generalF1Predictor = new GeneralF1Predictor();
generalF1Predictor.setMaxSize(maxSize);
return generalF1Predictor.predict(cbm.getNumClasses(), nonZeros);
}
use of edu.neu.ccs.pyramid.multilabel_classification.plugin_rule.GeneralF1Predictor in project pyramid by cheng-li.
the class PluginF1 method predictBySampling.
private MultiLabel predictBySampling(Vector vector) {
List<MultiLabel> samples = cbm.samples(vector, numSamples);
GeneralF1Predictor generalF1Predictor = new GeneralF1Predictor();
generalF1Predictor.setMaxSize(maxSize);
return generalF1Predictor.predict(cbm.getNumClasses(), samples);
// unique the sample set and apply GFM
// List<MultiLabel> uniqueSamples = new ArrayList(new HashSet(samples));
// List<Double> probs = cbm.predictAssignmentProbs(vector, uniqueSamples);
// return GeneralF1Predictor.predict(cbm.getNumClasses(), uniqueSamples, probs);
}
use of edu.neu.ccs.pyramid.multilabel_classification.plugin_rule.GeneralF1Predictor in project pyramid by cheng-li.
the class PluginF1 method predictBySupport.
private MultiLabel predictBySupport(Vector vector) {
double[] probs = cbm.predictAssignmentProbs(vector, support, piThreshold);
GeneralF1Predictor generalF1Predictor = new GeneralF1Predictor();
generalF1Predictor.setMaxSize(maxSize);
return generalF1Predictor.predict(cbm.getNumClasses(), support, probs);
}
Aggregations