SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BaggingMachine.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) 2013 Viktor Gal
8  * Copyright (C) 2013 Viktor Gal
9  */
10 
11 #ifndef BAGGINGMACHINE_H
12 #define BAGGINGMACHINE_H
13 
14 #include <shogun/lib/config.h>
15 
16 #include <shogun/machine/Machine.h>
17 
18 namespace shogun
19 {
20  class CCombinationRule;
21  class CEvaluation;
22 
27  class CBaggingMachine : public CMachine
28  {
29  public:
32 
39  CBaggingMachine(CFeatures* features, CLabels* labels);
40 
41  virtual ~CBaggingMachine();
42 
43  virtual CBinaryLabels* apply_binary(CFeatures* data=NULL);
44  virtual CMulticlassLabels* apply_multiclass(CFeatures* data=NULL);
45  virtual CRegressionLabels* apply_regression(CFeatures* data=NULL);
46 
52  void set_num_bags(int32_t num_bags);
53 
59  int32_t get_num_bags() const;
60 
67  virtual void set_bag_size(int32_t bag_size);
68 
75  virtual int32_t get_bag_size() const;
76 
82  CMachine* get_machine() const;
83 
89  virtual void set_machine(CMachine* machine);
90 
98 
105 
111 
118  float64_t get_oob_error(CEvaluation* eval) const;
119 
121  virtual const char* get_name() const { return "BaggingMachine"; }
122 
123  protected:
124  virtual bool train_machine(CFeatures* data=NULL);
125 
132  virtual void set_machine_parameters(CMachine* m, SGVector<index_t> idx);
133 
141 
143  void register_parameters();
144 
146  void init();
147 
156 
157  void clear_oob_indicies();
158 
159  protected:
162 
165 
168 
170  int32_t m_num_bags;
171 
173  int32_t m_bag_size;
174 
177 
180 
183  };
184 }
185 
186 #endif /* BAGGINGMACHINE_H */

SHOGUN Machine Learning Toolbox - Documentation