Skip to content

Commit

Permalink
added parameter mapping for new serialisable parameter which currentl…
Browse files Browse the repository at this point in the history
…y maps from 0 to 1
  • Loading branch information
karlnapf committed Mar 14, 2013
1 parent 68e1b97 commit 25b9613
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/shogun/labels/MulticlassLabels.cpp
@@ -1,6 +1,7 @@
#include <shogun/labels/DenseLabels.h>
#include <shogun/labels/BinaryLabels.h>
#include <shogun/labels/MulticlassLabels.h>
#include <shogun/base/ParameterMap.h>

using namespace shogun;

Expand Down Expand Up @@ -34,10 +35,18 @@ void CMulticlassLabels::init()
SG_ADD(&m_multiclass_confidences, "multiclass_confidences", "Vectors of "
"multiclass confidences", MS_NOT_AVAILABLE);

/* new parameter from param version 0 to 1 */
m_parameter_map->put(
new SGParamInfo("multiclass_confidences", CT_SGMATRIX, ST_NONE, PT_FLOAT64, 1),
new SGParamInfo()
);
m_parameter_map->finalize_map();

m_multiclass_confidences=SGMatrix<float64_t>();
}

void CMulticlassLabels::set_multiclass_confidences(int32_t i, SGVector<float64_t> confidences)
void CMulticlassLabels::set_multiclass_confidences(int32_t i,
SGVector<float64_t> confidences)
{
REQUIRE(confidences.size()==m_multiclass_confidences.num_rows,
"%s::set_multiclass_confidences(): Length of confidences should "
Expand Down Expand Up @@ -70,7 +79,7 @@ CMulticlassLabels* CMulticlassLabels::obtain_from_generic(CLabels* base_labels)
if (!base_labels)
return NULL;

if(base_labels->get_label_type()!=LT_MULTICLASS)
if (base_labels->get_label_type()!=LT_MULTICLASS)
{
SG_SERROR("CMulticlassLabels::base_labels is of wrong type \"%s\"!\n",
base_labels->get_name());
Expand Down

0 comments on commit 25b9613

Please sign in to comment.