Logo ROOT   6.10/09
Reference Guide
MethodRuleFit.cxx
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Fredrik Tegenfeldt
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : MethodRuleFit *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * Implementation (see header file for description) *
12  * *
13  * Authors (alphabetical): *
14  * Fredrik Tegenfeldt <Fredrik.Tegenfeldt@cern.ch> - Iowa State U., USA *
15  * *
16  * Copyright (c) 2005: *
17  * CERN, Switzerland *
18  * Iowa State U. *
19  * MPI-K Heidelberg, Germany *
20  * *
21  * Redistribution and use in source and binary forms, with or without *
22  * modification, are permitted according to the terms listed in LICENSE *
23  * (http://tmva.sourceforge.net/LICENSE) *
24  **********************************************************************************/
25 
26 /*! \class TMVA::MethodRuleFit
27 \ingroup TMVA
28 J Friedman's RuleFit method
29 */
30 
31 #include "TMVA/MethodRuleFit.h"
32 
33 #include "TMVA/ClassifierFactory.h"
34 #include "TMVA/Config.h"
35 #include "TMVA/Configurable.h"
36 #include "TMVA/CrossEntropy.h"
37 #include "TMVA/DataSet.h"
38 #include "TMVA/DecisionTree.h"
39 #include "TMVA/GiniIndex.h"
40 #include "TMVA/IMethod.h"
41 #include "TMVA/MethodBase.h"
43 #include "TMVA/MsgLogger.h"
44 #include "TMVA/Ranking.h"
45 #include "TMVA/RuleFitAPI.h"
46 #include "TMVA/SdivSqrtSplusB.h"
47 #include "TMVA/SeparationBase.h"
48 #include "TMVA/Timer.h"
49 #include "TMVA/Tools.h"
50 #include "TMVA/Types.h"
51 
52 #include "Riostream.h"
53 #include "TRandom3.h"
54 #include "TMath.h"
55 #include "TMatrix.h"
56 #include "TDirectory.h"
57 
58 #include <algorithm>
59 #include <list>
60 
61 using std::min;
62 
63 REGISTER_METHOD(RuleFit)
64 
66 
67 ////////////////////////////////////////////////////////////////////////////////
68 /// standard constructor
69 
71  const TString& methodTitle,
72  DataSetInfo& theData,
73  const TString& theOption) :
74  MethodBase( jobName, Types::kRuleFit, methodTitle, theData, theOption)
75  , fSignalFraction(0)
76  , fNTImportance(0)
77  , fNTCoefficient(0)
78  , fNTSupport(0)
79  , fNTNcuts(0)
80  , fNTNvars(0)
81  , fNTPtag(0)
82  , fNTPss(0)
83  , fNTPsb(0)
84  , fNTPbs(0)
85  , fNTPbb(0)
86  , fNTSSB(0)
87  , fNTType(0)
88  , fUseRuleFitJF(kFALSE)
89  , fRFNrules(0)
90  , fRFNendnodes(0)
91  , fNTrees(0)
92  , fTreeEveFrac(0)
93  , fSepType(0)
94  , fMinFracNEve(0)
95  , fMaxFracNEve(0)
96  , fNCuts(0)
97  , fPruneMethod(TMVA::DecisionTree::kCostComplexityPruning)
98  , fPruneStrength(0)
99  , fUseBoost(kFALSE)
100  , fGDPathEveFrac(0)
101  , fGDValidEveFrac(0)
102  , fGDTau(0)
103  , fGDTauPrec(0)
104  , fGDTauMin(0)
105  , fGDTauMax(0)
106  , fGDTauScan(0)
107  , fGDPathStep(0)
108  , fGDNPathSteps(0)
109  , fGDErrScale(0)
110  , fMinimp(0)
111  , fRuleMinDist(0)
112  , fLinQuantile(0)
113 {
114  fMonitorNtuple = NULL;
115 }
116 
117 ////////////////////////////////////////////////////////////////////////////////
118 /// constructor from weight file
119 
121  const TString& theWeightFile) :
122  MethodBase( Types::kRuleFit, theData, theWeightFile)
123  , fSignalFraction(0)
124  , fNTImportance(0)
125  , fNTCoefficient(0)
126  , fNTSupport(0)
127  , fNTNcuts(0)
128  , fNTNvars(0)
129  , fNTPtag(0)
130  , fNTPss(0)
131  , fNTPsb(0)
132  , fNTPbs(0)
133  , fNTPbb(0)
134  , fNTSSB(0)
135  , fNTType(0)
136  , fUseRuleFitJF(kFALSE)
137  , fRFNrules(0)
138  , fRFNendnodes(0)
139  , fNTrees(0)
140  , fTreeEveFrac(0)
141  , fSepType(0)
142  , fMinFracNEve(0)
143  , fMaxFracNEve(0)
144  , fNCuts(0)
145  , fPruneMethod(TMVA::DecisionTree::kCostComplexityPruning)
146  , fPruneStrength(0)
147  , fUseBoost(kFALSE)
148  , fGDPathEveFrac(0)
149  , fGDValidEveFrac(0)
150  , fGDTau(0)
151  , fGDTauPrec(0)
152  , fGDTauMin(0)
153  , fGDTauMax(0)
154  , fGDTauScan(0)
155  , fGDPathStep(0)
156  , fGDNPathSteps(0)
157  , fGDErrScale(0)
158  , fMinimp(0)
159  , fRuleMinDist(0)
160  , fLinQuantile(0)
161 {
163 }
164 
165 ////////////////////////////////////////////////////////////////////////////////
166 /// destructor
167 
169 {
170  for (UInt_t i=0; i<fEventSample.size(); i++) delete fEventSample[i];
171  for (UInt_t i=0; i<fForest.size(); i++) delete fForest[i];
172 }
173 
174 ////////////////////////////////////////////////////////////////////////////////
175 /// RuleFit can handle classification with 2 classes
176 
178 {
179  if (type == Types::kClassification && numberClasses == 2) return kTRUE;
180  return kFALSE;
181 }
182 
183 ////////////////////////////////////////////////////////////////////////////////
184 /// define the options (their key words) that can be set in the option string
185 /// know options.
186 ///
187 /// #### general
188 ///
189 /// - RuleFitModule <string>
190 /// available values are:
191 /// - RFTMVA - use TMVA implementation
192 /// - RFFriedman - use Friedmans original implementation
193 ///
194 /// #### Path search (fitting)
195 ///
196 /// - GDTau <float> gradient-directed path: fit threshold, default
197 /// - GDTauPrec <float> gradient-directed path: precision of estimated tau
198 /// - GDStep <float> gradient-directed path: step size
199 /// - GDNSteps <float> gradient-directed path: number of steps
200 /// - GDErrScale <float> stop scan when error>scale*errmin
201 ///-----------------
202 /// #### Tree generation
203 ///-----------------
204 /// - fEventsMin <float> minimum fraction of events in a splittable node
205 /// - fEventsMax <float> maximum fraction of events in a splittable node
206 /// - nTrees <float> number of trees in forest.
207 /// - ForestType <string>
208 /// available values are:
209 /// - Random - create forest using random subsample and only random variables subset at each node
210 /// - AdaBoost - create forest with boosted events
211 ///
212 ///#### Model creation
213 ///
214 /// - RuleMinDist <float> min distance allowed between rules
215 /// - MinImp <float> minimum rule importance accepted
216 /// - Model <string> model to be used
217 /// available values are:
218 /// - ModRuleLinear <default>
219 /// - ModRule
220 /// - ModLinear
221 ///
222 /// #### Friedmans module
223 ///
224 /// - RFWorkDir <string> directory where Friedmans module (rf_go.exe) is installed
225 /// - RFNrules <int> maximum number of rules allowed
226 /// - RFNendnodes <int> average number of end nodes in the forest of trees
227 
229 {
230  DeclareOptionRef(fGDTau=-1, "GDTau", "Gradient-directed (GD) path: default fit cut-off");
231  DeclareOptionRef(fGDTauPrec=0.01, "GDTauPrec", "GD path: precision of tau");
232  DeclareOptionRef(fGDPathStep=0.01, "GDStep", "GD path: step size");
233  DeclareOptionRef(fGDNPathSteps=10000, "GDNSteps", "GD path: number of steps");
234  DeclareOptionRef(fGDErrScale=1.1, "GDErrScale", "Stop scan when error > scale*errmin");
235  DeclareOptionRef(fLinQuantile, "LinQuantile", "Quantile of linear terms (removes outliers)");
236  DeclareOptionRef(fGDPathEveFrac=0.5, "GDPathEveFrac", "Fraction of events used for the path search");
237  DeclareOptionRef(fGDValidEveFrac=0.5, "GDValidEveFrac", "Fraction of events used for the validation");
238  // tree options
239  DeclareOptionRef(fMinFracNEve=0.1, "fEventsMin", "Minimum fraction of events in a splittable node");
240  DeclareOptionRef(fMaxFracNEve=0.9, "fEventsMax", "Maximum fraction of events in a splittable node");
241  DeclareOptionRef(fNTrees=20, "nTrees", "Number of trees in forest.");
242 
243  DeclareOptionRef(fForestTypeS="AdaBoost", "ForestType", "Method to use for forest generation (AdaBoost or RandomForest)");
244  AddPreDefVal(TString("AdaBoost"));
245  AddPreDefVal(TString("Random"));
246  // rule cleanup options
247  DeclareOptionRef(fRuleMinDist=0.001, "RuleMinDist", "Minimum distance between rules");
248  DeclareOptionRef(fMinimp=0.01, "MinImp", "Minimum rule importance accepted");
249  // rule model option
250  DeclareOptionRef(fModelTypeS="ModRuleLinear", "Model", "Model to be used");
251  AddPreDefVal(TString("ModRule"));
252  AddPreDefVal(TString("ModRuleLinear"));
253  AddPreDefVal(TString("ModLinear"));
254  DeclareOptionRef(fRuleFitModuleS="RFTMVA", "RuleFitModule","Which RuleFit module to use");
255  AddPreDefVal(TString("RFTMVA"));
256  AddPreDefVal(TString("RFFriedman"));
257 
258  DeclareOptionRef(fRFWorkDir="./rulefit", "RFWorkDir", "Friedman\'s RuleFit module (RFF): working dir");
259  DeclareOptionRef(fRFNrules=2000, "RFNrules", "RFF: Mximum number of rules");
260  DeclareOptionRef(fRFNendnodes=4, "RFNendnodes", "RFF: Average number of end nodes");
261 }
262 
263 ////////////////////////////////////////////////////////////////////////////////
264 /// process the options specified by the user
265 
267 {
269  Log() << kFATAL << "Mechanism to ignore events with negative weights in training not yet available for method: "
270  << GetMethodTypeName()
271  << " --> please remove \"IgnoreNegWeightsInTraining\" option from booking string."
272  << Endl;
273  }
274 
276  if (fRuleFitModuleS == "rftmva") fUseRuleFitJF = kFALSE;
277  else if (fRuleFitModuleS == "rffriedman") fUseRuleFitJF = kTRUE;
278  else fUseRuleFitJF = kTRUE;
279 
280  fSepTypeS.ToLower();
281  if (fSepTypeS == "misclassificationerror") fSepType = new MisClassificationError();
282  else if (fSepTypeS == "giniindex") fSepType = new GiniIndex();
283  else if (fSepTypeS == "crossentropy") fSepType = new CrossEntropy();
284  else fSepType = new SdivSqrtSplusB();
285 
287  if (fModelTypeS == "modlinear" ) fRuleFit.SetModelLinear();
288  else if (fModelTypeS == "modrule" ) fRuleFit.SetModelRules();
289  else fRuleFit.SetModelFull();
290 
293  else if (fPruneMethodS == "costcomplexity" ) fPruneMethod = DecisionTree::kCostComplexityPruning;
295 
297  if (fForestTypeS == "random" ) fUseBoost = kFALSE;
298  else if (fForestTypeS == "adaboost" ) fUseBoost = kTRUE;
299  else fUseBoost = kTRUE;
300  //
301  // if creating the forest by boosting the events
302  // the full training sample is used per tree
303  // -> only true for the TMVA version of RuleFit.
304  if (fUseBoost && (!fUseRuleFitJF)) fTreeEveFrac = 1.0;
305 
306  // check event fraction for tree generation
307  // if <0 set to automatic number
308  if (fTreeEveFrac<=0) {
309  Int_t nevents = Data()->GetNTrainingEvents();
310  Double_t n = static_cast<Double_t>(nevents);
311  fTreeEveFrac = min( 0.5, (100.0 +6.0*sqrt(n))/n);
312  }
313  // verify ranges of options
314  VerifyRange(Log(), "nTrees", fNTrees,0,100000,20);
315  VerifyRange(Log(), "MinImp", fMinimp,0.0,1.0,0.0);
316  VerifyRange(Log(), "GDTauPrec", fGDTauPrec,1e-5,5e-1);
317  VerifyRange(Log(), "GDTauMin", fGDTauMin,0.0,1.0);
318  VerifyRange(Log(), "GDTauMax", fGDTauMax,fGDTauMin,1.0);
319  VerifyRange(Log(), "GDPathStep", fGDPathStep,0.0,100.0,0.01);
320  VerifyRange(Log(), "GDErrScale", fGDErrScale,1.0,100.0,1.1);
321  VerifyRange(Log(), "GDPathEveFrac", fGDPathEveFrac,0.01,0.9,0.5);
322  VerifyRange(Log(), "GDValidEveFrac",fGDValidEveFrac,0.01,1.0-fGDPathEveFrac,1.0-fGDPathEveFrac);
323  VerifyRange(Log(), "fEventsMin", fMinFracNEve,0.0,1.0);
324  VerifyRange(Log(), "fEventsMax", fMaxFracNEve,fMinFracNEve,1.0);
325 
336 
337 
338  // check if Friedmans module is used.
339  // print a message concerning the options.
340  if (fUseRuleFitJF) {
341  Log() << kINFO << "" << Endl;
342  Log() << kINFO << "--------------------------------------" <<Endl;
343  Log() << kINFO << "Friedmans RuleFit module is selected." << Endl;
344  Log() << kINFO << "Only the following options are used:" << Endl;
345  Log() << kINFO << Endl;
346  Log() << kINFO << gTools().Color("bold") << " Model" << gTools().Color("reset") << Endl;
347  Log() << kINFO << gTools().Color("bold") << " RFWorkDir" << gTools().Color("reset") << Endl;
348  Log() << kINFO << gTools().Color("bold") << " RFNrules" << gTools().Color("reset") << Endl;
349  Log() << kINFO << gTools().Color("bold") << " RFNendnodes" << gTools().Color("reset") << Endl;
350  Log() << kINFO << gTools().Color("bold") << " GDNPathSteps" << gTools().Color("reset") << Endl;
351  Log() << kINFO << gTools().Color("bold") << " GDPathStep" << gTools().Color("reset") << Endl;
352  Log() << kINFO << gTools().Color("bold") << " GDErrScale" << gTools().Color("reset") << Endl;
353  Log() << kINFO << "--------------------------------------" <<Endl;
354  Log() << kINFO << Endl;
355  }
356 
357  // Select what weight to use in the 'importance' rule visualisation plots.
358  // Note that if UseCoefficientsVisHists() is selected, the following weight is used:
359  // w = rule coefficient * rule support
360  // The support is a positive number which is 0 if no events are accepted by the rule.
361  // Normally the importance gives more useful information.
362  //
363  //fRuleFit.UseCoefficientsVisHists();
365 
366  fRuleFit.SetMsgType( Log().GetMinType() );
367 
369 
370 }
371 
372 ////////////////////////////////////////////////////////////////////////////////
373 /// initialize the monitoring ntuple
374 
376 {
377  BaseDir()->cd();
378  fMonitorNtuple= new TTree("MonitorNtuple_RuleFit","RuleFit variables");
379  fMonitorNtuple->Branch("importance",&fNTImportance,"importance/D");
380  fMonitorNtuple->Branch("support",&fNTSupport,"support/D");
381  fMonitorNtuple->Branch("coefficient",&fNTCoefficient,"coefficient/D");
382  fMonitorNtuple->Branch("ncuts",&fNTNcuts,"ncuts/I");
383  fMonitorNtuple->Branch("nvars",&fNTNvars,"nvars/I");
384  fMonitorNtuple->Branch("type",&fNTType,"type/I");
385  fMonitorNtuple->Branch("ptag",&fNTPtag,"ptag/D");
386  fMonitorNtuple->Branch("pss",&fNTPss,"pss/D");
387  fMonitorNtuple->Branch("psb",&fNTPsb,"psb/D");
388  fMonitorNtuple->Branch("pbs",&fNTPbs,"pbs/D");
389  fMonitorNtuple->Branch("pbb",&fNTPbb,"pbb/D");
390  fMonitorNtuple->Branch("soversb",&fNTSSB,"soversb/D");
391 }
392 
393 ////////////////////////////////////////////////////////////////////////////////
394 /// default initialization
395 
397 {
398  // the minimum requirement to declare an event signal-like
399  SetSignalReferenceCut( 0.0 );
400 
401  // set variables that used to be options
402  // any modifications are then made in ProcessOptions()
403  fLinQuantile = 0.025; // Quantile of linear terms (remove outliers)
404  fTreeEveFrac = -1.0; // Fraction of events used to train each tree
405  fNCuts = 20; // Number of steps during node cut optimisation
406  fSepTypeS = "GiniIndex"; // Separation criterion for node splitting; see BDT
407  fPruneMethodS = "NONE"; // Pruning method; see BDT
408  fPruneStrength = 3.5; // Pruning strength; see BDT
409  fGDTauMin = 0.0; // Gradient-directed path: min fit threshold (tau)
410  fGDTauMax = 1.0; // Gradient-directed path: max fit threshold (tau)
411  fGDTauScan = 1000; // Gradient-directed path: number of points scanning for best tau
412 
413 }
414 
415 ////////////////////////////////////////////////////////////////////////////////
416 /// write all Events from the Tree into a vector of Events, that are
417 /// more easily manipulated.
418 /// This method should never be called without existing trainingTree, as it
419 /// the vector of events from the ROOT training tree
420 
422 {
423  if (Data()->GetNEvents()==0) Log() << kFATAL << "<Init> Data().TrainingTree() is zero pointer" << Endl;
424 
425  Int_t nevents = Data()->GetNEvents();
426  for (Int_t ievt=0; ievt<nevents; ievt++){
427  const Event * ev = GetEvent(ievt);
428  fEventSample.push_back( new Event(*ev));
429  }
430  if (fTreeEveFrac<=0) {
431  Double_t n = static_cast<Double_t>(nevents);
432  fTreeEveFrac = min( 0.5, (100.0 +6.0*sqrt(n))/n);
433  }
434  if (fTreeEveFrac>1.0) fTreeEveFrac=1.0;
435  //
436  std::random_shuffle(fEventSample.begin(), fEventSample.end());
437  //
438  Log() << kDEBUG << "Set sub-sample fraction to " << fTreeEveFrac << Endl;
439 }
440 
441 ////////////////////////////////////////////////////////////////////////////////
442 
444 {
446  // training of rules
447 
449 
450  // fill the STL Vector with the event sample
451  this->InitEventSample();
452 
453  if (fUseRuleFitJF) {
454  TrainJFRuleFit();
455  }
456  else {
458  }
462 }
463 
464 ////////////////////////////////////////////////////////////////////////////////
465 /// training of rules using TMVA implementation
466 
468 {
469  if (IsNormalised()) Log() << kFATAL << "\"Normalise\" option cannot be used with RuleFit; "
470  << "please remove the option from the configuration string, or "
471  << "use \"!Normalise\""
472  << Endl;
473 
474  // timer
475  Timer timer( 1, GetName() );
476 
477  // test tree nmin cut -> for debug purposes
478  // the routine will generate trees with stopping cut on N(eve) given by
479  // a fraction between [20,N(eve)-1].
480  //
481  // MakeForestRnd();
482  // exit(1);
483  //
484 
485  // Init RuleFit object and create rule ensemble
486  // + make forest & rules
487  fRuleFit.Initialize( this );
488 
489  // Make forest of decision trees
490  // if (fRuleFit.GetRuleEnsemble().DoRules()) fRuleFit.MakeForest();
491 
492  // Fit the rules
493  Log() << kDEBUG << "Fitting rule coefficients ..." << Endl;
495 
496  // Calculate importance
497  Log() << kDEBUG << "Computing rule and variable importance" << Endl;
499 
500  // Output results and fill monitor ntuple
502  //
503  if(!IsSilentFile())
504  {
505  Log() << kDEBUG << "Filling rule ntuple" << Endl;
506  UInt_t nrules = fRuleFit.GetRuleEnsemble().GetRulesConst().size();
507  const Rule *rule;
508  for (UInt_t i=0; i<nrules; i++ ) {
511  fNTSupport = rule->GetSupport();
512  fNTCoefficient = rule->GetCoefficient();
513  fNTType = (rule->IsSignalRule() ? 1:-1 );
514  fNTNvars = rule->GetRuleCut()->GetNvars();
515  fNTNcuts = rule->GetRuleCut()->GetNcuts();
516  fNTPtag = fRuleFit.GetRuleEnsemble().GetRulePTag(i); // should be identical with support
521  fNTSSB = rule->GetSSB();
522  fMonitorNtuple->Fill();
523  }
524 
527  }
528  Log() << kDEBUG << "Training done" << Endl;
529 
530 }
531 
532 ////////////////////////////////////////////////////////////////////////////////
533 /// training of rules using Jerome Friedmans implementation
534 
536 {
537  fRuleFit.InitPtrs( this );
539  UInt_t nevents = Data()->GetNTrainingEvents();
540  std::vector<const TMVA::Event*> tmp;
541  for (Long64_t ievt=0; ievt<nevents; ievt++) {
542  const Event *event = GetEvent(ievt);
543  tmp.push_back(event);
544  }
546 
547  RuleFitAPI *rfAPI = new RuleFitAPI( this, &fRuleFit, Log().GetMinType() );
548 
549  rfAPI->WelcomeMessage();
550 
551  // timer
552  Timer timer( 1, GetName() );
553 
554  Log() << kINFO << "Training ..." << Endl;
555  rfAPI->TrainRuleFit();
556 
557  Log() << kDEBUG << "reading model summary from rf_go.exe output" << Endl;
558  rfAPI->ReadModelSum();
559 
560  // fRuleFit.GetRuleEnsemblePtr()->MakeRuleMap();
561 
562  Log() << kDEBUG << "calculating rule and variable importance" << Endl;
564 
565  // Output results and fill monitor ntuple
567  //
569 
570  delete rfAPI;
571 
572  Log() << kDEBUG << "done training" << Endl;
573 }
574 
575 ////////////////////////////////////////////////////////////////////////////////
576 /// computes ranking of input variables
577 
579 {
580  // create the ranking object
581  fRanking = new Ranking( GetName(), "Importance" );
582 
583  for (UInt_t ivar=0; ivar<GetNvar(); ivar++) {
585  }
586 
587  return fRanking;
588 }
589 
590 ////////////////////////////////////////////////////////////////////////////////
591 /// add the rules to XML node
592 
593 void TMVA::MethodRuleFit::AddWeightsXMLTo( void* parent ) const
594 {
595  fRuleFit.GetRuleEnsemble().AddXMLTo( parent );
596 }
597 
598 ////////////////////////////////////////////////////////////////////////////////
599 /// read rules from an std::istream
600 
602 {
604 }
605 
606 ////////////////////////////////////////////////////////////////////////////////
607 /// read rules from XML node
608 
610 {
611  fRuleFit.GetRuleEnsemblePtr()->ReadFromXML( wghtnode );
612 }
613 
614 ////////////////////////////////////////////////////////////////////////////////
615 /// returns MVA value for given event
616 
618 {
619  // cannot determine error
620  NoErrorCalc(err, errUpper);
621 
622  return fRuleFit.EvalEvent( *GetEvent() );
623 }
624 
625 ////////////////////////////////////////////////////////////////////////////////
626 /// write special monitoring histograms to file (here ntuple)
627 
629 {
630  BaseDir()->cd();
631  Log() << kINFO << "Write monitoring ntuple to file: " << BaseDir()->GetPath() << Endl;
633 }
634 
635 ////////////////////////////////////////////////////////////////////////////////
636 /// write specific classifier response
637 
638 void TMVA::MethodRuleFit::MakeClassSpecific( std::ostream& fout, const TString& className ) const
639 {
640  Int_t dp = fout.precision();
641  fout << " // not implemented for class: \"" << className << "\"" << std::endl;
642  fout << "};" << std::endl;
643  fout << "void " << className << "::Initialize(){}" << std::endl;
644  fout << "void " << className << "::Clear(){}" << std::endl;
645  fout << "double " << className << "::GetMvaValue__( const std::vector<double>& inputValues ) const {" << std::endl;
646  fout << " double rval=" << std::setprecision(10) << fRuleFit.GetRuleEnsemble().GetOffset() << ";" << std::endl;
647  MakeClassRuleCuts(fout);
648  MakeClassLinear(fout);
649  fout << " return rval;" << std::endl;
650  fout << "}" << std::endl;
651  fout << std::setprecision(dp);
652 }
653 
654 ////////////////////////////////////////////////////////////////////////////////
655 /// print out the rule cuts
656 
657 void TMVA::MethodRuleFit::MakeClassRuleCuts( std::ostream& fout ) const
658 {
659  Int_t dp = fout.precision();
660  if (!fRuleFit.GetRuleEnsemble().DoRules()) {
661  fout << " //" << std::endl;
662  fout << " // ==> MODEL CONTAINS NO RULES <==" << std::endl;
663  fout << " //" << std::endl;
664  return;
665  }
666  const RuleEnsemble *rens = &(fRuleFit.GetRuleEnsemble());
667  const std::vector< Rule* > *rules = &(rens->GetRulesConst());
668  const RuleCut *ruleCut;
669  //
670  std::list< std::pair<Double_t,Int_t> > sortedRules;
671  for (UInt_t ir=0; ir<rules->size(); ir++) {
672  sortedRules.push_back( std::pair<Double_t,Int_t>( (*rules)[ir]->GetImportance()/rens->GetImportanceRef(),ir ) );
673  }
674  sortedRules.sort();
675  //
676  fout << " //" << std::endl;
677  fout << " // here follows all rules ordered in importance (most important first)" << std::endl;
678  fout << " // at the end of each line, the relative importance of the rule is given" << std::endl;
679  fout << " //" << std::endl;
680  //
681  for ( std::list< std::pair<double,int> >::reverse_iterator itpair = sortedRules.rbegin();
682  itpair != sortedRules.rend(); itpair++ ) {
683  UInt_t ir = itpair->second;
684  Double_t impr = itpair->first;
685  ruleCut = (*rules)[ir]->GetRuleCut();
686  if (impr<rens->GetImportanceCut()) fout << " //" << std::endl;
687  fout << " if (" << std::flush;
688  for (UInt_t ic=0; ic<ruleCut->GetNvars(); ic++) {
689  Double_t sel = ruleCut->GetSelector(ic);
690  Double_t valmin = ruleCut->GetCutMin(ic);
691  Double_t valmax = ruleCut->GetCutMax(ic);
692  Bool_t domin = ruleCut->GetCutDoMin(ic);
693  Bool_t domax = ruleCut->GetCutDoMax(ic);
694  //
695  if (ic>0) fout << "&&" << std::flush;
696  if (domin) {
697  fout << "(" << std::setprecision(10) << valmin << std::flush;
698  fout << "<inputValues[" << sel << "])" << std::flush;
699  }
700  if (domax) {
701  if (domin) fout << "&&" << std::flush;
702  fout << "(inputValues[" << sel << "]" << std::flush;
703  fout << "<" << std::setprecision(10) << valmax << ")" <<std::flush;
704  }
705  }
706  fout << ") rval+=" << std::setprecision(10) << (*rules)[ir]->GetCoefficient() << ";" << std::flush;
707  fout << " // importance = " << Form("%3.3f",impr) << std::endl;
708  }
709  fout << std::setprecision(dp);
710 }
711 
712 ////////////////////////////////////////////////////////////////////////////////
713 /// print out the linear terms
714 
715 void TMVA::MethodRuleFit::MakeClassLinear( std::ostream& fout ) const
716 {
717  if (!fRuleFit.GetRuleEnsemble().DoLinear()) {
718  fout << " //" << std::endl;
719  fout << " // ==> MODEL CONTAINS NO LINEAR TERMS <==" << std::endl;
720  fout << " //" << std::endl;
721  return;
722  }
723  fout << " //" << std::endl;
724  fout << " // here follows all linear terms" << std::endl;
725  fout << " // at the end of each line, the relative importance of the term is given" << std::endl;
726  fout << " //" << std::endl;
727  const RuleEnsemble *rens = &(fRuleFit.GetRuleEnsemble());
728  UInt_t nlin = rens->GetNLinear();
729  for (UInt_t il=0; il<nlin; il++) {
730  if (rens->IsLinTermOK(il)) {
731  Double_t norm = rens->GetLinNorm(il);
732  Double_t imp = rens->GetLinImportance(il)/rens->GetImportanceRef();
733  fout << " rval+="
734  // << std::setprecision(10) << rens->GetLinCoefficients(il)*norm << "*std::min(" << setprecision(10) << rens->GetLinDP(il)
735  // << ", std::max( inputValues[" << il << "]," << std::setprecision(10) << rens->GetLinDM(il) << "));"
736  << std::setprecision(10) << rens->GetLinCoefficients(il)*norm
737  << "*std::min( double(" << std::setprecision(10) << rens->GetLinDP(il)
738  << "), std::max( double(inputValues[" << il << "]), double(" << std::setprecision(10) << rens->GetLinDM(il) << ")));"
739  << std::flush;
740  fout << " // importance = " << Form("%3.3f",imp) << std::endl;
741  }
742  }
743 }
744 
745 ////////////////////////////////////////////////////////////////////////////////
746 /// get help message text
747 ///
748 /// typical length of text line:
749 /// "|--------------------------------------------------------------|"
750 
752 {
753  TString col = gConfig().WriteOptionsReference() ? TString() : gTools().Color("bold");
754  TString colres = gConfig().WriteOptionsReference() ? TString() : gTools().Color("reset");
755  TString brk = gConfig().WriteOptionsReference() ? "<br>" : "";
756 
757  Log() << Endl;
758  Log() << col << "--- Short description:" << colres << Endl;
759  Log() << Endl;
760  Log() << "This method uses a collection of so called rules to create a" << Endl;
761  Log() << "discriminating scoring function. Each rule consists of a series" << Endl;
762  Log() << "of cuts in parameter space. The ensemble of rules are created" << Endl;
763  Log() << "from a forest of decision trees, trained using the training data." << Endl;
764  Log() << "Each node (apart from the root) corresponds to one rule." << Endl;
765  Log() << "The scoring function is then obtained by linearly combining" << Endl;
766  Log() << "the rules. A fitting procedure is applied to find the optimum" << Endl;
767  Log() << "set of coefficients. The goal is to find a model with few rules" << Endl;
768  Log() << "but with a strong discriminating power." << Endl;
769  Log() << Endl;
770  Log() << col << "--- Performance optimisation:" << colres << Endl;
771  Log() << Endl;
772  Log() << "There are two important considerations to make when optimising:" << Endl;
773  Log() << Endl;
774  Log() << " 1. Topology of the decision tree forest" << brk << Endl;
775  Log() << " 2. Fitting of the coefficients" << Endl;
776  Log() << Endl;
777  Log() << "The maximum complexity of the rules is defined by the size of" << Endl;
778  Log() << "the trees. Large trees will yield many complex rules and capture" << Endl;
779  Log() << "higher order correlations. On the other hand, small trees will" << Endl;
780  Log() << "lead to a smaller ensemble with simple rules, only capable of" << Endl;
781  Log() << "modeling simple structures." << Endl;
782  Log() << "Several parameters exists for controlling the complexity of the" << Endl;
783  Log() << "rule ensemble." << Endl;
784  Log() << Endl;
785  Log() << "The fitting procedure searches for a minimum using a gradient" << Endl;
786  Log() << "directed path. Apart from step size and number of steps, the" << Endl;
787  Log() << "evolution of the path is defined by a cut-off parameter, tau." << Endl;
788  Log() << "This parameter is unknown and depends on the training data." << Endl;
789  Log() << "A large value will tend to give large weights to a few rules." << Endl;
790  Log() << "Similarly, a small value will lead to a large set of rules" << Endl;
791  Log() << "with similar weights." << Endl;
792  Log() << Endl;
793  Log() << "A final point is the model used; rules and/or linear terms." << Endl;
794  Log() << "For a given training sample, the result may improve by adding" << Endl;
795  Log() << "linear terms. If best performance is obtained using only linear" << Endl;
796  Log() << "terms, it is very likely that the Fisher discriminant would be" << Endl;
797  Log() << "a better choice. Ideally the fitting procedure should be able to" << Endl;
798  Log() << "make this choice by giving appropriate weights for either terms." << Endl;
799  Log() << Endl;
800  Log() << col << "--- Performance tuning via configuration options:" << colres << Endl;
801  Log() << Endl;
802  Log() << "I. TUNING OF RULE ENSEMBLE:" << Endl;
803  Log() << Endl;
804  Log() << " " << col << "ForestType " << colres
805  << ": Recommended is to use the default \"AdaBoost\"." << brk << Endl;
806  Log() << " " << col << "nTrees " << colres
807  << ": More trees leads to more rules but also slow" << Endl;
808  Log() << " performance. With too few trees the risk is" << Endl;
809  Log() << " that the rule ensemble becomes too simple." << brk << Endl;
810  Log() << " " << col << "fEventsMin " << colres << brk << Endl;
811  Log() << " " << col << "fEventsMax " << colres
812  << ": With a lower min, more large trees will be generated" << Endl;
813  Log() << " leading to more complex rules." << Endl;
814  Log() << " With a higher max, more small trees will be" << Endl;
815  Log() << " generated leading to more simple rules." << Endl;
816  Log() << " By changing this range, the average complexity" << Endl;
817  Log() << " of the rule ensemble can be controlled." << brk << Endl;
818  Log() << " " << col << "RuleMinDist " << colres
819  << ": By increasing the minimum distance between" << Endl;
820  Log() << " rules, fewer and more diverse rules will remain." << Endl;
821  Log() << " Initially it is a good idea to keep this small" << Endl;
822  Log() << " or zero and let the fitting do the selection of" << Endl;
823  Log() << " rules. In order to reduce the ensemble size," << Endl;
824  Log() << " the value can then be increased." << Endl;
825  Log() << Endl;
826  // "|--------------------------------------------------------------|"
827  Log() << "II. TUNING OF THE FITTING:" << Endl;
828  Log() << Endl;
829  Log() << " " << col << "GDPathEveFrac " << colres
830  << ": fraction of events in path evaluation" << Endl;
831  Log() << " Increasing this fraction will improve the path" << Endl;
832  Log() << " finding. However, a too high value will give few" << Endl;
833  Log() << " unique events available for error estimation." << Endl;
834  Log() << " It is recommended to use the default = 0.5." << brk << Endl;
835  Log() << " " << col << "GDTau " << colres
836  << ": cutoff parameter tau" << Endl;
837  Log() << " By default this value is set to -1.0." << Endl;
838  // "|----------------|---------------------------------------------|"
839  Log() << " This means that the cut off parameter is" << Endl;
840  Log() << " automatically estimated. In most cases" << Endl;
841  Log() << " this should be fine. However, you may want" << Endl;
842  Log() << " to fix this value if you already know it" << Endl;
843  Log() << " and want to reduce on training time." << brk << Endl;
844  Log() << " " << col << "GDTauPrec " << colres
845  << ": precision of estimated tau" << Endl;
846  Log() << " Increase this precision to find a more" << Endl;
847  Log() << " optimum cut-off parameter." << brk << Endl;
848  Log() << " " << col << "GDNStep " << colres
849  << ": number of steps in path search" << Endl;
850  Log() << " If the number of steps is too small, then" << Endl;
851  Log() << " the program will give a warning message." << Endl;
852  Log() << Endl;
853  Log() << "III. WARNING MESSAGES" << Endl;
854  Log() << Endl;
855  Log() << col << "Risk(i+1)>=Risk(i) in path" << colres << brk << Endl;
856  Log() << col << "Chaotic behaviour of risk evolution." << colres << Endl;
857  // "|----------------|---------------------------------------------|"
858  Log() << " The error rate was still decreasing at the end" << Endl;
859  Log() << " By construction the Risk should always decrease." << Endl;
860  Log() << " However, if the training sample is too small or" << Endl;
861  Log() << " the model is overtrained, such warnings can" << Endl;
862  Log() << " occur." << Endl;
863  Log() << " The warnings can safely be ignored if only a" << Endl;
864  Log() << " few (<3) occur. If more warnings are generated," << Endl;
865  Log() << " the fitting fails." << Endl;
866  Log() << " A remedy may be to increase the value" << brk << Endl;
867  Log() << " "
868  << col << "GDValidEveFrac" << colres
869  << " to 1.0 (or a larger value)." << brk << Endl;
870  Log() << " In addition, if "
871  << col << "GDPathEveFrac" << colres
872  << " is too high" << Endl;
873  Log() << " the same warnings may occur since the events" << Endl;
874  Log() << " used for error estimation are also used for" << Endl;
875  Log() << " path estimation." << Endl;
876  Log() << " Another possibility is to modify the model - " << Endl;
877  Log() << " See above on tuning the rule ensemble." << Endl;
878  Log() << Endl;
879  Log() << col << "The error rate was still decreasing at the end of the path"
880  << colres << Endl;
881  Log() << " Too few steps in path! Increase "
882  << col << "GDNSteps" << colres << "." << Endl;
883  Log() << Endl;
884  Log() << col << "Reached minimum early in the search" << colres << Endl;
885 
886  Log() << " Minimum was found early in the fitting. This" << Endl;
887  Log() << " may indicate that the used step size "
888  << col << "GDStep" << colres << "." << Endl;
889  Log() << " was too large. Reduce it and rerun." << Endl;
890  Log() << " If the results still are not OK, modify the" << Endl;
891  Log() << " model either by modifying the rule ensemble" << Endl;
892  Log() << " or add/remove linear terms" << Endl;
893 }
void DeclareOptions()
define the options (their key words) that can be set in the option string know options.
void Init(void)
default initialization
Double_t GetImportanceRef() const
Definition: RuleEnsemble.h:264
void WelcomeMessage()
welcome message
Definition: RuleFitAPI.cxx:78
J Friedman&#39;s RuleFit method.
Definition: MethodRuleFit.h:47
void ReadWeightsFromXML(void *wghtnode)
read rules from XML node
MsgLogger & Endl(MsgLogger &ml)
Definition: MsgLogger.h:158
Double_t GetRulePBS(int i) const
Definition: RuleEnsemble.h:290
const RuleEnsemble & GetRuleEnsemble() const
Definition: RuleFit.h:140
Singleton class for Global types used by TMVA.
Definition: Types.h:73
void TrainRuleFit()
Definition: RuleFitAPI.h:201
long long Long64_t
Definition: RtypesCore.h:69
void WriteMonitoringHistosToFile(void) const
write special monitoring histograms to file (here ntuple)
J Friedman&#39;s RuleFit method.
Definition: RuleFitAPI.h:50
void ReadWeightsFromStream(std::istream &istr)
read rules from an std::istream
void CalcImportance()
calculates the importance of each rule
Definition: RuleFit.cxx:417
Double_t GetRulePTag(int i) const
Definition: RuleEnsemble.h:287
const std::vector< Double_t > & GetLinNorm() const
Definition: RuleEnsemble.h:270
UInt_t GetNvar() const
Definition: MethodBase.h:328
UInt_t GetNLinear() const
Definition: RuleEnsemble.h:273
virtual Int_t Fill()
Fill all branches.
Definition: TTree.cxx:4383
Config & gConfig()
void SetGDTau(Double_t t)
Definition: RuleFitParams.h:86
MsgLogger & Log() const
Definition: Configurable.h:122
void SetMsgType(EMsgType t)
set the current message type to that of mlog for this class and all other subtools ...
Definition: RuleFit.cxx:190
OptionBase * DeclareOptionRef(T &ref, const TString &name, const TString &desc="")
void InitMonitorNtuple()
initialize the monitoring ntuple
EAnalysisType
Definition: Types.h:125
const std::vector< TMVA::Rule * > & GetRulesConst() const
Definition: RuleEnsemble.h:267
Virtual base Class for all MVA method.
Definition: MethodBase.h:106
void FitCoefficients()
Fit the coefficients for the rule ensemble.
Definition: RuleFit.cxx:408
Basic string class.
Definition: TString.h:129
const RuleCut * GetRuleCut() const
Definition: Rule.h:137
const std::vector< Double_t > & GetVarImportance() const
Definition: RuleEnsemble.h:272
void SetGDTauPrec(Double_t p)
Definition: RuleFitParams.h:90
Ranking for variables in method (implementation)
Definition: Ranking.h:48
UInt_t GetNvars() const
Definition: RuleCut.h:70
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1099
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Ranking * CreateRanking()
computes ranking of input variables
void SetModelFull()
Definition: RuleFit.h:103
void TrainJFRuleFit()
training of rules using Jerome Friedmans implementation
Double_t GetCutMin(Int_t is) const
Definition: RuleCut.h:72
#define NULL
Definition: RtypesCore.h:88
void SetTrainingEvents(const std::vector< const TMVA::Event *> &el)
set the training events randomly
Definition: RuleFit.cxx:439
void SetModelLinear()
Definition: RuleFit.h:99
const std::vector< Double_t > & GetLinCoefficients() const
Definition: RuleEnsemble.h:269
MethodRuleFit(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="")
standard constructor
void SetModelRules()
Definition: RuleFit.h:101
const TString & GetInputLabel(Int_t i) const
Definition: MethodBase.h:334
Double_t GetMvaValue(Double_t *err=0, Double_t *errUpper=0)
returns MVA value for given event
Implementation of a rule.
Definition: Rule.h:48
double sqrt(double)
Implementation of the CrossEntropy as separation criterion.
Definition: CrossEntropy.h:43
TStopwatch timer
Definition: pirndm.C:37
TMVA::DecisionTree::EPruneMethod fPruneMethod
void ProcessOptions()
process the options specified by the user
Char_t GetCutDoMin(Int_t is) const
Definition: RuleCut.h:74
const std::vector< Double_t > & GetLinImportance() const
Definition: RuleEnsemble.h:271
void UseImportanceVisHists()
Definition: RuleFit.h:114
const Event * GetEvent() const
Definition: MethodBase.h:733
DataSet * Data() const
Definition: MethodBase.h:393
Double_t GetSSB() const
Definition: Rule.h:115
void MakeClassSpecific(std::ostream &, const TString &) const
write specific classifier response
void Print() const
print function
void SetGDErrScale(Double_t s)
Definition: RuleFitParams.h:89
void MakeClassLinear(std::ostream &) const
print out the linear terms
std::vector< TMVA::Event * > fEventSample
Class that contains all the data information.
Definition: DataSetInfo.h:60
Implementation of the SdivSqrtSplusB as separation criterion.
Bool_t ReadModelSum()
read model from rulefit.sum
Definition: RuleFitAPI.cxx:546
void TrainTMVARuleFit()
training of rules using TMVA implementation
RuleEnsemble * GetRuleEnsemblePtr()
Definition: RuleFit.h:141
Long64_t GetNTrainingEvents() const
Definition: DataSet.h:79
Char_t GetCutDoMax(Int_t is) const
Definition: RuleCut.h:75
void SetGDNPathSteps(Int_t np)
Definition: RuleFitParams.h:69
Implementation of the MisClassificationError as separation criterion.
UInt_t GetNEvents() const
temporary event when testing on a different DataSet than the own one
Definition: MethodBase.h:401
Double_t GetRulePSB(int i) const
Definition: RuleEnsemble.h:289
void SetGDTauScan(UInt_t n)
Definition: RuleFitParams.h:83
SeparationBase * fSepType
Double_t GetRulePBB(int i) const
Definition: RuleEnsemble.h:291
void * AddXMLTo(void *parent) const
write rules to XML
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Definition: TTree.cxx:9163
Bool_t HasTrainingTree() const
Definition: MethodBase.h:495
RuleFitParams * GetRuleFitParamsPtr()
Definition: RuleFit.h:143
A class describing a &#39;rule cut&#39;.
Definition: RuleCut.h:34
UInt_t GetNcuts() const
get number of cuts
Definition: RuleCut.cxx:164
Bool_t DoLinear() const
Definition: RuleEnsemble.h:257
const char * GetName() const
Definition: MethodBase.h:318
Double_t GetCoefficient() const
Definition: Rule.h:139
void MakeDebugHists()
this will create a histograms intended rather for debugging or for the curious user ...
Definition: RuleFit.cxx:936
Implementation of the GiniIndex as separation criterion.
Definition: GiniIndex.h:63
Implementation of a Decision Tree.
Definition: DecisionTree.h:59
unsigned int UInt_t
Definition: RtypesCore.h:42
char * Form(const char *fmt,...)
Tools & gTools()
Bool_t IsSilentFile()
Definition: MethodBase.h:363
virtual const char * GetPath() const
Returns the full path of the directory.
Definition: TDirectory.cxx:911
Bool_t IsLinTermOK(int i) const
Definition: RuleEnsemble.h:293
Double_t GetRulePSS(int i) const
Definition: RuleEnsemble.h:288
void ReadFromXML(void *wghtnode)
read rules from XML
const Bool_t kFALSE
Definition: RtypesCore.h:92
void GetHelpMessage() const
get help message text
Bool_t VerifyRange(MsgLogger &mlog, const char *varstr, T &var, const T &vmin, const T &vmax)
Bool_t IgnoreEventsWithNegWeightsInTraining() const
Definition: MethodBase.h:668
Double_t GetRelImportance() const
Definition: Rule.h:100
#define ClassImp(name)
Definition: Rtypes.h:336
double Double_t
Definition: RtypesCore.h:55
Bool_t WriteOptionsReference() const
Definition: Config.h:62
Bool_t IsNormalised() const
Definition: MethodBase.h:478
int type
Definition: TGX11.cxx:120
void MakeVisHists()
this will create histograms visualizing the rule ensemble
Definition: RuleFit.cxx:776
Double_t GetLinDM(int i) const
Definition: RuleEnsemble.h:283
void SetCurrentType(Types::ETreeType type) const
Definition: DataSet.h:100
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
void AddPreDefVal(const T &)
Definition: Configurable.h:168
void InitPtrs(const TMVA::MethodBase *rfbase)
initialize pointers
Definition: RuleFit.cxx:109
void ExitFromTraining()
Definition: MethodBase.h:446
void SetGDTauRange(Double_t t0, Double_t t1)
Definition: RuleFitParams.h:75
const TString & Color(const TString &)
human readable color strings
Definition: Tools.cxx:839
virtual Int_t Branch(TCollection *list, Int_t bufsize=32000, Int_t splitlevel=99, const char *name="")
Create one branch for each element in the collection.
Definition: TTree.cxx:1660
UInt_t GetSelector(Int_t is) const
Definition: RuleCut.h:71
void SetRuleMinDist(Double_t d)
Definition: RuleFit.h:107
Double_t GetOffset() const
Definition: RuleEnsemble.h:265
#define REGISTER_METHOD(CLASS)
for example
Abstract ClassifierFactory template that handles arbitrary types.
Ranking * fRanking
Definition: MethodBase.h:569
Bool_t IsSignalRule() const
Definition: Rule.h:117
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
Definition: TDirectory.cxx:435
TDirectory * BaseDir() const
returns the ROOT directory where info/histograms etc of the corresponding MVA method instance are sto...
TString GetMethodTypeName() const
Definition: MethodBase.h:316
virtual void AddRank(const Rank &rank)
Add a new rank take ownership of it.
Definition: Ranking.cxx:86
Bool_t DoRules() const
Definition: RuleEnsemble.h:258
Double_t GetCutMax(Int_t is) const
Definition: RuleCut.h:73
Long64_t GetNEvents(Types::ETreeType type=Types::kMaxTreeType) const
Definition: DataSet.h:215
Double_t GetLinDP(int i) const
Definition: RuleEnsemble.h:284
Double_t EvalEvent(const Event &e)
evaluate single event
Definition: RuleFit.cxx:431
A TTree object has a header with a name and a title.
Definition: TTree.h:78
virtual Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t)
RuleFit can handle classification with 2 classes.
virtual ~MethodRuleFit(void)
destructor
void Initialize(const TMVA::MethodBase *rfbase)
initialize the parameters of the RuleFit method and make rules
Definition: RuleFit.cxx:119
void MakeClassRuleCuts(std::ostream &) const
print out the rule cuts
const Bool_t kTRUE
Definition: RtypesCore.h:91
double norm(double *x, double *p)
Definition: unuranDistr.cxx:40
Double_t GetSupport() const
Definition: Rule.h:140
const Int_t n
Definition: legend1.C:16
Timing information for training and evaluation of MVA methods.
Definition: Timer.h:58
std::vector< DecisionTree * > fForest
void SetGDPathStep(Double_t s)
Definition: RuleFitParams.h:72
void SetImportanceCut(Double_t minimp=0)
Definition: RuleFit.h:105
void AddWeightsXMLTo(void *parent) const
add the rules to XML node
void NoErrorCalc(Double_t *const err, Double_t *const errUpper)
Definition: MethodBase.cxx:829
void SetSignalReferenceCut(Double_t cut)
Definition: MethodBase.h:348
void InitEventSample(void)
write all Events from the Tree into a vector of Events, that are more easily manipulated.
void SetLinQuantile(Double_t q)
Definition: RuleEnsemble.h:134
void ReadRaw(std::istream &istr)
read rule ensemble from stream