Skip to content

Commit

Permalink
+ helper function to obtain MulticlassLabels from Labels, - previous …
Browse files Browse the repository at this point in the history
…constructor
  • Loading branch information
iglesias committed May 21, 2012
1 parent 5f02a4a commit 89a638e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/shogun/labels/MulticlassLabels.cpp
Expand Up @@ -21,9 +21,12 @@ CMulticlassLabels::CMulticlassLabels(CFile* loader) : CDenseLabels(loader)
{
}

CMulticlassLabels::CMulticlassLabels(CLabels* const base_labels) : CDenseLabels()
CMulticlassLabels* CMulticlassLabels::obtain_from_generic(CLabels* base_labels)
{
m_labels = ((CMulticlassLabels*) base_labels)->m_labels;
if ( base_labels->get_label_type() == LT_MULTICLASS )
return (CMulticlassLabels*) base_labels;
else
SG_ERROR("base_labels must be of dynamic type CMulticlassLabels");
}

bool CMulticlassLabels::is_valid()
Expand Down
6 changes: 3 additions & 3 deletions src/shogun/labels/MulticlassLabels.h
Expand Up @@ -54,11 +54,11 @@ class CMulticlassLabels : public CDenseLabels
*/
CMulticlassLabels(CFile* loader);

/** constructor (can be used to downcast CLabels)
/** helper method used to specialize a base class instance
*
* @param labs its dynamic type must be CMulticlassLabels
* @param base_labels its dynamic type must be CMulticlassLabels
*/
CMulticlassLabels(CLabels* const base_labels);
CMulticlassLabels* obtain_from_generic(CLabels* base_labels);

/** is_valid checks if labeling is a multi-class labeling
*
Expand Down

0 comments on commit 89a638e

Please sign in to comment.