14 using namespace shogun;
54 " CMKLMultiClass::CMKLMultiClass(const CMKLMultiClass & cm): must "
55 "not be called, glpk structure is currently not copyable");
61 " CMKLMultiClass CMKLMultiClass::operator=(...): must "
62 "not be called, glpk structure is currently not copyable");
71 SG_ERROR(
"CMKLMultiClass::initsvm(): the set labels is NULL\n");
83 SG_ERROR(
"CMKLMultiClass::initsvm(): the number of labels is "
84 "nonpositive, do not know how to handle this!\n");
94 SG_ERROR(
"CMKLMultiClass::initlpsolver(): the set kernel is NULL\n");
99 SG_ERROR(
"CMKLMultiClass::initlpsolver(): given kernel is not of type"
100 " K_COMBINED %d required by Multiclass Mkl \n",
130 numberofsilpiterations)
139 std::vector<float64_t> wold,wnew;
145 ASSERT (wold.size()==wnew.size());
152 for (
size_t i=0;i< wnew.size();++i)
154 delta+=(wold[i]-wnew[i])*(wold[i]-wnew[i]);
157 SG_SDEBUG(
"L1 Norm chosen, weight delta %f \n",delta);
164 for (
size_t i=0;i< wnew.size();++i)
175 SG_SDEBUG(
"L1 Norm chosen, MKL part of duality gap %f \n",delta);
176 if( (delta <
mkl_eps) && (numberofsilpiterations>=1) )
187 for (
size_t i=0;i< wnew.size();++i)
189 delta+=(wold[i]-wnew[i])*(wold[i]-wnew[i]);
192 SG_SDEBUG(
"Lp Norm chosen, weight delta %f \n",delta);
194 if( (delta <
mkl_eps) && (numberofsilpiterations>=1) )
216 std::copy(curweights.begin(),curweights.end(),weights);
233 for (int32_t ind=0; ind < numkernels; ++ind )
246 std::copy(lab.vector,lab.vector+lab.vlen, trainlabels2.begin());
249 ASSERT (trainlabels2.size()>0);
262 index_t basealphas_y = 0, basealphas_x = 0;
266 for (
size_t lb=0; lb< trainlabels2.size();++lb)
272 if ((
int)nc!=trainlabels2[lb])
280 sum+= -basealphas[lb*basealphas_y + nc]*(bia1-bia2-1);
311 tmp+=alphai*ker->
kernel(svindi,svindk)
334 SG_ERROR(
"Number of training vectors does not match number of "
346 ::std::vector<float64_t> curweights(numkernels,1.0/numkernels);
351 int32_t numberofsilpiterations=0;
362 ++numberofsilpiterations;
373 for (int32_t i=0; i<numcl; i++)
433 SG_ERROR(
"CMKLMultiClass::set_mkl_norm(float64_t norm) : parameter pnorm<1");