Changeset 7424 for trunk


Ignore:
Timestamp:
11/22/05 16:42:11 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r7422 r7424  
    3838     - improved handling of allocated memory (still to be checked
    3939       further)
     40     - added Print function
    4041
    4142   * mranforest/MRanForestCalc.[h,cc]:
     
    4445     - set version number to 1 to allow writing it to ganymed output
    4546     - added Print function
     47     - Use GetEntriesFast and UncheckedAt in Process for
     48       single tree forests
    4649
    4750   * mranforest/MRanTree.[h,cc]:
    4851     - replaced type of fClassify by Bool_t
     52     - added Getter for fClassify
    4953
    5054   * mjtrain/MJTrainDisp.cc, mjtrain/MJTrainEnegry.cc:
  • trunk/MagicSoft/Mars/mranforest/MRanForest.cc

    r7420 r7424  
    133133}
    134134
    135 MRanTree *MRanForest::GetTree(Int_t i)
    136 {
    137     return (MRanTree*)(fForest->At(i));
     135void 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;
    138160}
    139161
     
    335357    for (Int_t i=0;i<dim;i++)
    336358        *fLog << " " << i << ") " << (*fRules)[i].GetRule() << endl;
    337 
    338359    *fLog << endl;
    339360
     
    351372        return kFALSE;
    352373    }
     374    fRanTree->SetName(target_rule);
    353375
    354376    const Int_t tryest = TMath::Nint(TMath::Sqrt(dim));
  • trunk/MagicSoft/Mars/mranforest/MRanForest.h

    r7420 r7424  
    7373    MRanForest(const char *name=NULL, const char *title=NULL);
    7474    MRanForest(const MRanForest &rf);
     75    ~MRanForest();
    7576
    76     ~MRanForest();
     77    void Print(Option_t *o="") const; //*MENU*
    7778
    7879    void SetGrid(const TArrayD &grid);
     
    9495
    9596    // 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; }
    100101
    101102
  • trunk/MagicSoft/Mars/mranforest/MRanForestCalc.cc

    r7423 r7424  
    309309
    310310    // --------------- 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);
    314314        fRFOut->SetVal(rf->CalcHadroness(event));
    315315        fRFOut->SetReadyToSave();
  • trunk/MagicSoft/Mars/mranforest/MRanTree.h

    r7420 r7424  
    7878    Int_t GetNumNodes()          const { return fNumNodes; }
    7979    Int_t GetNumEndNodes()       const { return fNumEndNodes; }
     80    Int_t IsClassify() const { return fClassify; }
    8081    Float_t GetError() const { return fError; }
    8182
Note: See TracChangeset for help on using the changeset viewer.