Search in sources :

Example 1 with ExampleSchema

use of edu.cmu.minorthird.classify.ExampleSchema in project lucida by claritylab.

the class HierarchicalClassifierLearner method setSchema.

public void setSchema(ExampleSchema schema) {
    String[] labelNames = schema.validClassNames();
    for (int i = 0; i < labelNames.length; i++) {
        for (int j = 0; j < prototypes.length; j++) {
            String prefix = getLabelPrefix(labelNames[i], j);
            if (!classifierLearners.containsKey(prefix)) {
                System.out.println("Making new schema and learner for " + prefix);
                ExampleSchema subSchema = createSubSchema(schema, prefix, j);
                ClassifierLearner newLearner;
                if (subSchema.getNumberOfClasses() == 1) {
                    System.out.println("Only 1 class to learn for " + prefix + "; using DummyClassifier and Learner");
                    newLearner = new DummyClassifierLearner(subSchema.getClassName(0));
                } else {
                    newLearner = prototypes[j].copy();
                    newLearner.setSchema(subSchema);
                }
                classifierLearners.put(prefix, newLearner);
            }
        }
    }
}
Also used : ClassifierLearner(edu.cmu.minorthird.classify.ClassifierLearner) ExampleSchema(edu.cmu.minorthird.classify.ExampleSchema)

Aggregations

ClassifierLearner (edu.cmu.minorthird.classify.ClassifierLearner)1 ExampleSchema (edu.cmu.minorthird.classify.ExampleSchema)1