|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.cmu.minorthird.classify.ClassLabel
public class ClassLabel
A label which is associated with an instance---either by a classifier, or in training data.
ClassLabels 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.
Constructor Summary | |
---|---|
ClassLabel()
|
|
ClassLabel(java.lang.String label)
|
|
ClassLabel(java.lang.String label,
double weight)
|
Method Summary | |
---|---|
void |
add(java.lang.String label,
double weight)
Add a label with the given weight to this ClassLabel. |
java.lang.String |
bestClassName()
Returns the highest-ranking label. |
double |
bestWeight()
Returns the weight of the highest-ranking label. |
static ClassLabel |
binaryLabel(double score)
Create a binary label, either positive or negative, as appropriate, with the associated score (in logits). |
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(ClassLabel otherLabel)
Is this label correct, relative to another label? |
boolean |
isCorrect(double otherLabel)
Is this label correct, relative to a numeric label? |
boolean |
isNegative()
See if this is the distinguished negative label. |
boolean |
isPositive()
See if this is the distinguished positive label. |
static ClassLabel |
multiLabel(java.lang.String name,
double score)
Create a binary label, either positive or negative, as appropriate, with the associated score (in logits). |
static ClassLabel |
multiNegLabel(java.lang.String label,
double score)
Create a positive binary label, with the associated score (in logits). |
static ClassLabel |
multiPosLabel(java.lang.String label,
double score)
Create a positive binary label, with the associated score (in logits). |
static ClassLabel |
negativeLabel(double score)
Create a negative binary label, with the associated score (in logits). |
double |
numericLabel()
Return a numeric score of +1, or -1 for a binary example |
static ClassLabel |
positiveLabel(double score)
Create a positive binary label, with the associated score (in logits). |
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 |
---|
public ClassLabel()
public ClassLabel(java.lang.String label)
public ClassLabel(java.lang.String label, double weight)
Method Detail |
---|
public static ClassLabel multiPosLabel(java.lang.String label, double score)
public static ClassLabel multiNegLabel(java.lang.String label, double score)
public static ClassLabel multiLabel(java.lang.String name, double score)
public static ClassLabel positiveLabel(double score)
public static ClassLabel negativeLabel(double score)
public static ClassLabel binaryLabel(double score)
public boolean isBinary()
public boolean isPositive()
public boolean isNegative()
public double numericLabel()
public java.lang.String bestClassName()
public double bestWeight()
public double posWeight()
public double posProbability()
public double getWeight(java.lang.String label)
public double getProbability(java.lang.String label)
public java.util.Set<java.lang.String> possibleLabels()
public boolean isCorrect(ClassLabel otherLabel)
public boolean isCorrect(double otherLabel)
public void add(java.lang.String label, double weight)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toDetails()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |