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 <shogun/base/SGObject.h>
00017 #include <shogun/kernel/Kernel.h>  
00018 #include <shogun/kernel/CombinedKernel.h> 
00019 #include <shogun/classifier/svm/GMNPSVM.h>
00020 #include <shogun/classifier/mkl/MKLMultiClassGLPK.h>
00021 #include <shogun/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 
00056     virtual inline EClassifierType get_classifier_type()
00057         { return CT_MKLMULTICLASS; }
00058     
00059 
00068     float64_t* getsubkernelweights(int32_t & numweights);
00069     
00077     void set_mkl_epsilon(float64_t eps ); 
00078 
00086     void set_max_num_mkliters(int32_t maxnum);
00087 
00091     virtual void set_mkl_norm(float64_t norm);
00092 
00093     
00094 protected:
00099     CMKLMultiClass( const CMKLMultiClass & cm);
00104     CMKLMultiClass operator=( const CMKLMultiClass & cm);
00105 
00110     void initlpsolver();
00111 
00115     void initsvm();
00116     
00117 
00118 
00119     
00125     virtual bool evaluatefinishcriterion(const int32_t
00126             numberofsilpiterations);
00127     
00128 
00138     void addingweightsstep( const std::vector<float64_t> & curweights);
00143     float64_t getsumofsignfreealphas();
00150     float64_t getsquarenormofprimalcoefficients(
00151             const int32_t ind);
00152     
00153 
00162     virtual bool train_machine(CFeatures* data=NULL);
00163     
00164 
00165 protected:
00170     CGMNPSVM* svm;
00174     MKLMultiClassOptimizationBase* lpw; 
00178     ::std::vector< std::vector< float64_t> > weightshistory;
00179 
00183     float64_t mkl_eps; 
00187     int32_t max_num_mkl_iters; 
00191     float64_t pnorm;
00195     std::vector<float64_t> normweightssquared;
00196     
00197 };
00198 }
00199 #endif // GMNPMKL_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation