edu.cmu.minorthird.classify.multi
Class MultiClassLabel

java.lang.Object
  extended by edu.cmu.minorthird.classify.multi.MultiClassLabel
All Implemented Interfaces:
java.io.Serializable

public class MultiClassLabel
extends java.lang.Object
implements java.io.Serializable

A label which is associated with an instance---either by a classifier, or in training data.

MultiClassLabels should be weighted to that the weight for a class name is (approximately) the log-odds having that class name, ie if the probability of class "POS" is p, the getWeight("POS") should return Math.log( p/(1-p) ). The POS and NEG class labels (as defined in ExampleSchema.POS_CLASS_NAME and ExampleSchema.NEG_CLASS_NAME) are special. Binary class labels should be created with the positiveLabel(posWeight) and negativeLabel(negWeight) routines, or else the binaryLabel routine. The numericLabel() returns +1 or -1 for binary classLabels. The posWeight() method returns the score of the positive class. The classLabel.numericLabel() method ignores the underlying score. For testing binary examples, classLabel.isPositive(), classLabel.isNegative(), and classLabel.bestWeight() should be used.

Author:
Cameron Williams
See Also:
Serialized Form

Constructor Summary
MultiClassLabel()
           
MultiClassLabel(ClassLabel[] labels)
           
 
Method Summary
 java.lang.String[] bestClassName()
          Returns the highest-ranking label.
 double[] bestWeight()
          Returns the weight of the highest-ranking label.
 ClassLabel[] getLabels()
           
 double[] getProbability(java.lang.String[] label)
          Returns the probability of a label.
 double[] getWeight(java.lang.String[] label)
          Returns the weight of the label.
 boolean[] isBinary()
          See if this is one of the distinguished binary labels.
 boolean isCorrect(MultiClassLabel otherLabel)
          Is this label correct, relative to another label?
 boolean[] isMultiCorrect(MultiClassLabel otherLabel)
          Is this label correct, relative to another label?
 boolean[] isNegative()
          See if this is the distinguished negative label.
 boolean[] isPositive()
          See if this is the distinguished positive label.
 int numDimensions()
          Return the number of dimensions in the multiLabel
 double[] numericLabel()
          Return a numeric score of +1, or -1 for a binary example
 double[] posProbability()
          Returns the probability of the positive class name
 java.util.Set<java.lang.String>[] possibleLabels()
          Returns the set of labels that appear in the ranking.
 double[] posWeight()
          Returns the weight of the positive class name
 java.lang.String toDetails()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultiClassLabel

public MultiClassLabel()

MultiClassLabel

public MultiClassLabel(ClassLabel[] labels)
Method Detail

getLabels

public ClassLabel[] getLabels()

numDimensions

public int numDimensions()
Return the number of dimensions in the multiLabel


isBinary

public boolean[] isBinary()
See if this is one of the distinguished binary labels.


isPositive

public boolean[] isPositive()
See if this is the distinguished positive label.


isNegative

public boolean[] isNegative()
See if this is the distinguished negative label.


numericLabel

public double[] numericLabel()
Return a numeric score of +1, or -1 for a binary example


bestClassName

public java.lang.String[] bestClassName()
Returns the highest-ranking label.


bestWeight

public double[] bestWeight()
Returns the weight of the highest-ranking label.


posWeight

public double[] posWeight()
Returns the weight of the positive class name


posProbability

public double[] posProbability()
Returns the probability of the positive class name


getWeight

public double[] getWeight(java.lang.String[] label)
Returns the weight of the label.


getProbability

public double[] getProbability(java.lang.String[] label)
Returns the probability of a label.


possibleLabels

public java.util.Set<java.lang.String>[] possibleLabels()
Returns the set of labels that appear in the ranking.


isMultiCorrect

public boolean[] isMultiCorrect(MultiClassLabel otherLabel)
Is this label correct, relative to another label?


isCorrect

public boolean isCorrect(MultiClassLabel otherLabel)
Is this label correct, relative to another label?


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toDetails

public java.lang.String toDetails()