Skip to content

Commit

Permalink
gmm::get_cluster: range check is needed
Browse files Browse the repository at this point in the history
  • Loading branch information
KUMAZAKI Hiroki committed Feb 25, 2014
1 parent 6b0fdf7 commit a9fb91b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion jubatus/core/clustering/gmm_clustering_method.cpp
Expand Up @@ -60,10 +60,13 @@ common::sfv_t gmm_clustering_method::get_nearest_center(
wplist gmm_clustering_method::get_cluster(
size_t cluster_id,
const wplist& points) const {
if (k_ <= cluster_id) {
return wplist();
}
return get_clusters(points)[cluster_id];
}

std::vector<wplist> gmm_clustering_method::get_clusters(
vector<wplist> gmm_clustering_method::get_clusters(
const wplist& points) const {
std::vector<wplist> ret(k_);
for (wplist::const_iterator it = points.begin(); it != points.end(); ++it) {
Expand Down

0 comments on commit a9fb91b

Please sign in to comment.