Changeset 1870
- Timestamp:
- 03/27/03 11:37:39 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MRanForest.cc
r1864 r1870 43 43 44 44 #include <TMatrix.h> 45 #include <TRandom3.h> 45 46 46 47 #include "MHMatrix.h" … … 60 61 fName = name ? name : "MRanForest"; 61 62 fTitle = title ? title : "Storage container for Random Forest"; 63 64 fForest=new TObjArray(); 65 fForest->SetOwner(kTRUE); 66 } 67 68 // -------------------------------------------------------------------------- 69 // 70 // Destructor. 71 // 72 MRanForest::~MRanForest() 73 { 74 delete fForest; 62 75 } 63 76 … … 88 101 { 89 102 Double_t hadroness=0; 90 Double_t ntree=0;103 Int_t ntree=0; 91 104 MRanTree *tree; 105 92 106 TIter forest(fForest); 107 forest.Reset(); 108 93 109 while ((tree=(MRanTree*)forest.Next())) 94 110 { … … 97 113 ntree++; 98 114 } 99 return hadroness/ntree; 100 } 101 102 void MRanForest::SetupForest() 103 { 104 fForest=new TObjArray(); 105 fForest->SetOwner(kTRUE); 106 } 107 108 void MRanForest::SetTree(MRanTree *rantree) 109 { 110 // initialize current tree for tree-growing loop in GrowForest 111 // ndsize + numtry are set in MRanForestGrow!! 112 fRanTree=rantree; 113 } 114 115 Bool_t MRanForest::AddTree() 116 { 115 return hadroness/Double_t(ntree); 116 } 117 118 Bool_t MRanForest::AddTree(MRanTree *rantree=NULL) 119 { 120 if (rantree) 121 fRanTree=rantree; 117 122 if (!fRanTree) 118 123 return kFALSE; 119 MRanTree *newtree=(MRanTree*)fRanTree->Clone(); 120 fForest->Add( newtree);124 125 fForest->Add((MRanTree*)fRanTree->Clone()); 121 126 122 127 return kTRUE; … … 149 154 fNTimesOutBag.Reset(); 150 155 151 fGiniDec.Set(fNumDim);152 153 156 fDataSort.Set(fNumDim*fNumData); 154 157 fDataRang.Set(fNumDim*fNumData); … … 175 178 CreateDataSort(); 176 179 177 SetupForest(); 178 179 if(!fRanTree)return kFALSE; 180 if(!fRanTree) 181 { 182 *fLog << err << dbginf << "MRanForest, fRanTree not initialized... aborting." << endl; 183 return kFALSE; 184 } 180 185 fRanTree->SetRules(fGammas->GetColumns()); 181 186 fTreeNo=0; … … 187 192 { 188 193 Int_t ninbag=0; 189 TArrayI datsortinbag; 190 TArrayF classpopw; 191 TArrayI jinbag; 192 TArrayF winbag; 194 TArrayI datsortinbag; 195 TArrayF classpopw; 196 TArrayI jinbag; 197 TArrayF winbag; 193 198 194 199 jinbag.Set(fNumData); … … 220 225 for (Int_t n=0;n<fNumData;n++) 221 226 { 222 Int_t k=Int_t(fNumData*fRand.Rndm()); 227 if(!gRandom) 228 gRandom=new TRandom3(0); 229 Int_t k=Int_t(fNumData*gRandom->Rndm()); 223 230 224 231 classpopw[fHadTrue[k]]+=fWeight[k]; … … 237 244 // growing single tree 238 245 fRanTree->GrowTree(hadrons,gammas,fNumData,fNumDim,fHadTrue,datsortinbag, 239 fDataRang, fGiniDec,classpopw,jinbag,winbag,fWeight,fRand);246 fDataRang,classpopw,jinbag,winbag,fWeight); 240 247 241 248 // error-estimates from out-of-bag data (oob data): … … 267 274 fErr=0; 268 275 for(Int_t ievt=0;ievt<fNumData;ievt++) 269 {270 276 if(fNTimesOutBag[ievt]!=0) 271 277 { … … 273 279 n++; 274 280 } 275 } 281 276 282 fErr/=Float_t(n); 277 283 fErr=TMath::Sqrt(fErr); … … 305 311 // value of all fData(m,.). There may be more then 1 event with rang r (due to bagging). 306 312 307 308 313 TArrayF v(fNumData); 309 314 TArrayI isort(fNumData); … … 313 318 314 319 for (Int_t j=0;j<fNumHad;j++) 315 {316 320 fHadTrue[j]=1; 317 }318 321 319 322 for (Int_t j=0;j<fNumGam;j++) 320 {321 323 fHadTrue[j+fNumHad]=0; 322 }323 324 324 325 325 for (Int_t mvar=0;mvar<fNumDim;mvar++) -
trunk/MagicSoft/Mars/manalysis/MRanForest.h
r1864 r1870 18 18 #endif 19 19 20 #ifndef ROOT_TObjArray 21 #include <TObjArray.h> 22 #endif 23 20 24 #ifndef ROOT_TRandom 21 25 #include <TRandom.h> … … 32 36 Int_t fTreeNo; 33 37 34 TRandom fRand;35 38 MRanTree *fRanTree; 36 39 TObjArray *fForest; … … 42 45 Int_t fNumGam; 43 46 Int_t fNumHad; 44 Int_t fNumData; 45 Int_t fNumDim; 47 Int_t fNumData; 48 Int_t fNumDim; 46 49 47 50 // true and estimated hadronness 48 TArrayI fHadTrue; 51 TArrayI fHadTrue; 49 52 TArrayF fHadEst; 50 53 … … 57 60 Bool_t fUsePriors; 58 61 TArrayF fPrior; 59 TArrayF fWeight; 62 TArrayF fWeight; 60 63 TArrayI fNTimesOutBag; 61 64 … … 63 66 TArrayD fTreeHad; 64 67 Float_t fErr; 65 66 // decrease in Gini-index67 TArrayF fGiniDec;68 68 69 69 protected: … … 74 74 public: 75 75 MRanForest(const char *name=NULL, const char *title=NULL); 76 ~MRanForest(); 76 77 77 78 // initialize forest … … 80 81 81 82 // tree growing 82 void SetupForest(); 83 void SetTree(MRanTree *rantree); 84 Bool_t AddTree(); 83 //void SetupForest(); 85 84 Bool_t SetupGrow(MHMatrix *mhad,MHMatrix *mgam); 86 85 Bool_t GrowForest(); 86 void SetCurTree(MRanTree *rantree) { fRanTree=rantree; } 87 Bool_t AddTree(MRanTree *rantree); 87 88 88 89 // getter methods 89 90 TObjArray *GetForest() { return fForest; } 91 MRanTree *GetCurTree() { return fRanTree; } 90 92 Int_t GetNumTrees() const { return fNumTrees; } 91 93 Int_t GetNumData() const { return fNumData; } 92 94 Int_t GetNumDim() const { return fNumDim; } 93 95 Double_t GetTreeHad(Int_t i) const { return fTreeHad.At(i); } 94 Float_t GetGiniDec(Int_t i) const { return fGiniDec.At(i); } 95 96 96 97 // use forest to calculate hadronness of event 97 98 Double_t CalcHadroness(TVector &event); -
trunk/MagicSoft/Mars/manalysis/MRanForestCalc.cc
r1864 r1870 37 37 38 38 #include "MHMatrix.h" // must be before MLogManip.h 39 #include "MDataArray.h" 39 40 40 41 #include "MLog.h" … … 104 105 } 105 106 106 fData = fRanTree->GetData(); 107 /*if(!fRanForest->GetCurTree()) 108 { 109 *fLog << err << dbginf << "MRanForest does not contain trees... aborting." << endl; 110 return kFALSE; 111 }*/ 112 113 fData = fRanTree->GetRules(); 107 114 108 115 if (!fData) -
trunk/MagicSoft/Mars/manalysis/MRanForestFill.cc
r1864 r1870 46 46 47 47 static const TString gsDefName = "MRanForestFill"; 48 static const TString gsDefTitle = "Tree Classification Loop 1/2";48 static const TString gsDefTitle = "Tree Classification Loop"; 49 49 50 50 // -------------------------------------------------------------------------- … … 86 86 } 87 87 88 fRanForest->SetupForest();89 88 fNum=0; 90 89 … … 98 97 { 99 98 fNum++; 100 fRanForest->SetTree(fRanTree); 101 if(!(fRanForest->AddTree())) 99 if(!(fRanForest->AddTree(fRanTree))) 102 100 return kFALSE; 103 101 -
trunk/MagicSoft/Mars/manalysis/MRanForestGrow.cc
r1864 r1870 96 96 97 97 fRanTree = (MRanTree*)plist->FindCreateObj("MRanTree"); 98 if (!fRanTree) 99 { 100 *fLog << err << dbginf << "MRanTree not found... aborting." << endl; 101 return kFALSE; 98 if (!fRanTree) 99 { 100 *fLog << err << dbginf << "MRanTree not found... aborting." << endl; 101 return kFALSE; 102 102 } 103 103 … … 111 111 fRanTree->SetNumTry(fNumTry); 112 112 fRanTree->SetNdSize(fNdSize); 113 113 fRanForest->SetCurTree(fRanTree); 114 114 fRanForest->SetNumTrees(fNumTrees); 115 fRanForest->SetTree(fRanTree);116 115 117 116 return fRanForest->SetupGrow(fMHadrons,fMGammas); … … 136 135 return kTRUE; 137 136 } 138 139 void MRanForestGrow::SetNumTrees(Int_t n)140 {141 fNumTrees=n;142 }143 144 void MRanForestGrow::SetNumTry(Int_t n)145 {146 fNumTry=n;147 }148 149 void MRanForestGrow::SetNdSize(Int_t n)150 {151 fNdSize=n;152 } -
trunk/MagicSoft/Mars/manalysis/MRanForestGrow.h
r1864 r1870 34 34 MRanForestGrow(const char *name=NULL, const char *title=NULL); 35 35 36 void SetNumTrees(Int_t n) ;37 void SetNumTry(Int_t n) ;38 void SetNdSize(Int_t n) ;36 void SetNumTrees(Int_t n){ fNumTrees=n;} 37 void SetNumTry(Int_t n) { fNumTry=n; } 38 void SetNdSize(Int_t n) { fNdSize=n; } 39 39 40 40 Bool_t PreProcess(MParList *pList); -
trunk/MagicSoft/Mars/manalysis/MRanTree.cc
r1866 r1870 47 47 // Default constructor. 48 48 // 49 MRanTree::MRanTree(const char *name, const char *title):fData(NULL) 50 { 49 MRanTree::MRanTree(const char *name, const char *title):fNdSize(0), fNumTry(3), fData(NULL) 50 { 51 51 52 fName = name ? name : "MRanTree"; 52 fTitle = title ? title : "Storage container for structure of a single tree and additional information";53 fTitle = title ? title : "Storage container for structure of a single tree"; 53 54 } 54 55 55 56 void MRanTree::SetNdSize(Int_t n) 56 57 { 57 // minimum nodesize of terminal nodes 58 // threshold nodesize of terminal nodes, i.e. the training data is splitted 59 // until there is only pure date in the subsets(=terminal nodes) or the 60 // subset size is LE n 61 58 62 fNdSize=TMath::Max(1,n);//at least 1 event per node 59 63 } … … 62 66 { 63 67 // number of trials in random split selection: 64 // choose at least 1 variable to split in... 68 // choose at least 1 variable to split in 69 65 70 fNumTry=TMath::Max(1,n); 66 // and not more candidates than available 67 if(fData) 68 fNumTry=TMath::Min(fData->GetNumEntries(),n); 69 } 70 71 void MRanTree::GrowTree(TMatrix &mhad,TMatrix &mgam,Int_t numdata, Int_t numdim,TArrayI &hadtrue,TArrayI &datasort, 72 TArrayI &datarang,TArrayF &ginidec,TArrayF &tclasspop,TArrayI &jinbag, 73 TArrayF &winbag,TArrayF &weight,TRandom &rand) 74 { 75 //Int_t nrnodes=2*(numdata/fNdSize)+1; 71 } 72 73 void MRanTree::GrowTree(TMatrix &mhad,TMatrix &mgam,Int_t numdata, Int_t numdim,TArrayI &hadtrue, 74 TArrayI &datasort,TArrayI &datarang,TArrayF &tclasspop,TArrayI &jinbag, 75 TArrayF &winbag,TArrayF &weight) 76 { 77 // arrays have to be initialized with generous size, so number of total nodes (nrnodes) 78 // is estimated for worst case 76 79 Int_t nrnodes=2*numdata+1; 80 81 // number of events in bootstrap sample 77 82 Int_t ninbag=0; 78 83 for (Int_t n=0;n<numdata;n++) 79 84 if(jinbag[n]==1) ninbag++; 80 85 86 // weighted class populations after split 87 TArrayF wl(2); // left node 88 TArrayF wc(2); 89 TArrayF wr(2); // right node 90 TArrayI nc(2); 81 91 82 92 TArrayI bestsplit(nrnodes); 83 TArrayF wl(2);84 TArrayF wc(2);85 TArrayF wr(2);86 TArrayI nc(2);87 88 93 TArrayI bestsplitnext(nrnodes); 89 94 TArrayI nodepop(nrnodes); … … 107 112 fBestSplit.Reset(); 108 113 114 fGiniDec.Set(numdim); 115 fGiniDec.Reset(); 116 109 117 // tree growing 110 118 BuildTree(datasort,datarang,hadtrue,numdim,numdata,bestsplit, 111 bestsplitnext,ginidec,nodepop,nodestart,tclasspop,nrnodes, 112 idmove,ncase,parent,jinbag,iv,winbag,wr,wc,wl,ninbag,rand); 113 119 bestsplitnext,nodepop,nodestart,tclasspop,nrnodes, 120 idmove,ncase,parent,jinbag,iv,winbag,wr,wc,wl,ninbag); 121 122 // post processing, determine cut (or split) values fBestSplit 114 123 Int_t nhad=mhad.GetNrows(); 115 124 … … 128 137 } 129 138 139 // resizing arrays to save memory 130 140 fBestVar.Set(fNumNodes); 131 141 fTreeMap1.Set(fNumNodes); … … 138 148 Int_t &msplit,Float_t &decsplit,Int_t &nbest,TArrayI &ncase, 139 149 TArrayI &jinbag,TArrayI &iv,TArrayF &winbag,TArrayF &wr, 140 TArrayF &wc,TArrayF &wl,Int_t kbuild,TRandom &rand) 141 { 142 // For the best split, msplit is the variable split on. decsplit is the dec. in impurity. 150 TArrayF &wc,TArrayF &wl,Int_t kbuild) 151 { 152 // For the best split, msplit is the index of the variable (e.g Hillas par., zenith angle ,...) 153 // split on. decsplit is the decreae in impurity measured by Gini-index. 143 154 // nsplit is the case number of value of msplit split on, 144 155 // and nsplitnext is the case number of the next larger value of msplit. … … 148 159 Float_t rrn, rrd, rln, rld, u; 149 160 150 // compute initial values of numerator and denominator of Gini 161 // compute initial values of numerator and denominator of Gini-index, 162 // Gini index= pno/dno 151 163 Float_t pno=0; 152 164 Float_t pdo=0; … … 160 172 jstat=0; 161 173 162 // start main loop through variables to find best split 174 // start main loop through variables to find best split, 175 // (Gini-index as criterium crit) 163 176 164 177 critmax=-1.0e20; 178 179 // random split selection, number of trials = fNumTry 165 180 for(Int_t mt=0;mt<fNumTry;mt++) 166 181 { 167 mvar=Int_t(mdim*rand.Rndm()); 168 182 mvar=Int_t(mdim*gRandom->Rndm()); 183 184 // Gini index = rrn/rrd+rln/rld 169 185 rrn=pno; 170 186 rrd=pdo; … … 263 279 for (Int_t n=ndstart;n<=ndend;n++) 264 280 { 265 266 281 ih=datasort[msh*numdata+n]; 267 if (idmove[ih]==0) 268 { 282 if (idmove[ih]==0){ 269 283 k++; 270 284 tdatasort[k]=datasort[msh*numdata+n]; … … 272 286 } 273 287 for(Int_t k=ndstart;k<=ndend;k++) 274 {275 288 datasort[msh*numdata+k]=tdatasort[k]; 276 } 277 } 278 289 } 290 279 291 // compute case nos. for right and left nodes. 280 292 281 293 for(Int_t n=ndstart;n<=ndend;n++) 282 {283 294 ncase[n]=datasort[msplit*numdata+n]; 284 }285 295 286 296 return; … … 289 299 void MRanTree::BuildTree(TArrayI &datasort,TArrayI &datarang,TArrayI &hadtrue,Int_t mdim, 290 300 Int_t numdata,TArrayI &bestsplit,TArrayI &bestsplitnext, 291 TArray F &ginidec,TArrayI &nodepop,TArrayI &nodestart,TArrayF &tclasspop,301 TArrayI &nodepop,TArrayI &nodestart,TArrayF &tclasspop, 292 302 Int_t nrnodes,TArrayI &idmove,TArrayI &ncase,TArrayI &parent, 293 303 TArrayI &jinbag,TArrayI &iv,TArrayF &winbag,TArrayF &wr,TArrayF &wc, 294 TArrayF &wl,Int_t ninbag ,TRandom &rand)304 TArrayF &wl,Int_t ninbag) 295 305 { 296 306 // Buildtree consists of repeated calls to two void functions, FindBestSplit and MoveData. … … 336 346 if (kbuild>ncur) break; 337 347 if (nodestatus[kbuild]!=2) continue; 338 348 339 349 // initialize for next call to FindBestSplit 340 350 … … 342 352 ndend=ndstart+nodepop[kbuild]-1; 343 353 for (Int_t j=0;j<2;j++) 344 {345 354 tclasspop[j]=classpop[j*nrnodes+kbuild]; 346 }347 355 348 356 jstat=FindBestSplit(datasort,datarang,hadtrue,mdim,numdata, 349 357 ndstart,ndend,tclasspop,msplit,decsplit, 350 358 nbest,ncase,jinbag,iv,winbag,wr,wc,wl, 351 kbuild ,rand);359 kbuild); 352 360 353 361 if(jstat==1) { … … 356 364 }else{ 357 365 fBestVar[kbuild]=msplit; 358 ginidec[msplit]+=decsplit;366 fGiniDec[msplit]+=decsplit; 359 367 360 368 bestsplit[kbuild]=datasort[msplit*numdata+nbest]; … … 373 381 374 382 // find class populations in both nodes 375 383 376 384 for (Int_t n=ndstart;n<=ndendl;n++) 377 385 { … … 386 394 Int_t j=hadtrue[nc]; 387 395 classpop[j*nrnodes+ncur+2]+=winbag[nc]; 388 389 396 } 390 397 391 398 // check on nodestatus 392 399 393 400 nodestatus[ncur+1]=2; 394 401 nodestatus[ncur+2]=2; … … 402 409 popt2+=classpop[j*nrnodes+ncur+2]; 403 410 } 404 411 405 412 for (Int_t j=0;j<2;j++) 406 413 { … … 408 415 if (classpop[j*nrnodes+ncur+2]==popt2) nodestatus[ncur+2]=-1; 409 416 } 410 417 411 418 fTreeMap1[kbuild]=ncur+1; 412 419 fTreeMap2[kbuild]=ncur+2; … … 428 435 fNumEndNodes=0; 429 436 for (Int_t kn=0;kn<fNumNodes;kn++) 430 {431 437 if(nodestatus[kn]==-1) 432 438 { … … 438 444 { 439 445 // class + status of node kn coded into fBestVar[kn] 440 fBestVar[kn]=j-2; 446 fBestVar[kn]=j-2; 441 447 pp=classpop[j*nrnodes+kn]; 442 448 } … … 445 451 fBestSplit[kn]/=(classpop[0*nrnodes+kn]+classpop[1*nrnodes+kn]); 446 452 } 447 } 453 448 454 return; 449 455 } … … 468 474 469 475 Int_t m=fBestVar[kt]; 476 470 477 if (event(m)<=fBestSplit[kt]) 471 {472 478 kt=fTreeMap1[kt]; 473 }else{479 else 474 480 kt=fTreeMap2[kt]; 475 476 } 481 } 482 477 483 return fBestSplit[kt]; 478 484 } … … 500 506 501 507 Int_t m=fBestVar[kt]; 508 502 509 if (event(m)<=fBestSplit[kt]) 503 {504 510 kt=fTreeMap1[kt]; 505 }else{511 else 506 512 kt=fTreeMap2[kt]; 507 } 508 } 513 514 } 515 509 516 return fBestSplit[kt]; 510 517 } -
trunk/MagicSoft/Mars/manalysis/MRanTree.h
r1866 r1870 30 30 31 31 TArrayI fBestVar; 32 TArrayI fTreeMap1; 33 TArrayI fTreeMap2; 32 TArrayI fTreeMap1; 33 TArrayI fTreeMap2; 34 34 TArrayF fBestSplit; 35 36 TArrayF fGiniDec; 35 37 36 38 public: … … 41 43 void SetRules(MDataArray *rules); 42 44 43 MDataArray *Get Data() { return fData;}45 MDataArray *GetRules() { return fData;} 44 46 45 47 Int_t GetNdSize() const { return fNdSize; } … … 55 57 Float_t GetBestSplit(Int_t i)const { return fBestSplit.At(i); } 56 58 59 Float_t GetGiniDec(Int_t i) const { return fGiniDec.At(i); } 60 57 61 // functions used in tree growing process 58 62 void GrowTree(TMatrix &mhad,TMatrix &mgam,Int_t numdata, Int_t numdim,TArrayI &hadtrue, 59 TArrayI &datasort,TArrayI &datarang,TArrayF & ginidec,TArrayF &classpopw,60 TArray I &jinbag,TArrayF &winbag,TArrayF &weight,TRandom &rand);63 TArrayI &datasort,TArrayI &datarang,TArrayF &tclasspop,TArrayI &jinbag, 64 TArrayF &winbag,TArrayF &weight); 61 65 62 66 Int_t FindBestSplit(TArrayI &datasort,TArrayI &datarang,TArrayI &hadtrue,Int_t mdim, … … 64 68 Int_t &msplit,Float_t &decsplit,Int_t &nbest,TArrayI &ncase, 65 69 TArrayI &jinbag,TArrayI &iv,TArrayF &winbag,TArrayF &wr, 66 TArrayF &wc,TArrayF &wl,Int_t kbuild ,TRandom &rand);70 TArrayF &wc,TArrayF &wl,Int_t kbuild); 67 71 68 72 void MoveData(TArrayI &datasort,Int_t mdim,Int_t numdata,Int_t ndstart, … … 72 76 void BuildTree(TArrayI &datasort,TArrayI &datarang,TArrayI &hadtrue,Int_t mdim, 73 77 Int_t numdata,TArrayI &bestsplit,TArrayI &bestsplitnext, 74 TArray F &ginidec,TArrayI &nodepop,TArrayI &nodestart,TArrayF &tclasspop,78 TArrayI &nodepop,TArrayI &nodestart,TArrayF &tclasspop, 75 79 Int_t nrnodes,TArrayI &idmove,TArrayI &ncase,TArrayI &parent, 76 80 TArrayI &jinbag,TArrayI &iv,TArrayF &winbag,TArrayF &wr,TArrayF &wc, 77 TArrayF &wl,Int_t ninbag ,TRandom &rand);81 TArrayF &wl,Int_t ninbag); 78 82 79 83 Double_t TreeHad(TVector &event); -
trunk/MagicSoft/Mars/mhist/MHRanForest.cc
r1866 r1870 114 114 115 115 Int_t ntrees=fRanForest->GetNumTrees(); 116 116 //cout<<"filling"<<endl; 117 117 for (Int_t i=0;i<ntrees;i++) 118 118 { -
trunk/MagicSoft/Mars/mhist/MHRanForestGini.cc
r1866 r1870 41 41 #include "MParList.h" 42 42 #include "MBinning.h" 43 #include "MRanTree.h" 43 44 #include "MRanForest.h" 44 45 45 46 #include "MLog.h" 46 47 #include "MLogManip.h" 47 48 #include "MMcEvt.hxx"49 48 50 49 ClassImp(MHRanForestGini); … … 84 83 Bool_t MHRanForestGini::SetupFill(const MParList *plist) 85 84 { 86 fMcEvt = (MMcEvt*)plist->FindObject("MMcEvt");87 if (!fMcEvt)88 {89 *fLog << err << dbginf << "MMcEvt not found... aborting." << endl;90 return kFALSE;91 }92 93 85 fRanForest = (MRanForest*)plist->FindObject("MRanForest"); 94 86 if (!fRanForest) … … 111 103 { 112 104 for (Int_t i=0;i<fRanForest->GetNumDim();i++) 113 fGini[i]+=fRanForest->Get GiniDec(i);105 fGini[i]+=fRanForest->GetCurTree()->GetGiniDec(i); 114 106 115 107 return kTRUE; … … 163 155 { 164 156 g.GetXaxis()->SetRangeUser(0, fRanForest->GetNumTrees()); 165 g.GetXaxis()->SetTitle("No. of RF-input parameter parameter");157 g.GetXaxis()->SetTitle("No. of RF-input parameter"); 166 158 g.GetYaxis()->SetTitle("Mean decrease in Gini-index [a.u.]"); 167 159 g.SetMarkerStyle(kFullDotlarge); … … 193 185 { 194 186 fGraphGini->GetXaxis()->SetRangeUser(0, 1); 195 fGraphGini->GetXaxis()->SetTitle("No. of parameter");187 fGraphGini->GetXaxis()->SetTitle("No. of RF-input parameter"); 196 188 fGraphGini->GetYaxis()->SetTitle("Mean decrease in Gini-index [a.u.]"); 197 189 -
trunk/MagicSoft/Mars/mhist/MHRanForestGini.h
r1866 r1870 13 13 class TGraph; 14 14 class MParList; 15 class MMcEvt;16 15 class MRanForest; 16 class MRanTree; 17 17 18 18 class MHRanForestGini : public MH 19 19 { 20 20 private: 21 const MMcEvt *fMcEvt; //! 22 const MRanForest *fRanForest; //! 21 MRanForest *fRanForest; 23 22 24 TArrayF fGini; //!25 TGraph *fGraphGini; //->23 TArrayF fGini; 24 TGraph *fGraphGini; 26 25 27 26 public:
Note:
See TracChangeset
for help on using the changeset viewer.