se.lth.cs.nlp.nlputils.ml
Class BinaryNumericClassifier<T>

java.lang.Object
  extended by se.lth.cs.nlp.nlputils.ml.Classifier<T>
      extended by se.lth.cs.nlp.nlputils.ml.BinaryNumericClassifier<T>
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
BinaryLinearClassifier, BinaryQuadraticClassifier

public abstract class BinaryNumericClassifier<T>
extends Classifier<T>

Abstract class for binary numeric classifiers, such as classical linear or quadratic models.

Author:
Richard Johansson (richard@cs.lth.se)
See Also:
Serialized Form

Field Summary
protected  Object[] classes
          The range of output values.
protected  NumericEncoding encoding
          The numeric encoding that maps feature values to indices.
 
Fields inherited from class se.lth.cs.nlp.nlputils.ml.Classifier
extractor, list
 
Constructor Summary
BinaryNumericClassifier()
           
 
Method Summary
 double apply(FeatureList features)
          Auxiliary method that encodes the features and calls apply.
abstract  double apply(int[] featureIndices)
          Applies the discriminator function.
 Object classify(FeatureList features)
          Performs a classification given a feature list.
 
Methods inherited from class se.lth.cs.nlp.nlputils.ml.Classifier
classify, classifyRestricted, setFeatureExtractor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classes

protected Object[] classes
The range of output values. classes[0] is returned when apply returns a positive value. Should have a length of 2.


encoding

protected NumericEncoding encoding
The numeric encoding that maps feature values to indices.

Constructor Detail

BinaryNumericClassifier

public BinaryNumericClassifier()
Method Detail

apply

public abstract double apply(int[] featureIndices)
Applies the discriminator function.

Parameters:
featureIndices - the sorted array of feature indices.
Returns:
the value of the discriminator function.

apply

public double apply(FeatureList features)
Auxiliary method that encodes the features and calls apply.

Parameters:
features - the feature list to classify.
Returns:
the value of the discriminator function.

classify

public Object classify(FeatureList features)
Description copied from class: Classifier
Performs a classification given a feature list.

Specified by:
classify in class Classifier<T>
Parameters:
features - the feature list.
Returns:
the result of the classification.