Skip to content

Commit

Permalink
Added CSignal handling to MulticlassLibLinear
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Jun 18, 2012
1 parent 9a1b7ae commit 4ce3514
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/shogun/lib/external/shogun_liblinear.cpp
Expand Up @@ -43,6 +43,7 @@
#include <shogun/lib/external/shogun_liblinear.h>
#include <shogun/lib/external/tron.h>
#include <shogun/lib/Time.h>
#include <shogun/lib/Signal.h>

using namespace shogun;

Expand Down Expand Up @@ -513,7 +514,7 @@ void Solver_MCSVM_CS::solve()
state->inited = true;
}

while(iter < max_iter)
while(iter < max_iter && !CSignal::cancel_computations())
{
double stopping = -CMath::INFTY;
for(i=0;i<active_size;i++)
Expand Down
3 changes: 3 additions & 0 deletions src/shogun/multiclass/MulticlassLibLinear.cpp
Expand Up @@ -14,6 +14,7 @@
#include <shogun/multiclass/MulticlassOneVsRestStrategy.h>
#include <shogun/mathematics/Math.h>
#include <shogun/lib/v_array.h>
#include <shogun/lib/Signal.h>
#include <shogun/labels/MulticlassLabels.h>

using namespace shogun;
Expand Down Expand Up @@ -121,6 +122,8 @@ bool CMulticlassLibLinear::train_machine(CFeatures* data)
for (int32_t i=0; i<num_vectors; i++)
C[i] = m_C;

CSignal::clear_cancel();

Solver_MCSVM_CS solver(&mc_problem,num_classes,C,w0.matrix,m_epsilon,
m_max_iter,m_max_train_time,m_train_state);
solver.solve();
Expand Down

0 comments on commit 4ce3514

Please sign in to comment.