Package quickml.data

Examples of quickml.data.PredictionMap


        TreeBuilderTestUtils.serializeDeserialize(tree2.node);
        Assert.assertTrue(tree1.node.size() == tree2.node.size(), "Deterministic Decision Trees must have same number of nodes");

        final List<Instance<AttributesMap>> instancesTest = TreeBuilderTestUtils.getInstances(1000);
        for (Instance<AttributesMap> instance : instancesTest) {
           PredictionMap map1 = tree1.predict(instance.getAttributes());
           PredictionMap map2 = tree2.predict(instance.getAttributes());
            Assert.assertTrue(map1.equals(map2), "Deterministic Decision Trees must have equal classifications");
        }
    }
View Full Code Here


    }


    @Override
    public PredictionMap predict(final AttributesMap attributes) {
        PredictionMap predictionMap = wrappedPredictiveModel.predict(attributes);
        double positiveClassProb =  pavFunction.predict(wrappedPredictiveModel.getProbability(attributes, 1.0));
        predictionMap.put(Double.valueOf(1.0), positiveClassProb);
        predictionMap.put(Double.valueOf(0.0), 1.0 - positiveClassProb);

        return predictionMap;
    }
View Full Code Here

        pavFunction.dump(appendable);
    }

    @Override
    public Serializable getClassificationByMaxProb(AttributesMap attributes) {
        PredictionMap predictionMap = predict(attributes);
        double maxProb = 0;
        Serializable classification = null;
        for (Serializable prediction : predictionMap.keySet()) {
            double prob = predictionMap.get(prediction);
            if (prob > maxProb) {
                maxProb = prob;
                classification = prediction;
            }
        }
View Full Code Here

    @Test
    public void testGetTotalLoss() {
        ClassifierMSECrossValLossFunction crossValLoss = new ClassifierMSECrossValLossFunction();

        List<LabelPredictionWeight<PredictionMap>> labelPredictionWeights = new LinkedList<>();
        PredictionMap map = PredictionMap.newMap();
        map.put("test1", 0.75);
        labelPredictionWeights.add(new LabelPredictionWeight<PredictionMap>("test1", map, 2.0));
        map = PredictionMap.newMap();
        map.put("test1", 0.5);
        labelPredictionWeights.add(new LabelPredictionWeight<PredictionMap>("test1", map, 1.0));


        Assert.assertEquals(0.125, crossValLoss.getLoss(labelPredictionWeights));
    }
View Full Code Here

    @Test
    public void testGetTotalLoss() {
        WeightedAUCCrossValLossFunction crossValLoss = new WeightedAUCCrossValLossFunction("test1");

        List<LabelPredictionWeight<PredictionMap>> labelPredictionWeights = new LinkedList<>();
        PredictionMap map = PredictionMap.newMap();
        map.put("test1", 0.5);
        labelPredictionWeights.add(new LabelPredictionWeight<PredictionMap>("test1", map, 1.0));
        map = PredictionMap.newMap();
        map.put("test1", 0.3);
        labelPredictionWeights.add(new LabelPredictionWeight<PredictionMap>("test1", map, 1.0));
        map = PredictionMap.newMap();
        map.put("test1", 0.4);
        labelPredictionWeights.add(new LabelPredictionWeight<PredictionMap>("test0", map, 1.0));
        map = PredictionMap.newMap();
        map.put("test1", 0.2);
        labelPredictionWeights.add(new LabelPredictionWeight<PredictionMap>("test0", map, 1.0));

        //AUC Points at 0:0 0:.5 .5:.5 1:.5 1:1
        double expectedArea = .25;
View Full Code Here

TOP

Related Classes of quickml.data.PredictionMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.