16 using namespace shogun;
56 " CMKLMulticlass::CMKLMulticlass(const CMKLMulticlass & cm): must "
57 "not be called, glpk structure is currently not copyable");
63 " CMKLMulticlass CMKLMulticlass::operator=(...): must "
64 "not be called, glpk structure is currently not copyable");
73 SG_ERROR(
"CMKLMulticlass::initsvm(): the set labels is NULL\n");
85 SG_ERROR(
"CMKLMulticlass::initsvm(): the number of labels is "
86 "nonpositive, do not know how to handle this!\n");
96 SG_ERROR(
"CMKLMulticlass::initlpsolver(): the set kernel is NULL\n");
101 SG_ERROR(
"CMKLMulticlass::initlpsolver(): given kernel is not of type"
102 " K_COMBINED %d required by Multiclass Mkl \n",
132 numberofsilpiterations)
141 std::vector<float64_t> wold,wnew;
147 ASSERT (wold.size()==wnew.size());
154 for (
size_t i=0;i< wnew.size();++i)
156 delta+=(wold[i]-wnew[i])*(wold[i]-wnew[i]);
159 SG_SDEBUG(
"L1 Norm chosen, weight delta %f \n",delta);
166 for (
size_t i=0;i< wnew.size();++i)
177 SG_SDEBUG(
"L1 Norm chosen, MKL part of duality gap %f \n",delta);
178 if( (delta <
mkl_eps) && (numberofsilpiterations>=1) )
189 for (
size_t i=0;i< wnew.size();++i)
191 delta+=(wold[i]-wnew[i])*(wold[i]-wnew[i]);
194 SG_SDEBUG(
"Lp Norm chosen, weight delta %f \n",delta);
196 if( (delta <
mkl_eps) && (numberofsilpiterations>=1) )
217 std::copy(curweights.begin(),curweights.end(),weights.vector);
232 for (int32_t ind=0; ind < numkernels; ++ind )
244 std::copy(lab.vector,lab.vector+lab.vlen, trainlabels2.begin());
246 ASSERT (trainlabels2.size()>0);
259 index_t basealphas_y = 0, basealphas_x = 0;
263 for (
size_t lb=0; lb< trainlabels2.size();++lb)
269 if ((
int)nc!=trainlabels2[lb])
277 sum+= -basealphas[lb*basealphas_y + nc]*(bia1-bia2-1);
308 tmp+=alphai*ker->
kernel(svindi,svindk)
333 SG_ERROR(
"%s::train_machine(): Number of training vectors (%d) does"
334 " not match number of labels (%d)\n",
get_name(),
347 ::std::vector<float64_t> curweights(numkernels,1.0/numkernels);
352 int32_t numberofsilpiterations=0;
363 ++numberofsilpiterations;
374 for (int32_t i=0; i<numcl; i++)
434 SG_ERROR(
"CMKLMulticlass::set_mkl_norm(float64_t norm) : parameter pnorm<1");