PrimalMosekSOSVM.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 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 
00060         virtual float64_t compute_primal_objective() const;
00061 
00063         virtual const char* get_name() const { return "PrimalMosekSOSVM"; }
00064 
00065     protected:
00071         virtual bool train_machine(CFeatures* data = NULL);
00072 
00073     private:
00074         void init();
00075 
00081         float64_t compute_loss_arg(CResultSet* result) const;
00082 
00088         bool insert_result(CList* result_list, CResultSet* result) const;
00089 
00113         bool add_constraint(CMosek* mosek, CResultSet* result, index_t con_idx, index_t train_idx) const;
00114 
00115     private:
00117         SGVector< float64_t > m_slacks;
00118 
00120         float64_t po_value;
00121 
00122 }; /* class CPrimalMosekSOSVM */
00123 
00124 } /* namespace shogun */
00125 
00126 #endif /* USE_MOSEK */
00127 #endif /* _PRIMAL_MOSEK_SOSVM__H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation