source: trunk/MagicSoft/Mars/mranforest/MRanForestCalc.h@ 7413

Last change on this file since 7413 was 7413, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 2.8 KB
Line 
1#ifndef MARS_MRanForestCalc
2#define MARS_MRanForestCalc
3
4#ifndef MARS_MTask
5#include "MTask.h"
6#endif
7
8#ifndef ROOT_TObjArray
9#include <TObjArray.h>
10#endif
11
12#ifndef ROOT_TArrayD
13#include <TArrayD.h>
14#endif
15
16class MDataArray;
17class MParameterD;
18class MHMatrix;
19
20class MRanForestCalc : public MTask
21{
22public:
23 enum EstimationMode_t
24 {
25 kMean,
26 kMaximum,
27 kFit
28 };
29
30private:
31 static const TString gsDefName; //! Default Name
32 static const TString gsDefTitle; //! Default Title
33 static const TString gsNameOutput; //! Default Output name
34
35 Bool_t fDebug; // Debugging of eventloop while training on/off
36
37 TString fFileName; // File name to forest
38 TObjArray fEForests; // List of forests
39
40 TString fNameOutput; // Name of output container
41
42 MDataArray *fData; //! Used to store the MDataChains to get the event values
43 MParameterD *fRFOut; //! Used to store result
44
45 Int_t fNumTrees; //! Training parameters
46 Int_t fNumTry; //! Training parameters
47 Int_t fNdSize; //! Training parameters
48
49 Int_t fNumObsoleteVariables;
50
51 MHMatrix *fTestMatrix; //! Test Matrix used in Process (together with MMatrixLoop)
52
53 EstimationMode_t fEstimationMode;
54
55private:
56 // MTask
57 Int_t PreProcess(MParList *plist);
58 Int_t Process();
59
60 // MRanForestCalc
61 Int_t ReadForests(MParList &plist);
62
63 // MParContainer
64 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
65
66 // Train Interface
67 Int_t Train(const MHMatrix &n, const TArrayD &grid, Int_t ver=2);
68
69public:
70 MRanForestCalc(const char *name=NULL, const char *title=NULL);
71 ~MRanForestCalc();
72
73 // Setter for estimation
74 void SetFileName(TString filename) { fFileName = filename; }
75 void SetEstimationMode(EstimationMode_t op) { fEstimationMode = op; }
76 void SetNameOutput(TString name=gsNameOutput) { fNameOutput = name; }
77
78 // Setter for training
79 void SetNumTrees(UShort_t n=100) { fNumTrees = n; }
80 void SetNdSize(UShort_t n=5) { fNdSize = n; }
81 void SetNumTry(UShort_t n=0) { fNumTry = n; }
82 void SetDebug(Bool_t b=kTRUE) { fDebug = b; }
83
84 void SetNumObsoleteVariables(Int_t n=1) { fNumObsoleteVariables = n; }
85
86 // Train Interface
87 Int_t TrainMultiRF(const MHMatrix &n, const TArrayD &grid)
88 {
89 return Train(n, grid, 0);
90 }
91 Int_t TrainSingleRF(const MHMatrix &n, const TArrayD &grid=TArrayD())
92 {
93 return Train(n, grid, grid.GetSize()==0 ? 2 : 1);
94 }
95
96 // Test Interface
97 void SetTestMatrix(MHMatrix *m=0) { fTestMatrix=m; }
98 void InitMapping(MHMatrix *m=0) { fTestMatrix=m; }
99
100 ClassDef(MRanForestCalc, 0) // Task to calculate RF output and for RF training
101};
102
103#endif
Note: See TracBrowser for help on using the repository browser.