com.sjm.machlearn.classifiers
Class Classifier

java.lang.Object
  |
  +--com.sjm.machlearn.util.MainClass
        |
        +--com.sjm.machlearn.classifiers.Classifier
Direct Known Subclasses:
BPNeuralNet, C5_0, KNN, LVQ, NaiveBayes, SvmLite

public abstract class Classifier
extends MainClass

Classifier.java : defines the functions needed for a classifier and operations that are contigent on those functions.

Version:
0.1a April 2003
Author:
Sean McIlwain
See Also:
homepage

Field Summary
static int Fold10Validation
          CONSTANTS
static int JackKnifeValidation
           
static int Random10Validation
           
 
Fields inherited from class com.sjm.machlearn.util.MainClass
debug, debug_level, debug_listeners
 
Constructor Summary
Classifier()
           
 
Method Summary
abstract  Feature classify(Example example)
           
abstract  Classifier cloneClassifier()
           
 void doTune(DataSet trainingData, java.lang.Object[] parameters, int tuneMethod)
           
 void generateROCCurve(DataSet trainset, DataSet testset, java.lang.String filename)
          generateROCCurve() creates an ROC curve for the trainset and testset.
 double getAccuracy(DataSet testData)
          getAccuracy() : get the accuracy on the dataset
 Example[][] getBothCat(DataSet testdata)
          getBothCat() get the correctly predicted examples and the misclassified predicted examples for the returned matrix : [0][n] is the misclassified examples.
 double getExampleWeight(Example e)
          getExampleWeight() : Returns the weight of an example for the class 0.
 Example[] getMisCat(DataSet testdata)
          getMisCat() : gets the misclassified examples
abstract  java.lang.String printClassifier()
           
abstract  void setParameter(int i, java.lang.Object par)
           
abstract  void train(DataSet trainingData)
           
 
Methods inherited from class com.sjm.machlearn.util.MainClass
_internalError, _internalError, addDebugListener, debugMesg, debugMesg, debugMesg, debugMesg, debugMesg, debugMesg, debugOff, debugOn, internalError, internalError, setDebug, setDebugLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Fold10Validation

public static final int Fold10Validation
CONSTANTS

Random10Validation

public static final int Random10Validation

JackKnifeValidation

public static final int JackKnifeValidation
Constructor Detail

Classifier

public Classifier()
Method Detail

train

public abstract void train(DataSet trainingData)
                    throws java.lang.Exception

classify

public abstract Feature classify(Example example)

printClassifier

public abstract java.lang.String printClassifier()

cloneClassifier

public abstract Classifier cloneClassifier()

setParameter

public abstract void setParameter(int i,
                                  java.lang.Object par)

doTune

public void doTune(DataSet trainingData,
                   java.lang.Object[] parameters,
                   int tuneMethod)
            throws java.lang.Exception

getAccuracy

public double getAccuracy(DataSet testData)
getAccuracy() : get the accuracy on the dataset

getBothCat

public Example[][] getBothCat(DataSet testdata)
getBothCat() get the correctly predicted examples and the misclassified predicted examples for the returned matrix : [0][n] is the misclassified examples. [1][n] is the correctly classified examples.
Parameters:
testdata - dataset to be tested by the classifier.
Returns:
[0][n] - miscat [1][n] - corcat.

getMisCat

public Example[] getMisCat(DataSet testdata)
getMisCat() : gets the misclassified examples
Parameters:
testdata - dataset to be tested
Returns:
examples that are misclassified.

getExampleWeight

public double getExampleWeight(Example e)
getExampleWeight() : Returns the weight of an example for the class 0. Used for ROC curves. Will be overidden.

generateROCCurve

public void generateROCCurve(DataSet trainset,
                             DataSet testset,
                             java.lang.String filename)
                      throws java.lang.Exception
generateROCCurve() creates an ROC curve for the trainset and testset.