|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.aliasi.classify.Classification
com.aliasi.classify.RankedClassification
com.aliasi.classify.ScoredClassification
com.aliasi.classify.ConditionalClassification
com.aliasi.classify.JointClassification
public class JointClassification
A JointClassification is a conditional classification
derived from a joint probability assignment to each category and
the object being classified. The conditional probabilities are
computed from the joint probabilities, but an additional score may
be provided for ordering. These scores must be ordered in the same
way as the joint probabilities. For example, the language model
classifiers implement the score as an entropy rate to allow
between-document comparisons.
In addition to the score and conditional probability methods,
this interface adds a method to retrieve joint log (base 2)
probability by rank, jointLog2Probability(int).
The conditional probability estimate of the category given the input is derived from the joint probability of category and input:
P(category|input) = P(category,input) / P(input)
where the joint probability P(category,input) is
determined by the joint probability estimate and the input
probability P(input) is estimated by marginalization:
P(input)
= Σcategory
P(category,input)
Warning: The result of marginalization is the same as
that of Statistics.normalize(double[])
applied to the joint probabilities. The same warning carries over
here: if the largest joint probability is more than
252 times larger than the next
largest, the largest will round off to one and all others will
round off to zero due to underflow.
| Constructor Summary | |
|---|---|
JointClassification(String[] categories,
double[] log2JointProbs)
Construct a joint classification with the specified parallel arrays of categories and log (base 2) joint probabilities of category and input object. |
|
JointClassification(String[] categories,
double[] scores,
double[] log2JointProbs)
Construct a joint classification with the specified parallel arrays of categories and log (base 2) joint probabilities of category and input object. |
|
| Method Summary | |
|---|---|
double |
jointLog2Probability(int rank)
Returns the log (base 2) probability of the category at the specified rank. |
double |
score(int rank)
Returns the cross-entropy rate of the category and text at the specified rank. |
String |
toString()
Returns a string-based representation of this joint probability ranked classification. |
| Methods inherited from class com.aliasi.classify.ConditionalClassification |
|---|
conditionalProbability |
| Methods inherited from class com.aliasi.classify.ScoredClassification |
|---|
create |
| Methods inherited from class com.aliasi.classify.RankedClassification |
|---|
category, size |
| Methods inherited from class com.aliasi.classify.Classification |
|---|
bestCategory |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JointClassification(String[] categories,
double[] log2JointProbs)
Double.NEGATIVE_INFINITY, which is a legal input
to this constructor.
categories - Array of categories.log2JointProbs - Log (base 2) joint probabilities of
categories, in descending numerical order.
IllegalArgumentException - If any of the log joint
probabilities is not zero or negative, or if they are not
in descending order.
public JointClassification(String[] categories,
double[] scores,
double[] log2JointProbs)
Double.NEGATIVE_INFINITY, which is a legal input
to this constructor.
categories - Array of categories.scores - Scores of categories, in descending numerical
order.log2JointProbs - Log (base 2) joint probabilities of
categories, in descending numerical order.
IllegalArgumentException - If any of the log joint
probabilities is not zero or negative, or if they are not
in descending order.| Method Detail |
|---|
public double jointLog2Probability(int rank)
score(int).
rank - Rank of result.
public double score(int rank)
The cross-entropy rate of the category and text is defined differently than the cross-entropy of the text. For the combination, we divide the log (base 2) probability of the text plus the log (base 2) probability of the category by the length of the text plus 1. This non-standard definition ensures that the cross-entropy ordering remains the same as the joint probability ordering.
score in class ScoredClassificationrank - Rank of result category.
public String toString()
toString in class ConditionalClassification
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||