19 using namespace shogun;
59 " CMKLMulticlass::CMKLMulticlass(const CMKLMulticlass & cm): must "
60 "not be called, glpk structure is currently not copyable");
66 " CMKLMulticlass CMKLMulticlass::operator=(...): must "
67 "not be called, glpk structure is currently not copyable");
76 SG_ERROR(
"CMKLMulticlass::initsvm(): the set labels is NULL\n")
88 SG_ERROR(
"CMKLMulticlass::initsvm(): the number of labels is "
89 "nonpositive, do not know how to handle this!\n");
99 SG_ERROR(
"CMKLMulticlass::initlpsolver(): the set kernel is NULL\n")
104 SG_ERROR(
"CMKLMulticlass::initlpsolver(): given kernel is not of type"
105 " K_COMBINED %d required by Multiclass Mkl \n",
135 numberofsilpiterations)
142 std::vector<float64_t> wold,wnew;
148 ASSERT (wold.size()==wnew.size())
159 for (
size_t i=0;i< wnew.size();++i)
170 SG_SINFO(
"L1 Norm chosen, MKL part of duality gap %f \n",delta)
171 if( (delta <
mkl_eps) && (numberofsilpiterations>=1) )
184 for (
size_t i=0;i< wnew.size();++i)
186 delta+=(wold[i]-wnew[i])*(wold[i]-wnew[i]);
192 delta=1-deltanew/deltaold;
196 SG_SWARNING(
"CMKLMulticlass::evaluatefinishcriterion(...): deltanew<=0.Switching back to weight norsm difference as criterion.\n")
199 SG_SINFO(
"weight delta %f \n",delta)
201 if( (delta <
mkl_eps) && (numberofsilpiterations>=1) )
224 std::copy(curweights.begin(),curweights.end(),weights.vector);
243 for (int32_t ind=0; ind < numkernels; ++ind )
256 std::copy(lab.vector,lab.vector+lab.vlen, trainlabels2.begin());
258 ASSERT (trainlabels2.size()>0)
271 index_t basealphas_y = 0, basealphas_x = 0;
275 for (
size_t lb=0; lb< trainlabels2.size();++lb)
281 if ((
int)nc!=trainlabels2[lb])
289 sum+= -basealphas[lb*basealphas_y + nc]*(bia1-bia2-1);
320 tmp+=alphai*ker->
kernel(svindi,svindk)
346 SG_ERROR(
"%s::train_machine(): Number of training vectors (%d) does"
347 " not match number of labels (%d)\n",
get_name(),
360 ::std::vector<float64_t> curweights(numkernels,1.0/numkernels);
368 int32_t numberofsilpiterations=0;
386 ++numberofsilpiterations;
396 for (int32_t i=0; i<numcl; i++)
456 SG_ERROR(
"CMKLMulticlass::set_mkl_norm(float64_t norm) : parameter pnorm<1")