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 
19 #include <vector>
20 #include "GBRTree2D.h"
21 #include <stdio.h>
22 
23  class GBRForest2D {
24 
25  public:
26 
27  GBRForest2D();
29 
30  void GetResponse(const float* vector, double &x, double &y) const;
31 
32  void SetInitialResponse(double x, double y) { fInitialResponseX = x; fInitialResponseY = y; }
33 
34  std::vector<GBRTree2D> &Trees() { return fTrees; }
35  const std::vector<GBRTree2D> &Trees() const { return fTrees; }
36 
37  protected:
40  std::vector<GBRTree2D> fTrees;
41 
42  };
43 
44 //_______________________________________________________________________
45 inline void GBRForest2D::GetResponse(const float* vector, double &x, double &y) const {
48  double tx, ty;
49  for (std::vector<GBRTree2D>::const_iterator it=fTrees.begin(); it!=fTrees.end(); ++it) {
50  it->GetResponse(vector,tx,ty);
51  x += tx;
52  y += ty;
53  }
54  return;
55 }
56 
57 #endif
const std::vector< GBRTree2D > & Trees() const
Definition: GBRForest2D.h:35
void SetInitialResponse(double x, double y)
Definition: GBRForest2D.h:32
double fInitialResponseX
Definition: GBRForest2D.h:38
std::vector< GBRTree2D > & Trees()
Definition: GBRForest2D.h:34
double fInitialResponseY
Definition: GBRForest2D.h:39
void GetResponse(const float *vector, double &x, double &y) const
Definition: GBRForest2D.h:45
std::vector< GBRTree2D > fTrees
Definition: GBRForest2D.h:40
x
Definition: VDTMath.h:216