Package etc.aloe.data

Examples of etc.aloe.data.FeatureSpecification


    @Test
    public void testGenerateFeatures() {
        System.out.println("generateFeatures");

        FeatureGenerationImpl generation = new FeatureGenerationImpl(termList);
        FeatureSpecification spec = generation.generateFeatures(basicExamples);

        assertNotNull(spec);
        assertTrue(spec.getFilters().size() > 0);

        for (Filter filter : spec.getFilters()) {
            assertTrue(filter.isOutputFormatDefined());
            assertTrue(filter.isFirstBatchDone());

            try {
                basicExamples.setInstances(Filter.useFilter(basicExamples.getInstances(), filter));
View Full Code Here


            trainingController.run();

            //Get the fruits of our labors
            System.out.println("== Saving Output ==");

            FeatureSpecification spec = trainingController.getFeatureSpecification();
            Model model = trainingController.getModel();
            List<String> topFeatures = trainingController.getTopFeatures();
            List<Map.Entry<String, Double>> featureWeights = trainingController.getFeatureWeights();

            saveFeatureSpecification(spec, options.outputFeatureSpecFile);
View Full Code Here

            segmentSet.add(segment);

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

            FeatureSpecification spec = this.loadFeatureSpecification(options.inputFeatureSpecFile);
            Model model = this.loadModel(options.inputModelFile);

            labelingController.setModel(model);
            labelingController.setFeatureSpecification(spec);
            labelingController.setSegmentSet(segmentSet);
View Full Code Here

            //Provide implementations of the needed processes
            factory.configureLabeling(labelingController);

            //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
View Full Code Here

        }
        return model;
    }

    protected FeatureSpecification loadFeatureSpecification(File inputFeatureSpecFile) {
        FeatureSpecification spec = new FeatureSpecification();

        try {
            System.out.println("Reading feature spec from " + inputFeatureSpecFile);
            InputStream inputFeatureSpec = new FileInputStream(inputFeatureSpecFile);
            spec.load(inputFeatureSpec);
            inputFeatureSpec.close();
        } catch (FileNotFoundException e) {
            System.err.println("Feature specification file " + inputFeatureSpecFile + " not found.");
            System.exit(1);
        } catch (InvalidObjectException e) {
View Full Code Here

                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;
View Full Code Here

            removeFilter.setInputFormat(addFilter.getOutputFormat());
        } catch (Exception e) {
            assertTrue(e.getMessage(), false);
        }

        FeatureSpecification spec = new FeatureSpecification();
        spec.addFilter(addFilter);
        spec.addFilter(removeFilter);

        FeatureExtractionImpl instance = new FeatureExtractionImpl();
        ExampleSet examples = instance.extractFeatures(segments.getBasicExamples(), spec);
        assertNotNull(examples);
        assertNotNull(examples.getInstances());
View Full Code Here

            //Provide implementations for the controller
            interactiveController.setFeatureExtractionImpl(factory.constructFeatureExtraction());
            interactiveController.setMappingImpl(factory.constructLabelMapping());

            FeatureSpecification spec = this.loadFeatureSpecification(options.inputFeatureSpecFile);
            Model model = this.loadModel(options.inputModelFile);

            interactiveController.setModel(model);
            interactiveController.setFeatureSpecification(spec);
            interactiveController.run();
View Full Code Here

   
    @Override
    public FeatureSpecification generateFeatures(ExampleSet basicExamples) {

        ExampleSet examples = basicExamples.copy();
        FeatureSpecification spec = new FeatureSpecification();

        System.out.print("Configuring features over " + examples.size() + " examples... ");

        try {
            spec.addFilter(getPronounsFilter(examples));
            spec.addFilter(getPunctuationFilter(examples));
            spec.addFilter(getSpecialWordsFilter(examples));
            spec.addFilter(getSpellingFilter(examples));

            spec.addFilter(getEmoticonsFilter(examples));
            spec.addFilter(getBagOfWordsFilter(examples));
           
            if (this.getParticipantFeatureCount() > 0) {
                spec.addFilter(getParticipantsFilter(examples));
            } else {
                spec.addFilter(getRemoveParticipantFilter(examples));
            }
           
            spec.addFilter(getRemoveIDFilter(examples));
            //spec.addFilter(getSparseToNonsparseFilter(examples));
            //spec.addFilter(getFeatureSelectionFilter(examples));
           
            Instances output = spec.getOutputFormat();
            int numAttrs = output.numAttributes();
            System.out.println("generated " + (numAttrs - 1) + " features.");
        } catch (Exception e) {
            System.err.println("Error generating features.");
            System.err.println("\t" + e.getMessage());
View Full Code Here

   
    @Override
    public FeatureSpecification generateFeatures(ExampleSet basicExamples) {

        ExampleSet examples = basicExamples.copy();
        FeatureSpecification spec = new FeatureSpecification();

        System.out.print("Configuring features over " + examples.size() + " examples... ");

        try {
            spec.addFilter(getPronounsFilter(examples));
            spec.addFilter(getPunctuationFilter(examples));
            spec.addFilter(getSpecialWordsFilter(examples));
            spec.addFilter(getSpellingFilter(examples));

            spec.addFilter(getEmoticonsFilter(examples));
            spec.addFilter(getUnigramBigramFilter(examples));
            spec.addFilter(getParticipantsFilter(examples));
            spec.addFilter(getRemoveIDFilter(examples));
            spec.addFilter(getRemoveMessageFilter(examples));
            //spec.addFilter(getSparseToNonsparseFilter(examples));
            //spec.addFilter(getFeatureSelectionFilter(examples));
           
            Instances output = spec.getOutputFormat();
            int numAttrs = output.numAttributes();
            System.out.println("generated " + (numAttrs - 1) + " features.");
        } catch (Exception e) {
            System.err.println("Error generating features.");
            System.err.println("\t" + e.getMessage());
View Full Code Here

TOP

Related Classes of etc.aloe.data.FeatureSpecification

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.