public class ScoredClassification extends RankedClassification
ScoredClassificationis 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|
Construct a scored classification from parallel arrays of categories and scores.
|Modifier and Type||Method and Description|
Factory method which returns a scored classification from the list of scored categories.
Returns the score of the category with the specified rank in the classification.
Returns a string-based representation of this scored classification.
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.
@Deprecated public static ScoredClassification create(ScoredObject<String> categoryScores)
categoryScores- Array of scored categories.
public static ScoredClassification create(List<ScoredObject<String>> categoryScores)
categoryScores- List of scored categories.
public double score(int rank)
score(i) >= score(i+1).
rank- Rank of result category.
IllegalArgumentException- If the rank is out of range.