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) 2012 Fernando José Iglesias García
8  * Copyright (C) 2012 Fernando José Iglesias García
9  */
10 
11 #ifndef _PRIMAL_MOSEK_SOSVM__H__
12 #define _PRIMAL_MOSEK_SOSVM__H__
13 
14 #include <shogun/lib/config.h>
15 
16 #ifdef USE_MOSEK
17 
20 
21 namespace shogun
22 {
23 
34 class CPrimalMosekSOSVM : public CLinearStructuredOutputMachine
35 {
36  public:
38  CPrimalMosekSOSVM();
39 
45  CPrimalMosekSOSVM(CStructuredModel* model, CStructuredLabels* labs);
46 
48  ~CPrimalMosekSOSVM();
49 
54  inline SGVector< float64_t > get_slacks() const { return m_slacks; }
55 
60  virtual float64_t compute_primal_objective() const;
61 
63  virtual const char* get_name() const { return "PrimalMosekSOSVM"; }
64 
69  virtual EMachineType get_classifier_type();
70 
75  void set_regularization(float64_t C);
76 
82 
83  protected:
89  virtual bool train_machine(CFeatures* data = NULL);
90 
91  private:
92  void init();
93 
99  float64_t compute_loss_arg(CResultSet* result) const;
100 
106  bool insert_result(CList* result_list, CResultSet* result) const;
107 
131  bool add_constraint(CMosek* mosek, CResultSet* result, index_t con_idx, index_t train_idx) const;
132 
133  private:
135  SGVector< float64_t > m_slacks;
136 
138  float64_t po_value;
139 
141  float64_t m_regularization;
142 
144  float64_t m_epsilon;
145 
146 }; /* class CPrimalMosekSOSVM */
147 
148 } /* namespace shogun */
149 
150 #endif /* USE_MOSEK */
151 #endif /* _PRIMAL_MOSEK_SOSVM__H__ */

SHOGUN Machine Learning Toolbox - Documentation