MKLMultiClass.h

Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Written (W) 2009 Alexander Binder
00008  * Copyright (C) 2009 Fraunhofer Institute FIRST and Max-Planck-Society
00009  */
00010 
00011 #ifndef MKLMULTICLASS_H_
00012 #define MKLMULTICLASS_H_
00013 
00014 #include <vector>
00015 
00016 #include "base/SGObject.h"
00017 #include "kernel/Kernel.h"  
00018 #include "kernel/CombinedKernel.h" 
00019 #include "classifier/svm/GMNPSVM.h"
00020 #include "classifier/mkl/MKLMultiClassGLPK.h"
00021 #include "classifier/mkl/MKLMultiClassGradient.h"
00022 
00023 
00024 namespace shogun
00025 {
00032 class CMKLMultiClass : public CMultiClassSVM
00033 {
00034 public:
00038     CMKLMultiClass();
00044     CMKLMultiClass(float64_t C, CKernel* k, CLabels* lab);
00045 
00046 
00050     virtual ~CMKLMultiClass();
00051 
00060     virtual bool train(CFeatures* data=NULL);
00061 
00066     virtual inline EClassifierType get_classifier_type()
00067         { return CT_MKLMULTICLASS; }
00068     
00069 
00078     float64_t* getsubkernelweights(int32_t & numweights);
00079     
00087     void set_mkl_epsilon(float64_t eps ); 
00088 
00096     void set_max_num_mkliters(int32_t maxnum);
00097 
00098     virtual void set_mkl_norm(float64_t norm);
00099 
00100     
00101 protected:
00106     CMKLMultiClass( const CMKLMultiClass & cm);
00111     CMKLMultiClass operator=( const CMKLMultiClass & cm);
00112 
00117     void initlpsolver();
00118 
00122     void initsvm();
00123     
00124 
00125 
00126     
00132     virtual bool evaluatefinishcriterion(const int32_t
00133             numberofsilpiterations);
00134     
00135 
00145     void addingweightsstep( const std::vector<float64_t> & curweights);
00150     float64_t getsumofsignfreealphas();
00157     float64_t getsquarenormofprimalcoefficients(
00158             const int32_t ind);
00159     
00160 
00161     
00162 
00163 protected:
00168     CGMNPSVM* svm;
00172     MKLMultiClassOptimizationBase* lpw; 
00176     ::std::vector< std::vector< float64_t> > weightshistory;
00177 
00181     float64_t mkl_eps; 
00185     int32_t max_num_mkl_iters; 
00189     float64_t pnorm;
00193     std::vector<float64_t> normweightssquared;
00194     
00195 };
00196 }
00197 #endif // GMNPMKL_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation