public abstract class Classifier extends Object implements Cloneable, Serializable
Modifier and Type | Field and Description |
---|---|
String |
containingPackage
The name of the package containing this classifier.
|
String |
name
The name of the classifier usually becomes the identifier of produced features.
|
Modifier | Constructor and Description |
---|---|
protected |
Classifier()
Does nothing.
|
protected |
Classifier(String n)
Initializing constructor.
|
Modifier and Type | Method and Description |
---|---|
String[] |
allowableValues()
Returns the array of allowable values that a feature returned by this classifier may take.
|
abstract FeatureVector |
classify(Object o)
This method makes one or more decisions about a single object, returning those decisions as
Feature s in a vector. |
FeatureVector[] |
classify(Object[] o)
Use this method to make a batch of classification decisions about several objects.
|
Object |
clone()
This method returns a shallow clone.
|
String |
discreteValue(Object o)
Returns the value of the discrete feature that would be returned by this classifier.
|
String[] |
discreteValueArray(Object o)
Returns the values of the discrete array of features that would be returned by this
classifier.
|
Feature |
featureValue(Object o)
Returns the classification of the given example object as a single feature instead of a
FeatureVector . |
LinkedList |
getCompositeChildren()
If this classifier is a composite generator, this method will be overridden such that it
returns all the classifiers it calls on in a list.
|
String |
getInputType()
Returns a string describing the input type of this classifier.
|
String |
getOutputType()
Returns a string describing the output feature type of this classifier.
|
double |
realValue(Object o)
Returns the value of the real feature that would be returned by this classifier.
|
double[] |
realValueArray(Object o)
Returns the values of the real array of features that would be returned by this classifier.
|
static double |
test(Classifier subject,
Classifier oracle,
Object[] o)
Measures the performance of a classifier as compared with the values produced by an oracle.
|
String |
toString()
Simply returns the name of the classifier.
|
short |
valueIndexOf(String value)
Locates the specified discrete feature value in the array of allowable values defined for
this classifier.
|
public String containingPackage
public String name
protected Classifier()
protected Classifier(String n)
n
- The name of the classifier, which can be fully qualified.public static double test(Classifier subject, Classifier oracle, Object[] o)
subject
- The classifier to test.oracle
- A classifier that produces the correct classifications.o
- The set of objects to test the subject on.public abstract FeatureVector classify(Object o)
Feature
s in a vector.o
- The object to make decisions about.Feature
s about the input object.public FeatureVector[] classify(Object[] o)
classify(Object)
repeatedly) and should be overridden if there is a more efficient implementation.o
- The objects to make decisions about.public String getInputType()
"java.lang.Object"This method should be overridden by derived classes.
public String getOutputType()
discrete
or real
) and square brackets or a
percent sign if the classifier returns an array or is a generator respectively, or simply
mixed%
. In the case that the basic type is discrete
, the curly
braces containing a list of allowable values should be omitted, as this list is provided by
the allowableValues()
method. The default return value of this method is: "discrete"This method should be overridden by derived classes.
public String[] allowableValues()
This method should be overridden by derived classes.
public short valueIndexOf(String value)
value
- The value to locate.public Feature featureValue(Object o)
FeatureVector
. By default, this method is implemented to simply throw an
UnsupportedOperationException
since some classifiers return zero or multiple
features at once.o
- The object to classify.o
as a feature.public String discreteValue(Object o)
o
- The object to classify.public double realValue(Object o)
o
- The object to classify.public String[] discreteValueArray(Object o)
o
- The object to classify.public double[] realValueArray(Object o)
o
- The object to classify.public LinkedList getCompositeChildren()
null
if this classifier is not a composite classifier.public String toString()
Copyright © 2016. All rights reserved.