Skip to content

Commit

Permalink
Checks for multiclass svms
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed May 7, 2012
1 parent 545afa3 commit 3bae7fc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/shogun/multiclass/MulticlassLibLinear.cpp
Expand Up @@ -86,6 +86,10 @@ bool CMulticlassLibLinear::train_machine(CFeatures* data)
if (data)
set_features((CDotFeatures*)data);

ASSERT(m_features);
ASSERT(m_labels);
ASSERT(m_multiclass_strategy);

int32_t num_vectors = m_features->get_num_vectors();
int32_t num_classes = m_labels->get_num_classes();
int32_t bias_n = m_use_bias ? 1 : 0;
Expand Down
14 changes: 9 additions & 5 deletions src/shogun/multiclass/MulticlassOCAS.cpp
Expand Up @@ -52,11 +52,11 @@ CMulticlassOCAS::CMulticlassOCAS(float64_t C, CDotFeatures* train_features, CLab

void CMulticlassOCAS::register_parameters()
{
m_parameters->add(&m_C, "m_C", "regularization constant");
m_parameters->add(&m_epsilon, "m_epsilon", "solver relative tolerance");
m_parameters->add(&m_max_iter, "m_max_iter", "max number of iterations");
m_parameters->add(&m_method, "m_method", "used solver method");
m_parameters->add(&m_buf_size, "m_buf_size", "buffer size");
SG_ADD(&m_C, "m_C", "regularization constant", MS_AVAILABLE);
SG_ADD(&m_epsilon, "m_epsilon", "solver relative tolerance", MS_NOT_AVAILABLE);
SG_ADD(&m_max_iter, "m_max_iter", "max number of iterations", MS_NOT_AVAILABLE);
SG_ADD(&m_method, "m_method", "used solver method", MS_NOT_AVAILABLE);
SG_ADD(&m_buf_size, "m_buf_size", "buffer size", MS_NOT_AVAILABLE);
}

CMulticlassOCAS::~CMulticlassOCAS()
Expand All @@ -68,6 +68,10 @@ bool CMulticlassOCAS::train_machine(CFeatures* data)
if (data)
set_features((CDotFeatures*)data);

ASSERT(m_features);
ASSERT(m_labels);
ASSERT(m_multiclass_strategy);

int32_t num_vectors = m_features->get_num_vectors();
int32_t num_classes = m_multiclass_strategy->get_num_classes();
int32_t num_features = m_features->get_dim_feature_space();
Expand Down

0 comments on commit 3bae7fc

Please sign in to comment.