Package etc.aloe.cscw2013

Examples of etc.aloe.cscw2013.LabelMappingImpl


        if (options instanceof TrainOptionsImpl) {
            TrainOptionsImpl trainOpts = (TrainOptionsImpl) options;
            if (trainOpts.useDownsampling) {
                return new DownsampleBalancing(trainOpts.falsePositiveCost, trainOpts.falseNegativeCost);
            } else if (trainOpts.useUpsampling) {
                return new UpsampleBalancing(trainOpts.falsePositiveCost, trainOpts.falseNegativeCost);
            } else {
                return null;
            }
        } else {
            throw new IllegalArgumentException("Options must be for Training");
View Full Code Here


    public void testSave() throws Exception {
        System.out.println("save");

        J48 classifier = new J48();
        classifier.setNumFolds(456);
        WekaModel model = new WekaModel(classifier);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        assertTrue(model.save(out));
        out.close();
        byte[] serializedStr = out.toByteArray();

        //It wrote something
        assertTrue(serializedStr.length > 0);
View Full Code Here

        serializer.writeObject(serializedClassifier);
        out.close();
        byte[] serializedStr = out.toByteArray();

        ByteArrayInputStream in = new ByteArrayInputStream(serializedStr);
        WekaModel model = new WekaModel();
        assertTrue(model.load(in));
        in.close();

        Classifier classifier = model.getClassifier();
        assertTrue(classifier instanceof J48);
        J48 j48 = (J48) classifier;
        assertEquals(serializedClassifier.getNumFolds(), j48.getNumFolds());
    }
View Full Code Here

            classifier.buildClassifier(instances);
        } catch (Exception e) {
            assertTrue("Classifier could not be trained", false);
        }

        WekaModel instance = new WekaModel(classifier);

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

        try {
            System.out.print("Training on " + examples.size() + " examples... ");
            classifier.buildClassifier(examples.getInstances());
            System.out.println("done.");

            WekaModel model = new WekaModel(classifier);
            return model;
        } catch (Exception ex) {
            System.err.println("Unable to train classifier.");
            System.err.println("\t" + ex.getMessage());
            return null;
View Full Code Here

        return null;
    }

    @Override
    public Model constructModel() {
        return new WekaModel();
    }
View Full Code Here

TOP

Related Classes of etc.aloe.cscw2013.LabelMappingImpl

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.