NodeScoreDistribution extends Classification<Object, V> implements HasEntityRegistry<Node>, HasDecisionPath, HasProbability, HasConfidence { @Override public Double getProbability(Object category){ return getValue(category); } NodeScoreDistribution(ValueMap<Object, V> probabilities,  Node node); @Override String getEntityId(); @Override Set<Object> getCategories(); @Override Double getProbability(Object category); @Override Report getProbabilityReport(Object category); @Override Double getConfidence(Object category); @Override Report getConfidenceReport(Object category); @Override Node getNode();  }
@Test public void getProbability(){ Node node = new LeafNode("ham", null); BiMap<String, Node> entityRegistry = ImmutableBiMap.of("1", node); NodeScoreDistribution<Double> classification = new NodeScoreDistribution<Double>(new ValueMap<Object, Double>(), node){ @Override public BiMap<String, Node> getEntityRegistry(){ return entityRegistry; } @Override public List<Node> getDecisionPath(){ throw new UnsupportedOperationException(); } }; classification.put("ham", new DoubleValue(0.75d)); classification.put("spam", new DoubleValue(0.25d)); assertEquals(ImmutableSet.of("ham", "spam"), classification.getCategories()); assertEquals((Double)0.75d, classification.getProbability("ham")); assertEquals((Double)0.25d, classification.getProbability("spam")); }