- Timestamp:
- 11/22/05 16:42:11 (19 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r7422 r7424 38 38 - improved handling of allocated memory (still to be checked 39 39 further) 40 - added Print function 40 41 41 42 * mranforest/MRanForestCalc.[h,cc]: … … 44 45 - set version number to 1 to allow writing it to ganymed output 45 46 - added Print function 47 - Use GetEntriesFast and UncheckedAt in Process for 48 single tree forests 46 49 47 50 * mranforest/MRanTree.[h,cc]: 48 51 - replaced type of fClassify by Bool_t 52 - added Getter for fClassify 49 53 50 54 * mjtrain/MJTrainDisp.cc, mjtrain/MJTrainEnegry.cc: -
trunk/MagicSoft/Mars/mranforest/MRanForest.cc
r7420 r7424 133 133 } 134 134 135 MRanTree *MRanForest::GetTree(Int_t i) 136 { 137 return (MRanTree*)(fForest->At(i)); 135 void MRanForest::Print(Option_t *o) const 136 { 137 *fLog << inf << GetDescriptor() << ": " << endl; 138 MRanTree *t = GetTree(0); 139 if (t) 140 { 141 *fLog << "Setting up RF for training on target:" << endl; 142 *fLog << " " << t->GetTitle() << endl; 143 } 144 if (fRules) 145 { 146 *fLog << "Following rules are used as input to RF:" << endl; 147 for (Int_t i=0;i<fRules->GetNumEntries();i++) 148 *fLog << " " << i << ") " << (*fRules)[i].GetRule() << endl; 149 } 150 *fLog << "Random forest parameters:" << endl; 151 if (t) 152 { 153 *fLog << " - " << (t->IsClassify()?"classification":"regression") << " tree" << endl; 154 *fLog << " - Number of trys: " << t->GetNumTry() << endl; 155 *fLog << " - Node size: " << t->GetNdSize() << endl; 156 } 157 *fLog << " - Number of trees: " << fNumTrees << endl; 158 *fLog << " - User value: " << fUserVal << endl; 159 *fLog << endl; 138 160 } 139 161 … … 335 357 for (Int_t i=0;i<dim;i++) 336 358 *fLog << " " << i << ") " << (*fRules)[i].GetRule() << endl; 337 338 359 *fLog << endl; 339 360 … … 351 372 return kFALSE; 352 373 } 374 fRanTree->SetName(target_rule); 353 375 354 376 const Int_t tryest = TMath::Nint(TMath::Sqrt(dim)); -
trunk/MagicSoft/Mars/mranforest/MRanForest.h
r7420 r7424 73 73 MRanForest(const char *name=NULL, const char *title=NULL); 74 74 MRanForest(const MRanForest &rf); 75 ~MRanForest(); 75 76 76 ~MRanForest();77 void Print(Option_t *o="") const; //*MENU* 77 78 78 79 void SetGrid(const TArrayD &grid); … … 94 95 95 96 // getter methods 96 TObjArray *GetForest() { return fForest; }97 MRanTree *GetCurTree() { return fRanTree; }98 MRanTree *GetTree(Int_t i) ;99 MDataArray *GetRules() { return fRules; }97 TObjArray *GetForest() const { return fForest; } 98 MRanTree *GetCurTree() const { return fRanTree; } 99 MRanTree *GetTree(Int_t i) const { return static_cast<MRanTree*>(fForest->UncheckedAt(i)); } 100 MDataArray *GetRules() const { return fRules; } 100 101 101 102 -
trunk/MagicSoft/Mars/mranforest/MRanForestCalc.cc
r7423 r7424 309 309 310 310 // --------------- Single Tree RF ------------------- 311 if (fEForests.GetEntries ()==1)312 { 313 MRanForest *rf = (MRanForest*)fEForests[0];311 if (fEForests.GetEntriesFast()==1) 312 { 313 MRanForest *rf = static_cast<MRanForest*>fEForests.UncheckedAt(0); 314 314 fRFOut->SetVal(rf->CalcHadroness(event)); 315 315 fRFOut->SetReadyToSave(); -
trunk/MagicSoft/Mars/mranforest/MRanTree.h
r7420 r7424 78 78 Int_t GetNumNodes() const { return fNumNodes; } 79 79 Int_t GetNumEndNodes() const { return fNumEndNodes; } 80 Int_t IsClassify() const { return fClassify; } 80 81 Float_t GetError() const { return fError; } 81 82
Note:
See TracChangeset
for help on using the changeset viewer.