CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GBRForest2D.h
Go to the documentation of this file.
1 
2 #ifndef EGAMMAOBJECTS_GBRForest2D
3 #define EGAMMAOBJECTS_GBRForest2D
4 
6 // //
7 // GBRForest2D //
8 // //
9 // A fast minimal implementation of Gradient-Boosted Regression Trees //
10 // which has been especially optimized for size on disk and in memory. //
11 // //
12 // Designed to be built from TMVA-trained trees, but could also be //
13 // generalized to otherwise-trained trees, classification, //
14 // or other boosting methods in the future //
15 // //
16 // Josh Bendavid - MIT //
18 
20 
21 #include <vector>
22 #include "GBRTree2D.h"
23 #include <stdio.h>
24 
25  class GBRForest2D {
26 
27  public:
28 
29  GBRForest2D();
31 
32  void GetResponse(const float* vector, double &x, double &y) const;
33 
34  void SetInitialResponse(double x, double y) { fInitialResponseX = x; fInitialResponseY = y; }
35 
36  std::vector<GBRTree2D> &Trees() { return fTrees; }
37  const std::vector<GBRTree2D> &Trees() const { return fTrees; }
38 
39  protected:
42  std::vector<GBRTree2D> fTrees;
43 
44 
46 };
47 
48 //_______________________________________________________________________
49 inline void GBRForest2D::GetResponse(const float* vector, double &x, double &y) const {
52  double tx, ty;
53  for (std::vector<GBRTree2D>::const_iterator it=fTrees.begin(); it!=fTrees.end(); ++it) {
54  it->GetResponse(vector,tx,ty);
55  x += tx;
56  y += ty;
57  }
58  return;
59 }
60 
61 #endif
const std::vector< GBRTree2D > & Trees() const
Definition: GBRForest2D.h:37
void SetInitialResponse(double x, double y)
Definition: GBRForest2D.h:34
double fInitialResponseX
Definition: GBRForest2D.h:40
std::vector< GBRTree2D > & Trees()
Definition: GBRForest2D.h:36
double fInitialResponseY
Definition: GBRForest2D.h:41
void GetResponse(const float *vector, double &x, double &y) const
Definition: GBRForest2D.h:49
std::vector< GBRTree2D > fTrees
Definition: GBRForest2D.h:42
Definition: DDAxes.h:10