61 " CMKLMulticlass::CMKLMulticlass(const CMKLMulticlass & cm): must "
62 "not be called, glpk structure is currently not copyable");
68 " CMKLMulticlass CMKLMulticlass::operator=(...): must "
69 "not be called, glpk structure is currently not copyable");
78 SG_ERROR(
"CMKLMulticlass::initsvm(): the set labels is NULL\n")
90 SG_ERROR(
"CMKLMulticlass::initsvm(): the number of labels is "
91 "nonpositive, do not know how to handle this!\n");
101 SG_ERROR(
"CMKLMulticlass::initlpsolver(): the set kernel is NULL\n")
106 SG_ERROR(
"CMKLMulticlass::initlpsolver(): given kernel is not of type"
107 " K_COMBINED %d required by Multiclass Mkl \n",
137 numberofsilpiterations)
144 std::vector<float64_t> wold,wnew;
150 ASSERT (wold.size()==wnew.size())
161 for (
size_t i=0;i< wnew.size();++i)
172 SG_SINFO(
"L1 Norm chosen, MKL part of duality gap %f \n",delta)
173 if( (delta <
mkl_eps) && (numberofsilpiterations>=1) )
186 for (
size_t i=0;i< wnew.size();++i)
188 delta+=(wold[i]-wnew[i])*(wold[i]-wnew[i]);
194 delta=1-deltanew/deltaold;
198 SG_SWARNING(
"CMKLMulticlass::evaluatefinishcriterion(...): deltanew<=0.Switching back to weight norsm difference as criterion.\n")
201 SG_SINFO(
"weight delta %f \n",delta)
203 if( (delta <
mkl_eps) && (numberofsilpiterations>=1) )
226 std::copy(curweights.begin(),curweights.end(),weights.vector);
245 for (int32_t ind=0; ind < numkernels; ++ind )
258 std::copy(lab.vector,lab.vector+lab.vlen, trainlabels2.begin());
260 ASSERT (trainlabels2.size()>0)
273 index_t basealphas_y = 0, basealphas_x = 0;
277 for (
size_t lb=0; lb< trainlabels2.size();++lb)
283 if ((
int)nc!=trainlabels2[lb])
291 sum+= -basealphas[lb*basealphas_y + nc]*(bia1-bia2-1);
322 tmp+=alphai*ker->
kernel(svindi,svindk)
348 SG_ERROR(
"%s::train_machine(): Number of training vectors (%d) does"
349 " not match number of labels (%d)\n",
get_name(),
362 ::std::vector<float64_t> curweights(numkernels,1.0/numkernels);
370 int32_t numberofsilpiterations=0;
388 ++numberofsilpiterations;
398 for (int32_t i=0; i<numcl; i++)
458 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