Skip to content

Commit

Permalink
Fixed bug in predict
Browse files Browse the repository at this point in the history
  • Loading branch information
daenuprobst committed Dec 22, 2019
1 parent 052e946 commit 115d4b3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tmap/tmap/lshforest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ tmap::LSHForest::Predict(std::vector<std::vector<uint32_t>>& vecs,
#pragma omp parallel for
for (size_t i = 0; i < vecs.size(); i++) {
auto nn = QueryLinearScan(vecs[i], k, kc);

std::sort(nn.begin(), nn.end(), [this](auto &left, auto &right) {
return labels_[left.second] < labels_[right.second];
});
Expand All @@ -141,12 +142,14 @@ tmap::LSHForest::Predict(std::vector<std::vector<uint32_t>>& vecs,


for (size_t j = 1; j < nn.size(); j++) {
if (labels_[nn[j].second] == labels_[nn[j-1].second]) {
if (labels_[nn[j].second] == labels_[nn[j-1].second]) {
count++;
if (count > max_count) {
max_count = count;
max_element = labels_[nn[j].second];
}
} else {
count = 1;
}
}

Expand Down

0 comments on commit 115d4b3

Please sign in to comment.