SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MulticlassOneVsOneStrategy.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 
13 
14 namespace shogun
15 {
16 
29 {
30 public:
33 
38 
41 
43  virtual void train_start(CMulticlassLabels *orig_labels, CBinaryLabels *train_labels);
44 
46  virtual bool train_has_more();
47 
52 
56  virtual int32_t decide_label(SGVector<float64_t> outputs);
57 
60  virtual int32_t get_num_machines()
61  {
62  return m_num_classes*(m_num_classes-1)/2;
63  }
64 
66  virtual const char* get_name() const
67  {
68  return "MulticlassOneVsOneStrategy";
69  };
70 
75  virtual void rescale_outputs(SGVector<float64_t> outputs);
76 
81  void set_num_classes(int32_t num_classes)
82  {
85  }
86 
87 protected:
94  const SGVector<int32_t> indx1, const SGVector<int32_t> indx2);
95 
102  const SGVector<int32_t> indx1, const SGVector<int32_t> indx2);
103 
110  const SGVector<int32_t> indx1, const SGVector<int32_t> indx2);
111 
112 private:
114  void register_parameters();
115 
116 protected:
117  int32_t m_num_machines;
121 };
122 
123 } // namespace shogun
virtual SGVector< int32_t > train_prepare_next()
int32_t m_train_pair_idx_2
2nd index of current submachine being trained
void rescale_heuris_hamamura(SGVector< float64_t > outputs, const SGVector< int32_t > indx1, const SGVector< int32_t > indx2)
multiclass one vs one strategy used to train generic multiclass machines for K-class problems with bu...
virtual void train_start(CMulticlassLabels *orig_labels, CBinaryLabels *train_labels)
int32_t m_train_pair_idx_1
1st index of current submachine being trained
SGVector< int32_t > m_num_samples
number of samples per machine
int32_t m_num_classes
number of classes in this problem
Multiclass Labels for multi-class classification.
void rescale_heuris_hastie(SGVector< float64_t > outputs, const SGVector< int32_t > indx1, const SGVector< int32_t > indx2)
void set_num_classes(int32_t num_classes)
virtual void rescale_outputs(SGVector< float64_t > outputs)
void rescale_heuris_price(SGVector< float64_t > outputs, const SGVector< int32_t > indx1, const SGVector< int32_t > indx2)
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...
virtual int32_t decide_label(SGVector< float64_t > outputs)

SHOGUN Machine Learning Toolbox - Documentation