|
|||||||||
| 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
public class ConditionalClassification
A ConditionalClassification is a scored classification
which estimates conditional probabilities of categories given an
input. By default, the scores are the conditional probabilities;
if the scores are different than the conditional probabilities,
they must be in the same order. Both score and conditional
probability are tracked independently by the evaluators. The
method conditionalProbability(int) returns the conditional
probability based on rank while the superclass method ScoredClassification.score(int) returns the score by rank.
The conditional probabilities must sum to one over the set of categories:
Σrank<size()
score(rank) = 1.0
The constructors check that this criterion is satisfied to
within a specified arithmetic tolerance. The convenience method
Statistics.normalize(double[]) may be used
to normalize an array of probability ratios so that they will be an
acceptable input to this constructor, but note the warning in that
method's documentation concerning arithmetic precision.
| Constructor Summary | |
|---|---|
ConditionalClassification(String[] categories,
double[] conditionalProbs)
Construct a conditional classification with the specified categories and conditional probabilities which sum to one within the default tolerance of 0.01. |
|
ConditionalClassification(String[] categories,
double[] conditionalProbs,
double tolerance)
Construct a conditional classification with the specified categories and conditional probabilities whose probabilities sum to one within the specified tolerance. |
|
ConditionalClassification(String[] categories,
double[] scores,
double[] conditionalProbs)
Construct a conditional classification with the specified categories, scores and conditional probabilities which sum to one within the default tolerance of 0.01. |
|
ConditionalClassification(String[] categories,
double[] scores,
double[] conditionalProbs,
double tolerance)
Construct a conditional classification with the specified categories and conditional probabilities whose probabilities sum to one within the specified tolerance. |
|
| Method Summary | |
|---|---|
double |
conditionalProbability(int rank)
Returns the conditional probability estimate for the category at the specified rank. |
String |
toString()
Returns a string-based representation of this conditional probability ranked classification. |
| Methods inherited from class com.aliasi.classify.ScoredClassification |
|---|
create, score |
| 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 ConditionalClassification(String[] categories,
double[] conditionalProbs)
0.01. The
conditional probabilities are used as the scores.
categories - Categories assigned by classification.conditionalProbs - Conditional probabilities of the
categories.
IllegalArgumentException - If the category and
probability arrays are of different lengths, if the
probabilities or scores are not in descending order, if any
probability is less than zero or greater than one, or if their
sum is not 1.0 plus or minus 0.01.
public ConditionalClassification(String[] categories,
double[] scores,
double[] conditionalProbs)
0.01. The
scores and conditional probs must be of the same length as the
categories and in descending numerical order.
categories - Categories assigned by classification.scores - Scores of the categories.conditionalProbs - Conditional probabilities of the
categories.
IllegalArgumentException - If the category and
probability arrays are of different lengths, if the
probabilities or scores are not in descending order, if any
probability is less than zero or greater than one, or if their
sum is not 1.0 plus or minus 0.01.
public ConditionalClassification(String[] categories,
double[] conditionalProbs,
double tolerance)
Double.POSITIVE_INFINITY, there is
effectively no consistency requirement placed on the
conditional probabilities.
categories - Categories assigned by classification.conditionalProbs - Conditional probabilities of the
categories.tolerance - Tolerance within which the conditional probabilities
must sum to one.
IllegalArgumentException - If the category and
probability arrays are of different lengths, if the probabilities
are not in descending order, if any probability is less than
zero or greater than one, or if their sum is not 1.0 plus or
minus the tolerance, or if the tolerance is not a positive number.
public ConditionalClassification(String[] categories,
double[] scores,
double[] conditionalProbs,
double tolerance)
Double.POSITIVE_INFINITY, there is
effectively no consistency requirement placed on the
conditional probabilities.
categories - Categories assigned by classification.scores - Scores of the categories.conditionalProbs - Conditional probabilities of the
categories.tolerance - Tolerance within which the conditional probabilities
must sum to one.
IllegalArgumentException - If the category and
probability or score arrays are of different lengths, if the
probabilities or scores are not in descending order, if any
probability is less than zero or greater than one, or if their
sum is not 1.0 plus or minus the tolerance, or if the tolerance
is not a positive number.| Method Detail |
|---|
public double conditionalProbability(int rank)
ScoredClassification.score(int).
rank - Rank of category.
IllegalArgumentException - If the rank is out of range.public String toString()
toString in class ScoredClassification
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||