Skip to content

Commit

Permalink
Check if num mixture models is greater than num samples. Fixes irllab…
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Bullock committed Feb 17, 2019
1 parent b7e0141 commit e92e7a4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion sources/classification/ml_gmm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,22 @@ namespace ml

// Virtual method override
virtual const std::string get_object_name(void) const { return object_name; };
void train() override;


GRT::GMM grt_gmm;
};

void gmm::train()
{
if (grt_gmm.getNumMixtureModels() > classification_data.getNumSamples())
{
flext::error("num added examples must be greater than num_mixture_models, add more examples to train");
return;
}
classification::train();
}

// Flext attribute setters
void gmm::set_num_mixture_models(int num_mixture_models)
{
Expand All @@ -78,7 +90,7 @@ namespace ml
// Flext attribute getters
void gmm::get_num_mixture_models(int &num_mixture_models) const
{
flext::error("function not implemented");
num_mixture_models = grt_gmm.getNumMixtureModels();
}

// Implement pure virtual methods
Expand Down

0 comments on commit e92e7a4

Please sign in to comment.