mark.nlp.classifiers
Class HierarchicalClassifier

java.lang.Object
  |
  +--mark.nlp.classifiers.HierarchicalClassifier
All Implemented Interfaces:
Classifier
Direct Known Subclasses:
ErrorCorrecting, HierarchyGenerating

public abstract class HierarchicalClassifier
extends java.lang.Object
implements Classifier

A base class for classifiers that classify in two steps, first through a root classifier and then through a child classifier.


Field Summary
protected  mark.nlp.classifiers.Node fC0
           
protected  mark.nlp.classifiers.Node[] fChildren
           
protected  mark.nlp.classifiers.Node fHC
           
protected  int fNumCats
           
 
Constructor Summary
HierarchicalClassifier()
           
 
Method Summary
 int classify(java.lang.Object instanceInformation)
          Classifies a single instance as returned from mark.nlp.classifiers.InstanceFactory.
protected abstract  mark.nlp.classifiers.Node genHierarchy(ObjectMap vocabulary, mark.nlp.classifiers.Node confusionClassifier, SimpleResults trainResults, FileCategorySet catSet, SparseBagInstance[] trainSparseBagInstances, java.lang.Object parameters)
           
protected static mark.nlp.classifiers.Node genSubsetNode(FileCategorySet catSet, ObjectMap vocabulary, SparseBagInstance[] trainSparseBagInstances, java.lang.String featureOrdererName, java.lang.String featureOrdererParameter, int numFeatures, java.lang.String classifierName, java.lang.Object classifierParameter, int[] catsToDistinguish)
           
 java.lang.String instanceFactoryName()
          Returns the name of the instance factory that can generate instance information suitable for this classifier.
 Results test(java.lang.Object instanceListInformation)
          Tests the classifier on the given set of instances and returns results.
 Results test(java.lang.Object instanceListInformation, java.lang.String testIdentifier)
          Tests the classifier on the given set of instances and returns results.
 void train(java.lang.Object dataSetInformation, java.lang.Object instanceListInformation, java.lang.Object parameter)
          Trains the classifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fC0

protected mark.nlp.classifiers.Node fC0

fHC

protected mark.nlp.classifiers.Node fHC

fNumCats

protected int fNumCats

fChildren

protected mark.nlp.classifiers.Node[] fChildren
Constructor Detail

HierarchicalClassifier

public HierarchicalClassifier()
Method Detail

genSubsetNode

protected static mark.nlp.classifiers.Node genSubsetNode(FileCategorySet catSet,
                                                         ObjectMap vocabulary,
                                                         SparseBagInstance[] trainSparseBagInstances,
                                                         java.lang.String featureOrdererName,
                                                         java.lang.String featureOrdererParameter,
                                                         int numFeatures,
                                                         java.lang.String classifierName,
                                                         java.lang.Object classifierParameter,
                                                         int[] catsToDistinguish)
                                                  throws java.lang.Exception
java.lang.Exception

train

public void train(java.lang.Object dataSetInformation,
                  java.lang.Object instanceListInformation,
                  java.lang.Object parameter)
           throws java.lang.Exception
Description copied from interface: Classifier
Trains the classifier.

Specified by:
train in interface Classifier
Parameters:
dataSetInformation - the information returned from mark.nlp.classifiers.InstanceFactory common to all instances in the data set.
parameter - the classifier parameter which different classifiers interpret differently. A classifier may ignore this parameter.
java.lang.Exception

test

public Results test(java.lang.Object instanceListInformation)
             throws java.lang.Exception
Description copied from interface: Classifier
Tests the classifier on the given set of instances and returns results. The classifier must have been trained.

Specified by:
test in interface Classifier
Parameters:
instanceListInformation - the information returned from mark.nlp.classifiers.InstanceFactory specific to the list of instances on which we wish to test.
Returns:
claissification results.
java.lang.Exception

test

public Results test(java.lang.Object instanceListInformation,
                    java.lang.String testIdentifier)
             throws java.lang.Exception
Description copied from interface: Classifier
Tests the classifier on the given set of instances and returns results. The classifier must have been trained.

Specified by:
test in interface Classifier
Parameters:
instanceListInformation - the information returned from mark.nlp.classifiers.InstanceFactory specific to the list of instances on which we wish to test.
testIdentifier - A label included in the printed Results of the classifier.
Returns:
classification results.
java.lang.Exception

classify

public int classify(java.lang.Object instanceInformation)
             throws java.lang.Exception
Description copied from interface: Classifier
Classifies a single instance as returned from mark.nlp.classifiers.InstanceFactory. The classifier must have been trained.

Specified by:
classify in interface Classifier
Parameters:
instanceInformation - the information specific to the instance we wish to classify.
Returns:
the predicted category.
java.lang.Exception

instanceFactoryName

public java.lang.String instanceFactoryName()
Description copied from interface: Classifier
Returns the name of the instance factory that can generate instance information suitable for this classifier.

Specified by:
instanceFactoryName in interface Classifier
Returns:
the name.

genHierarchy

protected abstract mark.nlp.classifiers.Node genHierarchy(ObjectMap vocabulary,
                                                          mark.nlp.classifiers.Node confusionClassifier,
                                                          SimpleResults trainResults,
                                                          FileCategorySet catSet,
                                                          SparseBagInstance[] trainSparseBagInstances,
                                                          java.lang.Object parameters)
                                                   throws java.lang.Exception
java.lang.Exception