Package cc.mallet.types
Class IDSorter
- java.lang.Object
-
- cc.mallet.types.IDSorter
-
- All Implemented Interfaces:
java.lang.Comparable<IDSorter>
public class IDSorter extends java.lang.Object implements java.lang.Comparable<IDSorter>
This class is contains a comparator for use in sorting integers that have associated floating point values. One example would be sorting words by probability in a Naive Bayes model. Ties are broken by the ID.IDSorter[] sortedIDs = new IDSorter[n]; for (int i=0; i<n; i++) { sortedIDs[i] = new IDSorter(i, weights[i]); } Arrays.sort(sortedIDs); for (int i=0; i<10; i++) { // do something with the nth highest weighted item }
- Author:
- David Mimno
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(IDSorter o2)
int
getID()
double
getWeight()
void
set(int id, double p)
Reinitialize an IDSorter
-