cc.mallet.classify
Class BalancedWinnow

java.lang.Object
  extended by cc.mallet.classify.Classifier
      extended by cc.mallet.classify.BalancedWinnow
All Implemented Interfaces:
AlphabetCarrying, java.io.Serializable

public class BalancedWinnow
extends Classifier
implements java.io.Serializable

Classification methods of BalancedWinnow algorithm.

Author:
Gary Huang ghuang@cs.umass.edu
See Also:
BalancedWinnowTrainer, Serialized Form

Field Summary
 
Fields inherited from class cc.mallet.classify.Classifier
instancePipe
 
Constructor Summary
BalancedWinnow(Pipe dataPipe, double[][] weights)
          Passes along data pipe and weights from BalancedWinnowTrainer
 
Method Summary
 Classification classify(Instance instance)
          Classifies an instance using BalancedWinnow's weights
 double[][] getWeights()
           
 
Methods inherited from class cc.mallet.classify.Classifier
alphabetsMatch, classify, classify, classify, getAccuracy, getAlphabet, getAlphabets, getAverageRank, getF1, getF1, getF1, getFeatureSelection, getInstancePipe, getLabelAlphabet, getPerClassFeatureSelection, getPrecision, getPrecision, getPrecision, getRecall, getRecall, getRecall, print, print
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BalancedWinnow

public BalancedWinnow(Pipe dataPipe,
                      double[][] weights)
Passes along data pipe and weights from BalancedWinnowTrainer

Parameters:
dataPipe - needed for dictionary, labels, feature vectors, etc
weights - weights calculated during training phase
Method Detail

getWeights

public double[][] getWeights()
Returns:
a copy of the weight vectors

classify

public Classification classify(Instance instance)
Classifies an instance using BalancedWinnow's weights

Returns a Classification containing the normalized dot products between class weight vectors and the instance feature vector.

One can obtain the confidence of the classification by calculating weight(j')/weight(j), where j' is the highest weight prediction and j is the 2nd-highest. Another possibility is to calculate

e^{dot(w_j', x} / sum_j[e^{dot(w_j, x)}]

Specified by:
classify in class Classifier