public class ScoredClassification extends RankedClassification
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 and Description |
|---|
ScoredClassification(String[] categories,
double[] scores)
Construct a scored classification from parallel arrays of
categories and scores.
|
| Modifier and Type | Method and Description |
|---|---|
static ScoredClassification |
create(List<ScoredObject<String>> categoryScores)
Factory method which returns a scored classification from the
list of scored categories.
|
static ScoredClassification |
create(ScoredObject<String>[] categoryScores)
Deprecated.
Use
create(List) instead. |
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.
|
category, sizebestCategorypublic 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.@Deprecated public static ScoredClassification create(ScoredObject<String>[] categoryScores)
create(List) instead.categoryScores - Array of scored categories.public static ScoredClassification create(List<ScoredObject<String>> categoryScores)
categoryScores - List 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 RankedClassificationCopyright © 2019 Alias-i, Inc.. All rights reserved.