Package etc.aloe.data

Examples of etc.aloe.data.SegmentSet


            segments.add(new Segment(false, null));
        }

        Collections.shuffle(segments);

        SegmentSet segmentSet = new SegmentSet();
        segmentSet.setSegments(segments);
        return segmentSet;
    }
View Full Code Here


        List<SegmentSet> segmentSets = generateTestSegments(10);
        for (SegmentSet segmentSet : segmentSets) {
            DownsampleBalancing instance = new DownsampleBalancing(1, 1);

            SegmentSet result = instance.balance(segmentSet);

            int actualTrue = result.getCountWithTrueLabel(true);
            int actualFalse = result.getCountWithTrueLabel(false);

            //Both are more than 0
            assertTrue(actualTrue > 0);
            assertTrue(actualFalse > 0);
View Full Code Here

     */
    @Test
    public void testBalance_withUnlabeled() {
        System.out.println("balance with unlabeled");

        SegmentSet segmentSet = generateTestSegments(20, 110);
        DownsampleBalancing instance = new DownsampleBalancing(1, 1);

        segmentSet.add(new Segment(null, null));
        try {
            SegmentSet result = instance.balance(segmentSet);
            assertTrue(false);
        } catch (IllegalArgumentException e) {
            assertTrue(true);
        }
    }
View Full Code Here

        List<SegmentSet> segmentSets = generateTestSegments(10);
        for (SegmentSet segmentSet : segmentSets) {
            DownsampleBalancing instance = new DownsampleBalancing(2, 1);

            SegmentSet result = instance.balance(segmentSet);

            int actualTrue = result.getCountWithTrueLabel(true);
            int actualFalse = result.getCountWithTrueLabel(false);

            //Both are more than 0
            assertTrue(actualTrue > 0);
            assertTrue(actualFalse > 0);
View Full Code Here

        List<SegmentSet> segmentSets = generateTestSegments(10);
        for (SegmentSet segmentSet : segmentSets) {
            DownsampleBalancing instance = new DownsampleBalancing(1, 2);

            SegmentSet result = instance.balance(segmentSet);

            int actualTrue = result.getCountWithTrueLabel(true);
            int actualFalse = result.getCountWithTrueLabel(false);

            //Both are more than 0
            assertTrue(actualTrue > 0);
            assertTrue(actualFalse > 0);
View Full Code Here

                    ":>",
                    ";)",
                    ";-)"
                });

        segments = new SegmentSet();

        Segment seg0 = new Segment();
        seg0.add(new Message(0, new Date(), "Alice", "it's"));
        seg0.add(new Message(1, new Date(), "Bob", "cow"));
        seg0.add(new Message(2, new Date(), "Alice", "time"));
View Full Code Here

            saveCommand(options.outputCommandFile);
           
            //Get and preprocess the data
            MessageSet messages = this.loadMessages(options.inputCSVFile);
            Segmentation segmentation = factory.constructSegmentation();
            SegmentSet segments = segmentation.segment(messages);

            //Set up a cross validation controller.
            CrossValidationController crossValidationController = new CrossValidationController();
            //Configure controller
            factory.configureCrossValidation(crossValidationController);

            //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;
                        SegmentSet testSet = testSets.get(i);
                        combined.addAll(testSet.getSegments());
                       
                        File outputFile = new File(options.outputTestsDir, fileName);
                       
                        saveMessages(testSet.getMessages(messages), outputFile);
                    }
                   
                    String fileName = FileNames.OUTPUT_TEST_DATA_COMBINED_NAME;
                    File outputFile = new File(options.outputTestsDir, fileName);
                    saveMessages(combined.getMessages(messages), outputFile);
View Full Code Here

            messages.add(message);

            //Make a segment for the message
            Segment segment = new Segment();
            segment.add(message);
            SegmentSet segmentSet = new SegmentSet();
            segmentSet.add(segment);

            LabelingController labelingController = new LabelingController();
            factory.configureLabeling(labelingController);

            FeatureSpecification spec = this.loadFeatureSpecification(options.inputFeatureSpecFile);
View Full Code Here

            //Process the input messages
            MessageSet messages = this.loadMessages(options.inputCSVFile);
            FeatureSpecification spec = this.loadFeatureSpecification(options.inputFeatureSpecFile);
            Model model = this.loadModel(options.inputModelFile);

            SegmentSet segments = segmentation.segment(messages);

            //Run the labeling process
            labelingController.setModel(model);
            labelingController.setSegmentSet(segments);
            labelingController.setFeatureSpecification(spec);
View Full Code Here

        rawMessages.add(new Message(7, new Date(), "Alice", "Hello7"));
        rawMessages.add(new Message(8, new Date(), "Alice", "Hello8"));
        rawMessages.add(new Message(9, new Date(), "Alice", "Hello9"));
        rawMessages.add(new Message(10, new Date(), "Alice", "Hello10"));

        this.segments = new SegmentSet();
        Segment seg = new Segment();
        seg.add(rawMessages.get(0));
        this.segments.add(seg);

        seg = new Segment();
View Full Code Here

TOP

Related Classes of etc.aloe.data.SegmentSet

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.