SHOGUN  v3.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MulticlassStrategy.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 Chiyuan Zhang
8  * Written (W) 2013 Shell Hu and Heiko Strathmann
9  * Copyright (C) 2012 Chiyuan Zhang
10  */
11 
12 #ifndef MULTICLASSSTRATEGY_H__
13 #define MULTICLASSSTRATEGY_H__
14 
15 #include <shogun/base/SGObject.h>
20 
21 namespace shogun
22 {
23 
35 {
37  OVA_NORM = 1,
39  OVO_PRICE = 3,
42 };
43 
48 {
49 public:
52 
57 
59  virtual ~CMulticlassStrategy() {}
60 
62  virtual const char* get_name() const
63  {
64  return "MulticlassStrategy";
65  };
66 
68  void set_num_classes(int32_t num_classes)
69  {
70  m_num_classes = num_classes;
71  }
72 
74  int32_t get_num_classes() const
75  {
76  return m_num_classes;
77  }
78 
81  {
83  return m_rejection_strategy;
84  }
85 
87  void set_rejection_strategy(CRejectionStrategy *rejection_strategy)
88  {
89  SG_REF(rejection_strategy);
91  m_rejection_strategy = rejection_strategy;
92  }
93 
95  virtual void train_start(CMulticlassLabels *orig_labels, CBinaryLabels *train_labels);
96 
98  virtual bool train_has_more()=0;
99 
104 
106  virtual void train_stop();
107 
111  virtual int32_t decide_label(SGVector<float64_t> outputs)=0;
112 
118  {
120  return SGVector<index_t>();
121  }
122 
125  virtual int32_t get_num_machines()=0;
126 
129  {
130  return m_prob_heuris;
131  }
132 
137  {
138  m_prob_heuris = prob_heuris;
139  }
140 
146  virtual void rescale_outputs(SGVector<float64_t> outputs)
147  {
149  }
150 
158  virtual void rescale_outputs(SGVector<float64_t> outputs,
159  const SGVector<float64_t> As, const SGVector<float64_t> Bs)
160  {
162  }
163 
164 private:
166  void init();
167 
168 protected:
169 
173  int32_t m_train_iter;
174  int32_t m_num_classes;
176 };
177 
178 } // namespace shogun
179 
180 #endif /* end of include guard: MULTICLASSSTRATEGY_H__ */
181 

SHOGUN Machine Learning Toolbox - Documentation