Skip to content

Commit

Permalink
Added assertion on feature type, removed store_model_features
Browse files Browse the repository at this point in the history
  • Loading branch information
ptillet committed Apr 15, 2012
1 parent 3255541 commit 0dc55d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
13 changes: 7 additions & 6 deletions src/shogun/classifier/NearestCentroid.cpp
Expand Up @@ -8,6 +8,10 @@
*/

#include <shogun/classifier/NearestCentroid.h>
#include <shogun/features/Features.h>
#include <shogun/features/FeatureTypes.h>



namespace shogun{

Expand Down Expand Up @@ -37,20 +41,15 @@ namespace shogun{
{
m_shrinking=0;
m_is_trained=false;
set_store_model_features(true);
m_centroids = new CSimpleFeatures<float64_t>();
}

void CNearestCentroid::store_model_features()
{
distance->init(m_centroids,distance->get_rhs());
}

bool CNearestCentroid::train_machine(CFeatures* data)
{
ASSERT(m_labels);
ASSERT(distance);

ASSERT( data->get_feature_class() == C_SIMPLE)
if (data)
{
if (m_labels->get_num_labels() != data->get_num_vectors())
Expand Down Expand Up @@ -107,7 +106,9 @@ namespace shogun{
m_centroids->free_feature_matrix();
m_centroids->set_feature_matrix(centroids,num_feats,num_classes);


m_is_trained=true;
distance->init(m_centroids,distance->get_rhs());

delete [] num_per_class;

Expand Down
1 change: 0 additions & 1 deletion src/shogun/classifier/NearestCentroid.h
Expand Up @@ -88,7 +88,6 @@ class CNearestCentroid : public CDistanceMachine{
*
* Sets centroids as lhs
*/
virtual void store_model_features();

private:
void init();
Expand Down

0 comments on commit 0dc55d2

Please sign in to comment.