|
|||||||||
| 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
public class ScoredClassification
A ScoredClassification is a ranked classification
where each category also has a score that determines the ranking.
The category with the highest score is the value returned as the
best category. Thus if scores are costs or distances, then they
should be inverted before being used to rank results in a scored
classification.
Subclasses are available that interpret the scores as conditional or joint probabilities.
| Constructor Summary | |
|---|---|
ScoredClassification(String[] categories,
double[] scores)
Construct a scored classification from parallel arrays of categories and scores. |
|
| Method Summary | |
|---|---|
static ScoredClassification |
create(ScoredObject<String>[] categoryScores)
Factory method which returns a scored classification from the array of scored categories. |
double |
score(int rank)
Returns the score of the category with the specified rank in the classification. |
String |
toString()
Returns a string-based representation of this scored classification. |
| 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 ScoredClassification(String[] categories,
double[] scores)
Note that the categories and scores are merely saved in a scored classification, so that subsequent changes to the arrays will affect the contructed classification.
categories - Array of categories.scores - Array of scores.
IllegalArgumentException - If the category and score
arrays are of different lengths, or if a score later in the
array is larger than one earlier in the array.| Method Detail |
|---|
public static ScoredClassification create(ScoredObject<String>[] categoryScores)
categoryScores - Array of scored categories.
public double score(int rank)
i and i+1:
score(i) >= score(i+1).
rank - Rank of result category.
IllegalArgumentException - If the rank is out of range.public String toString()
toString in class RankedClassification
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||