Skip to content

Commit

Permalink
Fixes for PluginEstimate
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed May 22, 2012
1 parent 32ce04d commit 3f690ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions src/shogun/classifier/PluginEstimate.cpp
Expand Up @@ -96,7 +96,7 @@ bool CPluginEstimate::train_machine(CFeatures* data)
return true;
}

CLabels* CPluginEstimate::apply(CFeatures* data)
CBinaryLabels* CPluginEstimate::apply_binary(CFeatures* data)
{
if (data)
{
Expand All @@ -110,13 +110,12 @@ CLabels* CPluginEstimate::apply(CFeatures* data)
}

ASSERT(features);
CRegressionLabels* result=new CRegressionLabels(features->get_num_vectors());
ASSERT(result->get_num_labels()==features->get_num_vectors());
SGVector<float64_t> result(features->get_num_vectors());

for (int32_t vec=0; vec<features->get_num_vectors(); vec++)
result->set_label(vec, apply_one(vec));
result[vec] = apply_one(vec);

return result;
return new CBinaryLabels(result);
}

float64_t CPluginEstimate::apply_one(int32_t vec_idx)
Expand Down
4 changes: 2 additions & 2 deletions src/shogun/classifier/PluginEstimate.h
Expand Up @@ -13,7 +13,7 @@

#include <shogun/machine/Machine.h>
#include <shogun/features/StringFeatures.h>
#include <shogun/labels/Labels.h>
#include <shogun/labels/BinaryLabels.h>
#include <shogun/distributions/LinearHMM.h>

namespace shogun
Expand Down Expand Up @@ -48,7 +48,7 @@ class CPluginEstimate: public CMachine
* @param data (test)data to be classified
* @return classified labels
*/
virtual CLabels* apply(CFeatures* data=NULL);
virtual CBinaryLabels* apply_binary(CFeatures* data=NULL);

/** set features
*
Expand Down

0 comments on commit 3f690ca

Please sign in to comment.