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")
void set_epsilon(float64_t eps)
std::vector< float64_t > oldnormweightssquared
virtual bool init(CFeatures *lhs, CFeatures *rhs)
int32_t get_num_support_vectors()
virtual ~CMKLMulticlass()
double norm(double *v, double p, int n)
virtual ELabelType get_label_type() const =0
MKLMulticlass is a class for L1-norm Multiclass MKL.
void set_kernel(CKernel *k)
The class Labels models labels, i.e. class assignments of objects.
virtual int32_t get_num_labels() const =0
multi-class labels 0,1,...
MKLMulticlassGLPK is a helper class for MKLMulticlass.
virtual void set_mkl_norm(float64_t norm)
virtual int32_t get_num_vectors() const =0
float64_t * get_basealphas_ptr(index_t *y, index_t *x)
float64_t kernel(int32_t idx_a, int32_t idx_b)
void addingweightsstep(const std::vector< float64_t > &curweights)
virtual void set_mkl_norm(float64_t norm)
CMKLMulticlass operator=(const CMKLMulticlass &cm)
virtual bool evaluatefinishcriterion(const int32_t numberofsilpiterations)
Multiclass Labels for multi-class classification.
float64_t getsquarenormofprimalcoefficients(const int32_t ind)
void set_bias(float64_t bias)
virtual void setup(const int32_t numkernels2)
virtual void addconstraint(const ::std::vector< float64_t > &normw2, const float64_t sumofpositivealphas)
::std::vector< std::vector< float64_t > > weightshistory
bool set_alpha(int32_t idx, float64_t val)
float64_t getsumofsignfreealphas()
float64_t get_alpha(int32_t idx)
float64_t * getsubkernelweights(int32_t &numweights)
The Combined kernel is used to combine a number of kernels into a single CombinedKernel object by lin...
bool set_support_vector(int32_t idx, int32_t val)
int32_t get_support_vector(int32_t idx)
virtual void set_subkernel_weights(SGVector< float64_t > weights)
MKLMulticlassOptimizationBase * lpw
all of classes and functions are contained in the shogun namespace
virtual EKernelType get_kernel_type()=0
Class GMNPSVM implements a one vs. rest MultiClass SVM.
The class Features is the base class of all feature objects.
bool create_multiclass_svm(int32_t num_classes)
virtual bool train(CFeatures *data=NULL)
std::vector< float64_t > normweightssquared
void set_mkl_epsilon(float64_t eps)
A generic Support Vector Machine Interface.
multiclass one vs rest strategy used to train generic multiclass machines for K-class problems with b...
bool set_svm(int32_t num, CSVM *svm)
virtual bool train_machine(CFeatures *data=NULL)
virtual const char * get_name() const
virtual void set_labels(CLabels *lab)
CSVM * get_svm(int32_t num)
virtual void computeweights(std::vector< float64_t > &weights2)
void set_max_num_mkliters(int32_t maxnum)
MKLMulticlassGradient is a helper class for MKLMulticlass.
int32_t max_num_mkl_iters