public class RowComparator extends Object
k most-similar words to a provided
row in a Matrix. The comparisons required for generating the list
maybe be run in parallel by configuring an instance of this class to use
multiple threads. All instances of this class are thread-safe.
| Constructor and Description |
|---|
RowComparator()
Creates this
WordComparator with as many threads as processors. |
RowComparator(int numProcs)
Creates this
WordComparator with the specified number of threads. |
| Modifier and Type | Method and Description |
|---|---|
SortedMultiMap<Double,Integer> |
getMostSimilar(Matrix m,
int row,
int kNearestRows,
Similarity.SimType similarityType)
Compares the specified row to all other rows, returning the k-nearest
rows according to the similarity metric.
|
SortedMultiMap<Double,Integer> |
getMostSimilar(Matrix m,
int row,
int kNearestRows,
SimilarityFunction simFunction)
Compares the specified row to all other rows, returning the k-nearest
rows according to the similarity metric.
|
public RowComparator()
WordComparator with as many threads as processors.public RowComparator(int numProcs)
WordComparator with the specified number of threads.public SortedMultiMap<Double,Integer> getMostSimilar(Matrix m, int row, int kNearestRows, Similarity.SimType similarityType)
m - The Matrix containing data points to be comparedrow - The current row in m to be compared against all other
rowskNearestRows - The number of most similar rows to retainsimilarityType - The similarity method to use when comparing rowskNearestRows most
similar rowspublic SortedMultiMap<Double,Integer> getMostSimilar(Matrix m, int row, int kNearestRows, SimilarityFunction simFunction)
m - The Matrix containing data points to be comparedrow - The current row in m to be compared against all other
rowskNearestRows - The number of most similar rows to retainsimFunction - The SimilarityFunction to use when comparing
rowsCopyright © 2012. All Rights Reserved.