Package etc.aloe.data

Examples of etc.aloe.data.Predictions$Prediction


        seg.add(rawMessages.get(7));
        seg.add(rawMessages.get(8));
        seg.add(rawMessages.get(9));
        this.segments.add(seg);

        this.predictions = new Predictions();
        predictions.add(Boolean.TRUE, 1.0);
        predictions.add(Boolean.FALSE, 0.0);
        predictions.add(Boolean.TRUE, 1.0);
        predictions.add(Boolean.FALSE, 0.0);
View Full Code Here


        Boolean[] expResult = new Boolean[]{true, true, false, false};
        Double[] expConfidence = new Double[]{1.0, 1.0, 0.0, 0.0};

        ExampleSet examples = new ExampleSet(testInstances);

        Predictions predictions = instance.getPredictions(examples);

        assertEquals(expResult.length, predictions.size());

        for (int i = 0; i < expResult.length; i++) {
            assertEquals(expResult[i], predictions.getPredictedLabel(i));
            assertEquals(expConfidence[i], predictions.getPredictionConfidence(i));
            assertEquals(testInstances.get(i).classValue(), predictions.getTrueLabel(i) ? 1.0 : 0.0, 0.0);
        }
    }
View Full Code Here

        ExampleSet examples = extraction.extractFeatures(segmentSet.getBasicExamples(), featureSpecification);

        this.featureValues = examples.getInstances();
       
        //Predict the labels
        Predictions predictions = this.model.getPredictions(examples);

        //Map back onto messages
        LabelMapping mapping = getMappingImpl();
        mapping.map(predictions, segmentSet);
View Full Code Here

                System.out.println("- Extracting features from test set");
                ExampleSet testingSet = extraction.extractFeatures(basicTestingExamples, spec);
                basicTestingExamples = null;

                Predictions predictions = model.getPredictions(testingSet);
                EvaluationReport report = new EvaluationReport("Fold " + (foldIndex + 1), falsePositiveCost, falseNegativeCost);
                report.addPredictions(predictions);
               
                LabelMapping mapping = getMappingImpl();
                mapping.map(predictions, testingSegments);
View Full Code Here

            extraction.setVerbosity(Loggable.Verbosity.Quiet);

            ExampleSet examples = extraction.extractFeatures(segmentSet.getBasicExamples(), featureSpecification);

            //Predict the labels
            Predictions prediction = this.model.getPredictions(examples);

            //Map back onto messages
            LabelMapping mapping = getMappingImpl();
            mapping.map(prediction, segmentSet);
View Full Code Here

        //The test here is whether the model works
        Boolean[] expResult = new Boolean[]{true, true, false, false};
        Double[] expConfidence = new Double[]{1.0, 1.0, 0.0, 0.0};

        ExampleSet examples = new ExampleSet(testInstances);
        Predictions predictions = model.getPredictions(examples);

        assertEquals(expResult.length, predictions.size());

        for (int i = 0; i < expResult.length; i++) {
            assertEquals(expResult[i], predictions.getPredictedLabel(i));
            assertEquals(expConfidence[i], predictions.getPredictionConfidence(i));
            assertEquals(testInstances.get(i).classValue(), predictions.getTrueLabel(i) ? 1.0 : 0.0, 0.0);
        }
    }
View Full Code Here

     * @param examples
     * @return
     */
    @Override
    public Predictions getPredictions(ExampleSet examples) {
        Predictions predictions = new Predictions();

        for (int i = 0; i < examples.size(); i++) {
            try {
                Boolean trueLabel = examples.getTrueLabel(i);

                double classValue = classifier.classifyInstance(examples.get(i));
                Boolean predictedLabel = examples.getClassLabel(classValue);

                double[] distribution = classifier.distributionForInstance(examples.get(i));
                Double confidence = examples.getConfidence(distribution, classValue);
                predictions.add(predictedLabel, confidence, trueLabel);

            } catch (Exception ex) {
                System.err.println("Classification error on instance " + i);
            }
        }
View Full Code Here

TOP

Related Classes of etc.aloe.data.Predictions$Prediction

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.