DualLibQPBMSOSVM.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) 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/structure/libbmrm.h>
00016 #include <shogun/features/DotFeatures.h>
00017 
00018 namespace shogun
00019 {
00020 
00025 enum ESolver
00026 {
00027     BMRM=1,     
00028     PPBMRM=2,   
00029     P3BMRM=3    
00030 };
00031 
00046 class CDualLibQPBMSOSVM : public CLinearStructuredOutputMachine
00047 {
00048     public:
00050         CDualLibQPBMSOSVM();
00051 
00060         CDualLibQPBMSOSVM(
00061                 CStructuredModel*       model,
00062                 CLossFunction*          loss,
00063                 CStructuredLabels*      labs,
00064                 float64_t               _lambda,
00065                 SGVector< float64_t >   W=0);
00066 
00068         ~CDualLibQPBMSOSVM();
00069 
00071         virtual const char* get_name() const { return "DualLibQPBMSOSVM"; }
00072 
00077         inline void set_lambda(float64_t _lambda) { m_lambda=_lambda; }
00078 
00083         inline float64_t get_lambda() { return m_lambda; }
00084 
00089         inline void set_TolRel(float64_t TolRel) { m_TolRel=TolRel; }
00090 
00095         inline float64_t get_TolRel() { return m_TolRel; }
00096 
00101         inline void set_TolAbs(float64_t TolAbs) { m_TolAbs=TolAbs; }
00102 
00107         inline float64_t get_TolAbs() { return m_TolAbs; }
00108 
00114         inline void set_BufSize(uint32_t BufSize) { m_BufSize=BufSize; }
00115 
00120         inline uint32_t get_BufSize() { return m_BufSize; }
00121 
00127         inline void set_cleanICP(bool cleanICP) { m_cleanICP=cleanICP; }
00128 
00133         inline bool get_cleanICP() { return m_cleanICP; }
00134 
00140         inline void set_cleanAfter(uint32_t cleanAfter) { m_cleanAfter=cleanAfter; }
00141 
00147         inline uint32_t get_cleanAfter() { return m_cleanAfter; }
00148 
00153         inline void set_K(float64_t K) { m_K=K; }
00154 
00159         inline float64_t get_K() { return m_K; }
00160 
00165         inline void set_Tmax(uint32_t Tmax) { m_Tmax=Tmax; }
00166 
00171         inline uint32_t get_Tmax() { return m_Tmax; }
00172 
00177         inline void set_cp_models(uint32_t cp_models) { m_cp_models=cp_models; }
00178 
00183         inline uint32_t get_cp_models() { return m_cp_models; }
00184 
00189         inline void set_verbose(bool verbose) { m_verbose=verbose; }
00190 
00195         inline bool get_verbose() { return m_verbose; }
00196 
00201         inline bmrm_return_value_T get_result() { return m_result; }
00202 
00207         inline ESolver get_solver() { return m_solver; }
00208 
00213         inline void set_solver(ESolver solver) { m_solver=solver; }
00214 
00219         inline void set_w(SGVector< float64_t > W)
00220         {
00221             REQUIRE(W.vlen == m_model->get_dim(), "Dimension of the initial "
00222                     "solution must match the model's dimension!\n");
00223             m_w=W;
00224         }
00225 
00226     protected:
00230         bool train_machine(CFeatures* data=NULL);
00231 
00232     private:
00236         void init();
00237 
00238     private:
00239 
00241         float64_t m_lambda;
00242 
00244         float64_t m_TolRel;
00245 
00247         float64_t m_TolAbs;
00248 
00250         uint32_t m_BufSize;
00251 
00253         bool m_cleanICP;
00254 
00256         uint32_t m_cleanAfter;
00257 
00259         float64_t m_K;
00260 
00262         uint32_t m_Tmax;
00263 
00265         uint32_t m_cp_models;
00266 
00268         bool m_verbose;
00269 
00271         bmrm_return_value_T m_result;
00272 
00274         ESolver m_solver;
00275 
00276 }; /* class CDualLibQPBMSOSVM */
00277 
00278 } /* namespace shogun */
00279 
00280 #endif /* _DUALLIBQPBMSOSVM__H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation