Package etc.aloe.data

Examples of etc.aloe.data.EvaluationReport


            //Run cross validation
            crossValidationController.setSegmentSet(segments);
            crossValidationController.run();

            EvaluationReport evalReport = crossValidationController.getEvaluationReport();
            if (evalReport != null) {
                System.out.println("== Saving Results of Cross Validation ==");
               
                saveEvaluationReport(evalReport, options.outputEvaluationReportFile);
               
                System.out.println("Aggregated cross-validation report:");
                System.out.println(evalReport);
                System.out.println("---------");

                if (options.makeROC) {
                    options.outputROCDir.mkdirs();
                   
                    for (ROC roc : evalReport.getROCs()) {
                        String fileName = roc.getName() + FileNames.ROC_SUFFIX;
                        File outputFile = new File(options.outputROCDir, fileName);

                        saveROC(roc, outputFile);
                    }
                }
               
                if (options.outputTests) {
                    options.outputTestsDir.mkdirs();
                    List<SegmentSet> testSets = evalReport.getTestSets();
                    List<String> testSetNames = evalReport.getTestSetNames();
                   
                    SegmentSet combined = new SegmentSet();
                   
                    for (int i = 0; i < testSets.size(); i++) {
                        String fileName = testSetNames.get(i) + FileNames.TEST_DATA_SUFFIX;
View Full Code Here


            labelingController.setSegmentSet(segments);
            labelingController.setFeatureSpecification(spec);
            labelingController.run();

            //Get the outputs
            EvaluationReport evalReport = labelingController.getEvaluationReport();

            System.out.println("== Saving Output ==");

            saveEvaluationReport(evalReport, options.outputEvaluationReportFile);
            if (options.makeROC) {
                ROC roc = evalReport.getROCs().get(0);
                saveROC(roc, options.outputROCFile);
            }
           
            if (options.outputFeatureValues) {
                Instances featureValues = labelingController.getFeatureValues();
View Full Code Here

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

        //Evaluate the model on labeled examples
        this.evaluationReport = new EvaluationReport("Unlabeled Data", falsePositiveCost, falseNegativeCost);
        this.evaluationReport.addPredictions(predictions);
    }
View Full Code Here

            System.out.println("Randomizing and stratifying segments.");
            CrossValidationPrep<Segment> validationPrep = new CrossValidationPrep<Segment>();
            validationPrep.randomize(segmentSet.getSegments());
            segmentSet.setSegments(validationPrep.stratify(segmentSet.getSegments(), folds));

            evaluationReport = new EvaluationReport(this.folds + " Cross Validation", falsePositiveCost, falseNegativeCost);
            for (int foldIndex = 0; foldIndex < this.folds; foldIndex++) {
                System.out.println("- Starting fold " + (foldIndex + 1));
                //Split the data
                CrossValidationSplit<Segment> split = new CrossValidationSplit<Segment>();

                System.out.println("- Splitting out training set");
                SegmentSet trainingSegments = new SegmentSet();
                trainingSegments.setSegments(split.getTrainingForFold(segmentSet.getSegments(), foldIndex, this.folds));
                if (getBalancingImpl() != null) {
                    trainingSegments = getBalancingImpl().balance(trainingSegments);
                }

                System.out.println("- Extracting basic features from training set");
                ExampleSet basicTrainingExamples = trainingSegments.getBasicExamples();
                trainingSegments = null;

                FeatureGeneration generation = getFeatureGenerationImpl();
                System.out.println("- Generating features");
                FeatureSpecification spec = generation.generateFeatures(basicTrainingExamples);

                FeatureExtraction extraction = getFeatureExtractionImpl();
                System.out.println("- Extracting features from training set");
                ExampleSet trainingSet = extraction.extractFeatures(basicTrainingExamples, spec);
                basicTrainingExamples = null;

                Training training = getTrainingImpl();
                Model model = training.train(trainingSet);
                trainingSet = null;
               
                System.out.println("- Splitting out test set");
                SegmentSet testingSegments = new SegmentSet();
                testingSegments.setSegments(split.getTestingForFold(segmentSet.getSegments(), foldIndex, this.folds));
                if (getBalancingImpl() != null && balanceTestSet) {
                    testingSegments = getBalancingImpl().balance(testingSegments);
                }

                System.out.println("- Extracting basic features from test set");
                ExampleSet basicTestingExamples = testingSegments.getBasicExamples();

                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);
                report.addLabeledTestData(testingSegments);
               
                evaluationReport.addPartial(report);
                int numCorrect = report.getTrueNegativeCount() + report.getTruePositiveCount();
                System.out.println("- Fold " + (foldIndex + 1) + " completed (" + numCorrect + "/" + testingSet.size() + " correct).");
                System.out.println();
            }
        } else {
            System.out.println("== Skipping Cross Validation ==");
View Full Code Here

TOP

Related Classes of etc.aloe.data.EvaluationReport

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.