SHOGUN
v2.0.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 Fernando José Iglesias García 00008 * Copyright (C) 2012 Fernando José Iglesias García 00009 */ 00010 00011 #ifndef _PRIMAL_MOSEK_SOSVM__H__ 00012 #define _PRIMAL_MOSEK_SOSVM__H__ 00013 00014 #ifdef USE_MOSEK 00015 00016 #include <shogun/loss/LossFunction.h> 00017 #include <shogun/machine/LinearStructuredOutputMachine.h> 00018 #include <shogun/mathematics/Mosek.h> 00019 00020 namespace shogun 00021 { 00022 00033 class CPrimalMosekSOSVM : public CLinearStructuredOutputMachine 00034 { 00035 public: 00037 CPrimalMosekSOSVM(); 00038 00045 CPrimalMosekSOSVM(CStructuredModel* model, CLossFunction* loss, CStructuredLabels* labs); 00046 00048 ~CPrimalMosekSOSVM(); 00049 00054 inline SGVector< float64_t > get_slacks() const { return m_slacks; } 00055 00057 virtual const char* get_name() const { return "PrimalMosekSOSVM"; } 00058 00059 protected: 00065 virtual bool train_machine(CFeatures* data = NULL); 00066 00067 private: 00068 void init(); 00069 00075 float64_t compute_loss_arg(CResultSet* result) const; 00076 00082 bool insert_result(CList* result_list, CResultSet* result) const; 00083 00107 bool add_constraint(CMosek* mosek, CResultSet* result, index_t con_idx, index_t train_idx) const; 00108 00109 private: 00111 SGVector< float64_t > m_slacks; 00112 00113 }; /* class CPrimalMosekSOSVM */ 00114 00115 } /* namespace shogun */ 00116 00117 #endif /* USE_MOSEK */ 00118 #endif /* _PRIMAL_MOSEK_SOSVM__H__ */