SHOGUN  3.2.1
 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/lib/config.h>
16 
17 #include <shogun/base/SGObject.h>
22 
23 namespace shogun
24 {
25 
37 {
39  OVA_NORM = 1,
41  OVO_PRICE = 3,
44 };
45 
50 {
51 public:
54 
59 
61  virtual ~CMulticlassStrategy() {}
62 
64  virtual const char* get_name() const
65  {
66  return "MulticlassStrategy";
67  };
68 
70  void set_num_classes(int32_t num_classes)
71  {
72  m_num_classes = num_classes;
73  }
74 
76  int32_t get_num_classes() const
77  {
78  return m_num_classes;
79  }
80 
83  {
85  return m_rejection_strategy;
86  }
87 
89  void set_rejection_strategy(CRejectionStrategy *rejection_strategy)
90  {
91  SG_REF(rejection_strategy);
93  m_rejection_strategy = rejection_strategy;
94  }
95 
97  virtual void train_start(CMulticlassLabels *orig_labels, CBinaryLabels *train_labels);
98 
100  virtual bool train_has_more()=0;
101 
106 
108  virtual void train_stop();
109 
113  virtual int32_t decide_label(SGVector<float64_t> outputs)=0;
114 
120  {
122  return SGVector<index_t>();
123  }
124 
127  virtual int32_t get_num_machines()=0;
128 
131  {
132  return m_prob_heuris;
133  }
134 
139  {
140  m_prob_heuris = prob_heuris;
141  }
142 
148  virtual void rescale_outputs(SGVector<float64_t> outputs)
149  {
151  }
152 
160  virtual void rescale_outputs(SGVector<float64_t> outputs,
161  const SGVector<float64_t> As, const SGVector<float64_t> Bs)
162  {
164  }
165 
166 private:
168  void init();
169 
170 protected:
171 
175  int32_t m_train_iter;
176  int32_t m_num_classes;
178 };
179 
180 } // namespace shogun
181 
182 #endif /* end of include guard: MULTICLASSSTRATEGY_H__ */
183 

SHOGUN Machine Learning Toolbox - Documentation