mark.nlp.classifiers
Class HierarchyGenerating
java.lang.Object
|
+--mark.nlp.classifiers.HierarchicalClassifier
|
+--mark.nlp.classifiers.HierarchyGenerating
- All Implemented Interfaces:
- Classifier
- public class HierarchyGenerating
- extends HierarchicalClassifier
A classifier that generates a clustering of the categories and then does
a two-level hierarchical training and classifcation. HierarchyGenerating
first trains a classifier c_0. Using c_0, HierarchyGenerating generates a
confusion matrix for the training set. It then analyzes the confusion
matrix. It clusters categories together based on how often they are
confused. It next trains a new classifier, h_0, that can place an
instance into one of the clusters. For each cluster, it then trains an
additional "2nd level" classifier that can distinguish categories within
the cluster. At this point, Hierarchy generating has trained c_0, h_0, and
a 2nd level classifier for each cluster. It does not use c_0 again.
During classification, HierarchyGenerating first sends the instance trhough
h_0. Based on h_0's prediction, it then hands off the instance to one of
the 2nd level classifiers and returns the prediction of that second-level
classifier.
It is actually fairly easy to generate a hierarchy more than two levels.
For example, to achieve a three level classifier, make your second level
classifier another HierarchyGenerating. For that second
HierarchyGenerating, make the 2nd level classifier a WekaClassifier.
The parameter for this classifier is:
(
c0Classifier // c0's name
c0ClassifierParameter // c0's parameter
numClusters // the number of clusters
featureOrdererName0 // h0's orderer
featureOrdererParameter0 // h0's orderer parameter
numFeatures0 // h0's number of features
classifierName0 // h0's name
classifierParameter0 // h0's parameter
featureOrdererName1 // 2nd level orderer
featureOrdererParameter1 // 2nd level orderer parameter
numFeatures1 // 2nd level number of features
classifierName1 // 2nd level classifier name
classifierParameter1 // 2nd level classifier parameter
)
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HierarchyGenerating
public HierarchyGenerating()
genHierarchy
protected 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
- Specified by:
genHierarchy in class HierarchicalClassifier
java.lang.Exception