NodeScoreDistributionTest.java 文件源码

java
阅读 17 收藏 0 点赞 0 评论 0

项目:jpmml-evaluator 作者:
@Test
public void getProbability(){
    Node node = new Node()
        .setScore("ham");

    final
    BiMap<String, Node> entityRegistry = ImmutableBiMap.of("1", node);

    NodeScoreDistribution<Double> classification = new NodeScoreDistribution<Double>(new ValueMap<String, Double>(), node){

        @Override
        public BiMap<String, Node> getEntityRegistry(){
            return entityRegistry;
        }
    };

    classification.put("ham", new DoubleValue(0.75d));
    classification.put("spam", new DoubleValue(0.25d));

    assertEquals(ImmutableSet.of("ham", "spam"), classification.getCategoryValues());

    assertEquals((Double)0.75d, classification.getProbability("ham"));
    assertEquals((Double)0.25d, classification.getProbability("spam"));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号