SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PrimalMosekSOSVM.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2014 Shell Hu
8  * Written (W) 2012 Fernando José Iglesias García
9  * Copyright (C) 2012 Fernando José Iglesias García
10  */
11 
12 #ifndef _PRIMAL_MOSEK_SOSVM__H__
13 #define _PRIMAL_MOSEK_SOSVM__H__
14 
15 #include <shogun/lib/config.h>
16 
17 #ifdef USE_MOSEK
18 
21 
22 namespace shogun
23 {
24 
35 class CPrimalMosekSOSVM : public CLinearStructuredOutputMachine
36 {
37  public:
39  CPrimalMosekSOSVM();
40 
46  CPrimalMosekSOSVM(CStructuredModel* model, CStructuredLabels* labs);
47 
49  ~CPrimalMosekSOSVM();
50 
55  inline SGVector< float64_t > get_slacks() const { return m_slacks; }
56 
61  virtual float64_t compute_primal_objective() const;
62 
64  virtual const char* get_name() const { return "PrimalMosekSOSVM"; }
65 
70  virtual EMachineType get_classifier_type();
71 
76  void set_regularization(float64_t C);
77 
83 
87  void set_lower_bounds(SGVector< float64_t > lb);
88 
92  void set_upper_bounds(SGVector< float64_t > ub);
93 
94  protected:
100  virtual bool train_machine(CFeatures* data = NULL);
101 
102  private:
103  void init();
104 
110  float64_t compute_loss_arg(CResultSet* result) const;
111 
117  bool insert_result(CList* result_list, CResultSet* result) const;
118 
142  bool add_constraint(CMosek* mosek, CResultSet* result, index_t con_idx, index_t train_idx) const;
143 
144  private:
146  SGVector< float64_t > m_slacks;
147 
149  float64_t po_value;
150 
152  float64_t m_regularization;
153 
155  float64_t m_epsilon;
156 
158  SGVector< float64_t > m_lb;
159 
161  SGVector< float64_t > m_ub;
162 
163 }; /* class CPrimalMosekSOSVM */
164 
165 } /* namespace shogun */
166 
167 #endif /* USE_MOSEK */
168 #endif /* _PRIMAL_MOSEK_SOSVM__H__ */

SHOGUN Machine Learning Toolbox - Documentation