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 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 protected: 00103 CMKLMultiClass( const CMKLMultiClass & cm); 00108 CMKLMultiClass operator=( const CMKLMultiClass & cm); 00109 00114 void initlpsolver(); 00115 00119 void initsvm(); 00120 00121 00122 00123 00129 virtual bool evaluatefinishcriterion(const int32_t 00130 numberofsilpiterations); 00131 00132 00142 void addingweightsstep( const std::vector<float64_t> & curweights); 00147 float64_t getsumofsignfreealphas(); 00154 float64_t getsquarenormofprimalcoefficients( 00155 const int32_t ind); 00156 00157 00158 00159 00160 protected: 00165 CGMNPSVM* svm; 00169 MKLMultiClassGLPK* lpw; 00173 ::std::vector< std::vector< float64_t> > weightshistory; 00174 00178 float64_t mkl_eps; 00182 int32_t max_num_mkl_iters; 00183 00184 00185 }; 00186 } 00187 #endif // GMNPMKL_H_