Skip to content

Commit

Permalink
Fix histogram calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
kdm9 committed Dec 7, 2015
1 parent a5fb86e commit c0ff123
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/entvec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,15 @@ sample_entvec_sum(khmer::CountingHash &sample)
float bin_entropy = _bin_entropies[tab][bin];
if (tab == 0) {
count_sum += counts[tab][bin];
histogram[counts[tab][bin]] += 1;
}
countentvec_sum += counts[tab][bin] * bin_entropy;
}
entvecsums.push_back(countentvec_sum);
}
for (const auto &pair: histogram) {
double fraction = (double)pair.second / _tablesizes[0];
entropy += -(fraction * log2(fraction));
entropy -= fraction * log2(fraction);
}
return std::make_tuple(count_sum, kwip::vec_min(entvecsums), entropy);
}
Expand Down

0 comments on commit c0ff123

Please sign in to comment.