Skip to content

Commit

Permalink
-added initialisation of mkl_block_norm to std value
Browse files Browse the repository at this point in the history
-added comment about strange set_sub_kernel_weights
-fixed a mem leak regarding this comment
  • Loading branch information
karlnapf committed Apr 14, 2012
1 parent 277ba68 commit 4711307
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/shogun/classifier/mkl/MKL.cpp
Expand Up @@ -18,10 +18,9 @@

using namespace shogun;

CMKL::CMKL(CSVM* s)
: CSVM(), svm(NULL), C_mkl(0), mkl_norm(1), ent_lambda(0), beta_local(NULL),
mkl_iterations(0), mkl_epsilon(1e-5), interleaved_optimization(true),
w_gap(1.0), rho(0)
CMKL::CMKL(CSVM* s) : CSVM(), svm(NULL), C_mkl(0), mkl_norm(1), ent_lambda(0),
mkl_block_norm(1),beta_local(NULL), mkl_iterations(0), mkl_epsilon(1e-5),
interleaved_optimization(true), w_gap(1.0), rho(0)
{
set_constraint_generator(s);
#ifdef USE_CPLEX
Expand Down Expand Up @@ -1489,6 +1488,9 @@ void CMKL::compute_sum_beta(float64_t* sumw)
for (int32_t n=0; n<num_kernels; n++)
{
beta[n]=1.0;
/* this currently only copies the value of the first entry of this array
* so it may be deleted safely afterwards. On the other hand: Is this
* really intended to be like this? Heiko Strathmann */
kernel->set_subkernel_weights(SGVector<float64_t>(beta, num_kernels));

for (int32_t i=0; i<nsv; i++)
Expand All @@ -1506,6 +1508,9 @@ void CMKL::compute_sum_beta(float64_t* sumw)

mkl_iterations++;
kernel->set_subkernel_weights(SGVector<float64_t>( (float64_t*) old_beta, num_kernels));

/* safe because of above comment, otherwise: memleak */
SG_FREE(beta);
}


Expand Down

0 comments on commit 4711307

Please sign in to comment.