Revert to semantics mandated by "ClusterRanking" (higher is better).
This commit is contained in:
parent
af5ad16a06
commit
484b0e740a
|
@ -29,8 +29,8 @@ public interface ClusterEvaluator {
|
||||||
/**
|
/**
|
||||||
* @param a Score computed by this evaluator.
|
* @param a Score computed by this evaluator.
|
||||||
* @param b Score computed by this evaluator.
|
* @param b Score computed by this evaluator.
|
||||||
* @return true if the evaluator considers score {@code a} is
|
* @return {@code true} if the evaluator considers that score
|
||||||
* considered better than score {@code b}.
|
* {@code a} is better than score {@code b}.
|
||||||
*/
|
*/
|
||||||
boolean isBetterScore(double a, double b);
|
boolean isBetterScore(double a, double b);
|
||||||
|
|
||||||
|
@ -42,9 +42,8 @@ public interface ClusterEvaluator {
|
||||||
* @return a ranking function.
|
* @return a ranking function.
|
||||||
*/
|
*/
|
||||||
static <T extends Clusterable> ClusterRanking ranking(ClusterEvaluator eval) {
|
static <T extends Clusterable> ClusterRanking ranking(ClusterEvaluator eval) {
|
||||||
return clusters -> {
|
return eval.isBetterScore(1, 2) ?
|
||||||
double score = eval.score(clusters);
|
clusters -> 1 / eval.score(clusters) :
|
||||||
return eval.isBetterScore(1, 2) ? score : 1 / score;
|
clusters -> eval.score(clusters);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue