SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MulticlassOneVsRestStrategy.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 MULTICLASSONEVSRESTSTRATEGY_H__
13 #define MULTICLASSONEVSRESTSTRATEGY_H__
14 
15 #include <shogun/lib/config.h>
16 
18 
19 namespace shogun
20 {
21 
34 {
35 public:
38 
43 
46 
48  virtual void train_start(CMulticlassLabels *orig_labels, CBinaryLabels *train_labels)
49  {
50  CMulticlassStrategy::train_start(orig_labels, train_labels);
51  }
52 
54  virtual bool train_has_more()
55  {
56  return m_train_iter < m_num_classes;
57  }
58 
63 
67  virtual int32_t decide_label(SGVector<float64_t> outputs);
68 
73  virtual SGVector<index_t> decide_label_multiple_output(SGVector<float64_t> outputs, int32_t n_outputs);
74 
77  virtual int32_t get_num_machines()
78  {
79  return m_num_classes;
80  }
81 
83  virtual const char* get_name() const
84  {
85  return "MulticlassOneVsRestStrategy";
86  };
87 
91  virtual void rescale_outputs(SGVector<float64_t> outputs);
92 
99  virtual void rescale_outputs(SGVector<float64_t> outputs,
100  const SGVector<float64_t> As, const SGVector<float64_t> Bs);
101 
102 protected:
107 
114  const SGVector<float64_t> As, const SGVector<float64_t> Bs);
115 
116 };
117 
118 } // namespace shogun
119 
120 #endif /* end of include guard: MULTICLASSONEVSRESTSTRATEGY_H__ */
121 
void rescale_heuris_norm(SGVector< float64_t > outputs)
virtual SGVector< int32_t > train_prepare_next()
virtual int32_t decide_label(SGVector< float64_t > outputs)
int32_t m_num_classes
number of classes in this problem
Multiclass Labels for multi-class classification.
int32_t m_train_iter
index of current iterations
virtual void rescale_outputs(SGVector< float64_t > outputs)
void rescale_heuris_softmax(SGVector< float64_t > outputs, const SGVector< float64_t > As, const SGVector< float64_t > Bs)
virtual SGVector< index_t > decide_label_multiple_output(SGVector< float64_t > outputs, int32_t n_outputs)
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
Binary Labels for binary classification.
Definition: BinaryLabels.h:37
class MulticlassStrategy used to construct generic multiclass classifiers with ensembles of binary cl...
multiclass one vs rest strategy used to train generic multiclass machines for K-class problems with b...
virtual void train_start(CMulticlassLabels *orig_labels, CBinaryLabels *train_labels)
virtual void train_start(CMulticlassLabels *orig_labels, CBinaryLabels *train_labels)

SHOGUN Machine Learning Toolbox - Documentation