Skip to content

Commit

Permalink
add debug messages in PrimalMosekSOSVM
Browse files Browse the repository at this point in the history
  • Loading branch information
iglesias committed Mar 19, 2013
1 parent 8f1cfdd commit 06df817
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/shogun/structure/PrimalMosekSOSVM.cpp
Expand Up @@ -43,12 +43,14 @@ CPrimalMosekSOSVM::~CPrimalMosekSOSVM()

bool CPrimalMosekSOSVM::train_machine(CFeatures* data)
{
SG_DEBUG("Entering CPrimalMosekSOSVM::train_machine.\n");
if (data)
set_features(data);

CFeatures* model_features = get_features();
// Check that the scenary is correct to start with training
m_model->check_training_setup();
SG_DEBUG("The training setup is correct.\n");

// Dimensionality of the joint feature space
int32_t M = m_model->get_dim();
Expand All @@ -59,6 +61,8 @@ bool CPrimalMosekSOSVM::train_machine(CFeatures* data)
// Number of training examples
int32_t N = m_model->get_features()->get_num_vectors();

SG_DEBUG("M=%d, N =%d, num_aux=%d, num_aux_con=%d.\n", M, N, num_aux, num_aux_con);

// Interface with MOSEK
CMosek* mosek = new CMosek(0, M+num_aux+N);
SG_REF(mosek);
Expand Down Expand Up @@ -117,14 +121,16 @@ bool CPrimalMosekSOSVM::train_machine(CFeatures* data)

do
{
SG_DEBUG("Cutting plane training with num_con=%d and old_num_con=%d.\n", num_con, old_num_con);

old_num_con = num_con;

for ( int32_t i = 0 ; i < N ; ++i )
{
// Predict the result of the ith training example
result = m_model->argmax(m_w, i);

//SG_PRINT("loss %f %f\n", compute_loss_arg(result), m_loss->loss( compute_loss_arg(result)) )
SG_DEBUG("loss %f %f.\n", compute_loss_arg(result), m_loss->loss( compute_loss_arg(result)) )
// Compute the loss associated with the prediction
slack = m_loss->loss( compute_loss_arg(result) );
cur_list = (CList*) results->get_element(i);
Expand Down Expand Up @@ -178,6 +184,8 @@ bool CPrimalMosekSOSVM::train_machine(CFeatures* data)
}

// Solve the QP
SG_DEBUG("Entering mosek QP solver.\n");

mosek->optimize(sol);
for ( int32_t i = 0 ; i < M+num_aux+N ; ++i )
{
Expand Down

0 comments on commit 06df817

Please sign in to comment.