Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
MethodC50.h
Go to the documentation of this file.
1 // @(#)root/tmva/rmva $Id$
2 // Author: Omar Zapata,Lorenzo Moneta, Sergei Gleyzer 2015
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : RMethodC50 *
8  * *
9  * Description: *
10  * R´s Package C50 method based on ROOTR *
11  * *
12  **********************************************************************************/
13 
14 #ifndef ROOT_TMVA_RMethodC50
15 #define ROOT_TMVA_RMethodC50
16 
17 //////////////////////////////////////////////////////////////////////////
18 // //
19 // RMethodC50 //
20 // //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #include "TMVA/RMethodBase.h"
25 
26 namespace TMVA {
27 
28  class Factory; // DSMTEST
29  class Reader; // DSMTEST
30  class DataSetManager; // DSMTEST
31  class Types;
32  class MethodC50 : public RMethodBase {
33 
34  public :
35 
36  // constructors
37  MethodC50(const TString &jobName,
38  const TString &methodTitle,
39  DataSetInfo &theData,
40  const TString &theOption = "");
41 
42  MethodC50(DataSetInfo &dsi,
43  const TString &theWeightFile);
44 
45 
46  ~MethodC50(void);
47  void Train();
48  // options treatment
49  void Init();
50  void DeclareOptions();
51  void ProcessOptions();
52  // create ranking
53  const Ranking *CreateRanking()
54  {
55  return NULL; // = 0;
56  }
57 
58 
59  Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets);
60 
61  // performs classifier testing
62  virtual void TestClassification();
63 
64 
65  Double_t GetMvaValue(Double_t *errLower = 0, Double_t *errUpper = 0);
66  virtual void MakeClass(const TString &classFileName = TString("")) const; //required for model persistence
67  using MethodBase::ReadWeightsFromStream;
68  // the actual "weights"
69  virtual void AddWeightsXMLTo(void * /*parent*/) const {} // = 0;
70  virtual void ReadWeightsFromXML(void * /*weight*/) {} // = 0;
71  virtual void ReadWeightsFromStream(std::istream &) {} //= 0; // backward compatibility
72 
73  // signal/background classification response for all current set of data
74  virtual std::vector<Double_t> GetMvaValues(Long64_t firstEvt = 0, Long64_t lastEvt = -1, Bool_t logProgress = false);
75 
76  void ReadModelFromFile();
77  private :
78  DataSetManager *fDataSetManager; // DSMTEST
79  friend class Factory; // DSMTEST
80  friend class Reader; // DSMTEST
81  protected:
82  //C5.0 function options
83  UInt_t fNTrials;//number of trials with boost enabled
84  Bool_t fRules;//A logical: should the tree be decomposed into a rule-based model?
85 
86  //Control options see C5.0Control
87  Bool_t fControlSubset; //A logical: should the model evaluate groups of discrete predictors for splits?
88  UInt_t fControlBands;
89  Bool_t fControlWinnow;// A logical: should predictor winnowing (i.e feature selection) be used?
90  Bool_t fControlNoGlobalPruning; //A logical to toggle whether the final, global pruning step to simplify the tree.
91  Double_t fControlCF; //A number in (0, 1) for the confidence factor.
92  UInt_t fControlMinCases;//an integer for the smallest number of samples that must be put in at least two of the splits.
93  Bool_t fControlFuzzyThreshold;//A logical toggle to evaluate possible advanced splits of the data. See Quinlan (1993) for details and examples.
94  Double_t fControlSample;//A value between (0, .999) that specifies the random proportion of the data should be used to train the model.
95  Int_t fControlSeed;//An integer for the random number seed within the C code.
96  Bool_t fControlEarlyStopping;// logical to toggle whether the internal method for stopping boosting should be used.
97 
98  UInt_t fMvaCounter;
99  static Bool_t IsModuleLoaded;
100 
101  ROOT::R::TRFunctionImport predict;
102  ROOT::R::TRFunctionImport C50;
103  ROOT::R::TRFunctionImport C50Control;
104  ROOT::R::TRFunctionImport asfactor;
105  ROOT::R::TRObject *fModel;
106  ROOT::R::TRObject fModelControl;
107  std::vector <TString > ListOfVariables;
108 
109 
110  // get help message text
111  void GetHelpMessage() const;
112 
113  ClassDef(MethodC50, 0)
114  };
115 } // namespace TMVA
116 #endif