Skip to content

Commit

Permalink
Reverse order of KNN results.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBerdik committed Apr 27, 2023
1 parent 7c95d80 commit 13a14c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/com/jgaap/classifiers/KNearestNeighborDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public List<Pair<String, Double>> analyze(Document unknown) throws AnalyzeExcept
}

List<Pair<String, Double>> results = ballot.getResults();
Comparator<Pair<String, Double>> compareByScore = (Pair<String, Double> r1, Pair<String, Double> r2) -> r1.getSecond().compareTo(r2.getSecond());
Comparator<Pair<String, Double>> compareByScore = (Pair<String, Double> r1, Pair<String, Double> r2) -> r2.getSecond().compareTo(r1.getSecond());
Collections.sort(results, compareByScore);

return results;
Expand Down

0 comments on commit 13a14c8

Please sign in to comment.