Package cc.mallet.classify
Class BalancedWinnow
- java.lang.Object
-
- cc.mallet.classify.Classifier
-
- 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
Constructors Constructor Description BalancedWinnow(Pipe dataPipe, double[][] weights)
Passes along data pipe and weights fromBalancedWinnowTrainer
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Classification
classify(Instance instance)
Classifies an instance using BalancedWinnow's weightsdouble[][]
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
-
-
-
-
Constructor Detail
-
BalancedWinnow
public BalancedWinnow(Pipe dataPipe, double[][] weights)
Passes along data pipe and weights fromBalancedWinnowTrainer
- Parameters:
dataPipe
- needed for dictionary, labels, feature vectors, etcweights
- 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 weightsReturns 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 classClassifier
-
-