Changeset 8643 for trunk/MagicSoft/Mars/mjtrain
- Timestamp:
- 07/19/07 19:59:27 (17 years ago)
- Location:
- trunk/MagicSoft/Mars/mjtrain
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjtrain/MJTrainDisp.cc
r8244 r8643 145 145 rf.SetLogStream(fLog); 146 146 rf.SetFileName(out); 147 rf.SetDebug(fDebug );147 rf.SetDebug(fDebug>1); 148 148 rf.SetNameOutput("Disp"); 149 149 … … 251 251 hist.GetAlphaFitter().Print("result"); 252 252 253 if (!WriteDisplay(out ))253 if (!WriteDisplay(out, "UPDATE")) 254 254 return kFALSE; 255 255 -
trunk/MagicSoft/Mars/mjtrain/MJTrainEnergy.cc
r8636 r8643 139 139 rf.SetLogStream(fLog); 140 140 rf.SetFileName(out); 141 rf.SetDebug(fDebug );141 rf.SetDebug(fDebug>1); 142 142 rf.SetNameOutput("MEnergyEst"); 143 143 … … 193 193 return kFALSE; 194 194 195 if (!WriteDisplay(out ))195 if (!WriteDisplay(out, "UPDATE")) 196 196 return kFALSE; 197 197 -
trunk/MagicSoft/Mars/mjtrain/MJTrainRanForest.cc
r8091 r8643 18 18 ! Author(s): Thomas Bretz 11/2005 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2005-200 620 ! Copyright: MAGIC Software Development, 2005-2007 21 21 ! 22 22 ! … … 28 28 // 29 29 // Base class for classes training a random forest 30 // 31 // The order when reading a file is: 32 // 1) Execution of PreTasks (set by user) 33 // 2) Execution of PreCuts (set by user) 34 // 3) Selector (calculated from number of requested events) 35 // 4) Splitter (if sample is split automatically in test/train) 36 // 5) PostTasks (set by user) 37 // 38 // The split into Pre- and PostTasks is done for speed reason. So, if 39 // you calculate a vlue which is not needed for your PreCuts, you can 40 // calculate it afterwards, which will speed up execution. 30 41 // 31 42 ///////////////////////////////////////////////////////////////////////////// … … 45 56 46 57 using namespace std; 47 58 /* 48 59 //------------------------------------------------------------------------ 49 60 // … … 120 131 return kTRUE; 121 132 } 133 */ -
trunk/MagicSoft/Mars/mjtrain/MJTrainRanForest.h
r7697 r8643 2 2 #define MARS_MJTrainRanForest 3 3 4 #ifndef MARS_MJ ob5 #include "MJ ob.h"4 #ifndef MARS_MJOptimizeBase 5 #include "MJOptimizeBase.h" 6 6 #endif 7 7 … … 9 9 class MFilter; 10 10 11 class MJTrainRanForest : public MJ ob11 class MJTrainRanForest : public MJOptimizeBase 12 12 { 13 13 protected: 14 Bool_t fDebug;15 Bool_t fEnableWeights;16 17 TList fRules;18 19 TList fPreCuts;20 TList fTrainCuts;21 TList fTestCuts;22 TList fPreTasks;23 TList fPostTasks;24 25 14 UShort_t fNumTrees; 26 15 UShort_t fNdSize; 27 16 UShort_t fNumTry; 28 17 29 Bool_t WriteDisplay(const char *fname) const;30 31 void AddCut(TList &l, const char *rule);32 void AddPar(TList &l, const char *rule, const char *name);33 void Add(TList &l, MTask *f);34 35 18 public: 36 MJTrainRanForest() : fDebug(kFALSE), fEnableWeights(kFALSE)19 MJTrainRanForest() 37 20 { 38 21 fNumTrees = 100; //100 … … 41 24 } 42 25 43 void AddPreTask(MTask *t) { Add(fPreTasks, t); }44 void AddPreTask(const char *rule,45 const char *name="MWeight") { AddPar(fPreTasks, rule, name); }46 47 void AddPostTask(MTask *t) { Add(fPostTasks, t); }48 void AddPostTask(const char *rule,49 const char *name="MWeight") { AddPar(fPostTasks, rule, name); }50 51 void SetDebug(Bool_t b=kTRUE) { fDebug = b; }52 53 void SetWeights(const char *rule) { if (fEnableWeights) return; fEnableWeights=kTRUE; AddPostTask(rule); }54 void SetWeights(MTask *t) { if (fEnableWeights) return; fEnableWeights=kTRUE; AddPostTask(t); }55 56 void AddPreCut(const char *rule) { AddCut(fPreCuts, rule); }57 void AddPreCut(MFilter *f) { Add(fPreCuts, (MTask*)(f)); }58 59 void AddTrainCut(const char *rule) { AddCut(fTrainCuts, rule); }60 void AddTrainCut(MFilter *f) { Add(fTrainCuts, (MTask*)(f)); }61 62 void AddTestCut(const char *rule) { AddCut(fTestCuts, rule); }63 void AddTestCut(MFilter *f) { Add(fTestCuts, (MTask*)(f)); }64 65 26 void SetNumTrees(UShort_t n=100) { fNumTrees = n; } 66 27 void SetNdSize(UShort_t n=5) { fNdSize = n; } 67 28 void SetNumTry(UShort_t n=0) { fNumTry = n; } 68 69 Int_t AddParameter(const char *rule);70 29 71 30 ClassDef(MJTrainRanForest, 0)//Base class for Random Forest training classes -
trunk/MagicSoft/Mars/mjtrain/MJTrainSeparation.cc
r8223 r8643 802 802 rf.SetNumObsoleteVariables(1); 803 803 rf.SetLastDataColumnHasWeights(fEnableWeights[kTrainOn] || fEnableWeights[kTrainOff]); 804 rf.SetDebug(fDebug );804 rf.SetDebug(fDebug>1); 805 805 rf.SetDisplay(fDisplay); 806 806 rf.SetLogStream(fLog); … … 1039 1039 1040 1040 // Write the display 1041 if (!WriteDisplay(out ))1041 if (!WriteDisplay(out, "UPDATE")) 1042 1042 return kFALSE; 1043 1043 -
trunk/MagicSoft/Mars/mjtrain/Makefile
r7702 r8643 22 22 -I../manalysis -I../mfilter -I../mjobs -I../mtools \ 23 23 -I../mranforest -I../mhflux -I../mmc -I../mhist -I../mpointing \ 24 -I../mimage 24 -I../mimage -I../mjoptim 25 25 26 26 SRCFILES = MJTrainRanForest.cc \
Note:
See TracChangeset
for help on using the changeset viewer.