SHOGUN
v3.2.0
|
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) 2012 Michal Uricar 00008 * Copyright (C) 2012 Michal Uricar 00009 */ 00010 00011 #ifndef _DUALLIBQPBMSOSVM__H__ 00012 #define _DUALLIBQPBMSOSVM__H__ 00013 00014 #include <shogun/machine/LinearStructuredOutputMachine.h> 00015 #include <shogun/features/DotFeatures.h> 00016 #include <shogun/structure/BmrmStatistics.h> 00017 00018 namespace shogun 00019 { 00020 00025 enum ESolver 00026 { 00027 BMRM=1, 00028 PPBMRM=2, 00029 P3BMRM=3, 00030 NCBM=4 00031 }; 00032 00047 class CDualLibQPBMSOSVM : public CLinearStructuredOutputMachine 00048 { 00049 public: 00051 CDualLibQPBMSOSVM(); 00052 00060 CDualLibQPBMSOSVM( 00061 CStructuredModel* model, 00062 CStructuredLabels* labs, 00063 float64_t _lambda, 00064 SGVector< float64_t > W=0); 00065 00067 virtual ~CDualLibQPBMSOSVM(); 00068 00070 virtual const char* get_name() const { return "DualLibQPBMSOSVM"; } 00071 00076 inline void set_lambda(float64_t _lambda) { m_lambda=_lambda; } 00077 00082 inline float64_t get_lambda() { return m_lambda; } 00083 00088 inline void set_TolRel(float64_t TolRel) { m_TolRel=TolRel; } 00089 00094 inline float64_t get_TolRel() { return m_TolRel; } 00095 00100 inline void set_TolAbs(float64_t TolAbs) { m_TolAbs=TolAbs; } 00101 00106 inline float64_t get_TolAbs() { return m_TolAbs; } 00107 00113 inline void set_BufSize(uint32_t BufSize) { m_BufSize=BufSize; } 00114 00119 inline uint32_t get_BufSize() { return m_BufSize; } 00120 00126 inline void set_cleanICP(bool cleanICP) { m_cleanICP=cleanICP; } 00127 00132 inline bool get_cleanICP() { return m_cleanICP; } 00133 00139 inline void set_cleanAfter(uint32_t cleanAfter) { m_cleanAfter=cleanAfter; } 00140 00146 inline uint32_t get_cleanAfter() { return m_cleanAfter; } 00147 00152 inline void set_K(float64_t K) { m_K=K; } 00153 00158 inline float64_t get_K() { return m_K; } 00159 00164 inline void set_Tmax(uint32_t Tmax) { m_Tmax=Tmax; } 00165 00170 inline uint32_t get_Tmax() { return m_Tmax; } 00171 00176 inline void set_cp_models(uint32_t cp_models) { m_cp_models=cp_models; } 00177 00182 inline uint32_t get_cp_models() { return m_cp_models; } 00183 00188 inline BmrmStatistics get_result() { return m_result; } 00189 00194 inline ESolver get_solver() { return m_solver; } 00195 00200 inline void set_solver(ESolver solver) { m_solver=solver; } 00201 00206 inline void set_w(SGVector< float64_t > W) 00207 { 00208 REQUIRE(W.vlen == m_model->get_dim(), "Dimension of the initial " 00209 "solution must match the model's dimension!\n"); 00210 m_w=W; 00211 } 00212 00217 virtual EMachineType get_classifier_type(); 00218 00219 protected: 00223 bool train_machine(CFeatures* data=NULL); 00224 00225 private: 00229 void init(); 00230 00231 private: 00232 00234 float64_t m_lambda; 00235 00237 float64_t m_TolRel; 00238 00240 float64_t m_TolAbs; 00241 00243 uint32_t m_BufSize; 00244 00246 bool m_cleanICP; 00247 00249 uint32_t m_cleanAfter; 00250 00252 float64_t m_K; 00253 00255 uint32_t m_Tmax; 00256 00258 uint32_t m_cp_models; 00259 00261 BmrmStatistics m_result; 00262 00264 ESolver m_solver; 00265 00266 }; /* class CDualLibQPBMSOSVM */ 00267 00268 } /* namespace shogun */ 00269 00270 #endif /* _DUALLIBQPBMSOSVM__H__ */