diva.sketch.classification
Class RubineClassifier

java.lang.Object
  extended by diva.sketch.classification.RubineClassifier
All Implemented Interfaces:
Classifier, TrainableClassifier

public class RubineClassifier
extends Object
implements TrainableClassifier

This classifier implements the classic linear discriminator. More information can be obtained from Rubine's paper.

Version:
$Revision: 1.5 $
Author:
Heloise Hse (hwawen@eecs.berkeley.edu)

Constructor Summary
RubineClassifier()
           
 
Method Summary
 Classification classify(FeatureSet fs)
          Return a classification for the specified feature set, or throw a runtime exception if the feature set that is given does not have the same number of features as the training set that it was trained on.
 Classification classify2(FeatureSet fs)
          Return a classification for the specified feature set, or throw a runtime exception if the feature set that is given does not have the same number of features as the training set that it was trained on.
 void clear()
          Clear all results of previous trainings (presumably so that this classifier can be trained again from scratch).
 boolean isIncremental()
          Return whether this classifier is incremental, i.e.
static void main(String[] argv)
           
static double myInvert(double[][] ym, double[][] rm)
          A new invert routine taken directly from Amulet's gest_matrix.cc (where it's called InvertMatrix).
static double quadraticForm(double[] v, double[][] m)
           
 void train(TrainingSet tset)
          Train the classifier with a given training set and produce a weight vector per training class (a weight for each feature, _weights[]).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RubineClassifier

public RubineClassifier()
Method Detail

main

public static void main(String[] argv)

classify2

public Classification classify2(FeatureSet fs)
                         throws ClassifierException
Return a classification for the specified feature set, or throw a runtime exception if the feature set that is given does not have the same number of features as the training set that it was trained on.

Throws:
ClassifierException

classify

public Classification classify(FeatureSet fs)
                        throws ClassifierException
Description copied from interface: Classifier
Return a classification for the specified feature set, or throw a runtime exception if the feature set that is given does not have the same number of features as the training set that it was trained on.

Specified by:
classify in interface Classifier
Throws:
ClassifierException

clear

public void clear()
Clear all results of previous trainings (presumably so that this classifier can be trained again from scratch).

Specified by:
clear in interface TrainableClassifier

isIncremental

public boolean isIncremental()
Return whether this classifier is incremental, i.e. whether this classifier can support multiple calls to "train".

Specified by:
isIncremental in interface TrainableClassifier

train

public void train(TrainingSet tset)
           throws ClassifierException
Train the classifier with a given training set and produce a weight vector per training class (a weight for each feature, _weights[]). It is assumed that all training classes use the same set of features. Also a normalizing constant for each class is computed as well (_constants[]). This method throws a ClassifierException if the training set is not self consisistent, i.e. the feature sets that it contains do not have the same number of features in them. An if matrix inversion fails due to singular matrix.

Specified by:
train in interface TrainableClassifier
Throws:
ClassifierException

myInvert

public static double myInvert(double[][] ym,
                              double[][] rm)
A new invert routine taken directly from Amulet's gest_matrix.cc (where it's called InvertMatrix). Their comment is Matrix inversion using full pivoting. The standard Gauss-Jordan method is used. The return value is the determinant. The input matrix may be the same as the result matrix det = InvertMatrix(inputmatrix, resultmatrix); HISTORY 26-Feb-82 David Smith (drs) at Carnegie-Mellon University Written. Sun Mar 20 19:36:16 EST 1988 - stolen by dandb, and converted to this form


quadraticForm

public static double quadraticForm(double[] v,
                                   double[][] m)


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.