From b910e485c55b45edc7ee78f8e68a68d9f6a26430 Mon Sep 17 00:00:00 2001 From: Olivier Couet <olivier.couet@cern.ch> Date: Mon, 19 Dec 2016 14:26:22 +0100 Subject: [PATCH] - math formula in latex - Doxygen format - in group TMVA - remove trailing spaces - spell check --- tmva/tmva/inc/TMVA/MethodRuleFit.h | 20 ++--- tmva/tmva/src/MethodPlugins.cxx | 52 +++++------ tmva/tmva/src/MethodRuleFit.cxx | 134 ++++++++++++++--------------- 3 files changed, 103 insertions(+), 103 deletions(-) diff --git a/tmva/tmva/inc/TMVA/MethodRuleFit.h b/tmva/tmva/inc/TMVA/MethodRuleFit.h index 69c66bb687e..fc610927a23 100644 --- a/tmva/tmva/inc/TMVA/MethodRuleFit.h +++ b/tmva/tmva/inc/TMVA/MethodRuleFit.h @@ -8,15 +8,15 @@ * Web : http://tmva.sourceforge.net * * * * Description: * - * Friedman's RuleFit method * + * Friedman's RuleFit method * * * * Authors (alphabetical): * * Fredrik Tegenfeldt <Fredrik.Tegenfeldt@cern.ch> - Iowa State U., USA * * * * Copyright (c) 2005: * - * CERN, Switzerland * + * CERN, Switzerland * * Iowa State U. * - * MPI-K Heidelberg, Germany * + * MPI-K Heidelberg, Germany * * * * Redistribution and use in source and binary forms, with or without * * modification, are permitted according to the terms listed in LICENSE * @@ -59,7 +59,7 @@ namespace TMVA { public: MethodRuleFit( const TString& jobName, - const TString& methodTitle, + const TString& methodTitle, DataSetInfo& theData, const TString& theOption = ""); @@ -188,28 +188,28 @@ namespace TMVA { Int_t fRFNendnodes; // max number of rules (only Friedmans module) std::vector<DecisionTree *> fForest; // the forest Int_t fNTrees; // number of trees in forest - Double_t fTreeEveFrac; // fraction of events used for traing each tree + Double_t fTreeEveFrac; // fraction of events used for training each tree SeparationBase *fSepType; // the separation used in node splitting Double_t fMinFracNEve; // min fraction of number events Double_t fMaxFracNEve; // ditto max Int_t fNCuts; // grid used in cut applied in node splitting TString fSepTypeS; // forest generation: separation type - see DecisionTree TString fPruneMethodS; // forest generation: prune method - see DecisionTree - TMVA::DecisionTree::EPruneMethod fPruneMethod; // forest generation: method used for pruning - see DecisionTree + TMVA::DecisionTree::EPruneMethod fPruneMethod; // forest generation: method used for pruning - see DecisionTree Double_t fPruneStrength; // forest generation: prune strength - see DecisionTree TString fForestTypeS; // forest generation: how the trees are generated Bool_t fUseBoost; // use boosted events for forest generation // Double_t fGDPathEveFrac; // GD path: fraction of subsamples used for the fitting Double_t fGDValidEveFrac; // GD path: fraction of subsamples used for the fitting - Double_t fGDTau; // GD path: def threshhold fraction [0..1] + Double_t fGDTau; // GD path: def threshold fraction [0..1] Double_t fGDTauPrec; // GD path: precision of estimated tau - Double_t fGDTauMin; // GD path: min threshhold fraction [0..1] - Double_t fGDTauMax; // GD path: max threshhold fraction [0..1] + Double_t fGDTauMin; // GD path: min threshold fraction [0..1] + Double_t fGDTauMax; // GD path: max threshold fraction [0..1] UInt_t fGDTauScan; // GD path: number of points to scan Double_t fGDPathStep; // GD path: step size in path Int_t fGDNPathSteps; // GD path: number of steps - Double_t fGDErrScale; // GD path: stop + Double_t fGDErrScale; // GD path: stop Double_t fMinimp; // rule/linear: minimum importance // TString fModelTypeS; // rule ensemble: which model (rule,linear or both) diff --git a/tmva/tmva/src/MethodPlugins.cxx b/tmva/tmva/src/MethodPlugins.cxx index 0bc4dabb05c..546c4cf0eff 100644 --- a/tmva/tmva/src/MethodPlugins.cxx +++ b/tmva/tmva/src/MethodPlugins.cxx @@ -1,5 +1,5 @@ -// @(#)root/tmva $Id$ -// Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Kai Voss +// @(#)root/tmva $Id$ +// Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Kai Voss /********************************************************************************** * Project: TMVA - a Root-integrated toolkit for multivariate Data analysis * @@ -30,22 +30,22 @@ * (http://tmva.sourceforge.net/LICENSE) * **********************************************************************************/ -//////////////////////////////////////////////////////////////////////////////// +/*! \class TMVA::CreateMethodPlugins +\ingroup TMVA -/* Begin_Html +Plugins analysis - Plugins analysis - - <p> - The MethodPlugins is actually not a real method, but it is just a wrapper to call the TPluginsManager of ROOT and find - a external method which can be used to extend TMVA by another classifier. The only methods which are actually really implemented are the - constructors which fulfill the plugins handling. The others will produce FATAL warnings and stop TMVA execution. - <p> - Right after the constructor, the additional method 'getPlugedinMethod()' is called, which returns the method loaded by the plugin manager, - and the MethodPlugins object is already deleted. +The MethodPlugins is actually not a real method, but it is just a wrapper to call +the TPluginsManager of ROOT and find a external method which can be used to extend +TMVA by another classifier. The only methods which are actually really implemented +are the constructors which fulfill the plugins handling. The others will produce +FATAL warnings and stop TMVA execution. - End_Html */ -//_______________________________________________________________________ +Right after the constructor, the additional method 'getPlugedinMethod()' is called, +which returns the method loaded by the plugin manager, and the MethodPlugins object +is already deleted. + +*/ #include "TPluginManager.h" #include "TROOT.h" @@ -58,10 +58,10 @@ #include <cstdio> #include <iostream> -namespace -{ +namespace +{ TMVA::IMethod* CreateMethodPlugins(const TString& jobName, const TString& methodTitle, TMVA::DataSetInfo& theData, const TString& theOption) - { + { //std::cout << "CreateMethodPlugins is called with options : '" << jobName << "', '" << methodTitle<< "', " << theOption<< "'" << std::endl; TPluginManager *pluginManager(0); TPluginHandler *pluginHandler(0); @@ -78,30 +78,30 @@ namespace else myMethodTitle = methodTitle; pluginHandler = pluginManager->FindHandler("TMVA@@MethodBase", myMethodTitle); if(!pluginHandler) - { + { std::cerr << "Couldn't find plugin handler for TMVA@@MethodBase and " << methodTitle << std::endl; return 0; } //std::cout << "pluginHandler found myMethodTitle=" << myMethodTitle<<std::endl; if (pluginHandler->LoadPlugin() == 0) { - if(jobName=="" && methodTitle=="") { + if(jobName=="" && methodTitle=="") { //std::cout << "Calling ExpertPlugin " << std::endl; return (TMVA::IMethod*) pluginHandler->ExecPlugin(2, &theData, &theOption); - } else { + } else { //std::cout << "Calling TeacherPlugin " << std::endl; // pluginHandler->Print("a"); return (TMVA::IMethod*) pluginHandler->ExecPlugin(4, &jobName, &methodTitle, &theData, &theOption); - } + } } //std::cout << "plugin done" << std::endl; return 0; // end of function should never be reached. This is here to silence the compiler } - struct registration { - registration() { + struct registration { + registration() { TMVA::ClassifierFactory::Instance().Register("Plugins", CreateMethodPlugins); - TMVA::Types::Instance().AddTypeMapping(TMVA::Types::kPlugins, "Plugins"); - } + TMVA::Types::Instance().AddTypeMapping(TMVA::Types::kPlugins, "Plugins"); + } } instance; } diff --git a/tmva/tmva/src/MethodRuleFit.cxx b/tmva/tmva/src/MethodRuleFit.cxx index e7222599c15..61a2ddd36d0 100644 --- a/tmva/tmva/src/MethodRuleFit.cxx +++ b/tmva/tmva/src/MethodRuleFit.cxx @@ -14,19 +14,19 @@ * Fredrik Tegenfeldt <Fredrik.Tegenfeldt@cern.ch> - Iowa State U., USA * * * * Copyright (c) 2005: * - * CERN, Switzerland * + * CERN, Switzerland * * Iowa State U. * - * MPI-K Heidelberg, Germany * + * MPI-K Heidelberg, Germany * * * * Redistribution and use in source and binary forms, with or without * * modification, are permitted according to the terms listed in LICENSE * * (http://tmva.sourceforge.net/LICENSE) * **********************************************************************************/ -//_______________________________________________________________________ -// -// J Friedman's RuleFit method -//_______________________________________________________________________ +/*! \class TMVA:: +\ingroup TMVA +J Friedman's RuleFit method +*/ #include "TMVA/MethodRuleFit.h" @@ -63,13 +63,13 @@ using std::min; REGISTER_METHOD(RuleFit) ClassImp(TMVA::MethodRuleFit) - + //////////////////////////////////////////////////////////////////////////////// /// standard constructor TMVA::MethodRuleFit::MethodRuleFit( const TString& jobName, const TString& methodTitle, - DataSetInfo& theData, + DataSetInfo& theData, const TString& theOption) : MethodBase( jobName, Types::kRuleFit, methodTitle, theData, theOption) , fSignalFraction(0) @@ -90,7 +90,7 @@ ClassImp(TMVA::MethodRuleFit) , fRFNendnodes(0) , fNTrees(0) , fTreeEveFrac(0) - , fSepType(0) + , fSepType(0) , fMinFracNEve(0) , fMaxFracNEve(0) , fNCuts(0) @@ -137,7 +137,7 @@ TMVA::MethodRuleFit::MethodRuleFit( DataSetInfo& theData, , fRFNendnodes(0) , fNTrees(0) , fTreeEveFrac(0) - , fSepType(0) + , fSepType(0) , fMinFracNEve(0) , fMaxFracNEve(0) , fNCuts(0) @@ -170,7 +170,7 @@ TMVA::MethodRuleFit::~MethodRuleFit( void ) } //////////////////////////////////////////////////////////////////////////////// -/// RuleFit can handle classification with 2 classes +/// RuleFit can handle classification with 2 classes Bool_t TMVA::MethodRuleFit::HasAnalysisType( Types::EAnalysisType type, UInt_t numberClasses, UInt_t /*numberTargets*/ ) { @@ -179,51 +179,51 @@ Bool_t TMVA::MethodRuleFit::HasAnalysisType( Types::EAnalysisType type, UInt_t n } //////////////////////////////////////////////////////////////////////////////// -/// define the options (their key words) that can be set in the option string +/// define the options (their key words) that can be set in the option string /// know options. -///--------- -/// general -///--------- -/// RuleFitModule <string> -/// available values are: RFTMVA - use TMVA implementation -/// RFFriedman - use Friedmans original implementation -///---------------------- -/// Path search (fitting) -///---------------------- -/// GDTau <float> gradient-directed path: fit threshhold, default -/// GDTauPrec <float> gradient-directed path: precision of estimated tau -/// GDStep <float> gradient-directed path: step size -/// GDNSteps <float> gradient-directed path: number of steps -/// GDErrScale <float> stop scan when error>scale*errmin -///----------------- -/// Tree generation -///----------------- -/// fEventsMin <float> minimum fraction of events in a splittable node -/// fEventsMax <float> maximum fraction of events in a splittable node -/// nTrees <float> number of trees in forest. -/// ForestType <string> -/// available values are: Random - create forest using random subsample and only random variables subset at each node -/// AdaBoost - create forest with boosted events /// -///----------------- -/// Model creation -///----------------- -/// RuleMinDist <float> min distance allowed between rules -/// MinImp <float> minimum rule importance accepted -/// Model <string> model to be used -/// available values are: ModRuleLinear <default> -/// ModRule -/// ModLinear +/// #### general +/// +/// - RuleFitModule <string> +/// available values are: +/// - RFTMVA - use TMVA implementation +/// - RFFriedman - use Friedmans original implementation +/// +/// #### Path search (fitting) /// +/// - GDTau <float> gradient-directed path: fit threshold, default +/// - GDTauPrec <float> gradient-directed path: precision of estimated tau +/// - GDStep <float> gradient-directed path: step size +/// - GDNSteps <float> gradient-directed path: number of steps +/// - GDErrScale <float> stop scan when error>scale*errmin ///----------------- -/// Friedmans module +/// #### Tree generation ///----------------- -/// RFWorkDir <string> directory where Friedmans module (rf_go.exe) is installed -/// RFNrules <int> maximum number of rules allowed -/// RFNendnodes <int> average number of end nodes in the forest of trees +/// - fEventsMin <float> minimum fraction of events in a splittable node +/// - fEventsMax <float> maximum fraction of events in a splittable node +/// - nTrees <float> number of trees in forest. +/// - ForestType <string> +/// available values are: +/// - Random - create forest using random subsample and only random variables subset at each node +/// - AdaBoost - create forest with boosted events /// +///#### Model creation +/// +/// - RuleMinDist <float> min distance allowed between rules +/// - MinImp <float> minimum rule importance accepted +/// - Model <string> model to be used +/// available values are: +/// - ModRuleLinear <default> +/// - ModRule +/// - ModLinear +/// +/// #### Friedmans module +/// +/// - RFWorkDir <string> directory where Friedmans module (rf_go.exe) is installed +/// - RFNrules <int> maximum number of rules allowed +/// - RFNendnodes <int> average number of end nodes in the forest of trees -void TMVA::MethodRuleFit::DeclareOptions() +void TMVA::MethodRuleFit::DeclareOptions() { DeclareOptionRef(fGDTau=-1, "GDTau", "Gradient-directed (GD) path: default fit cut-off"); DeclareOptionRef(fGDTauPrec=0.01, "GDTauPrec", "GD path: precision of tau"); @@ -237,7 +237,7 @@ void TMVA::MethodRuleFit::DeclareOptions() DeclareOptionRef(fMinFracNEve=0.1, "fEventsMin", "Minimum fraction of events in a splittable node"); DeclareOptionRef(fMaxFracNEve=0.9, "fEventsMax", "Maximum fraction of events in a splittable node"); DeclareOptionRef(fNTrees=20, "nTrees", "Number of trees in forest."); - + DeclareOptionRef(fForestTypeS="AdaBoost", "ForestType", "Method to use for forest generation (AdaBoost or RandomForest)"); AddPreDefVal(TString("AdaBoost")); AddPreDefVal(TString("Random")); @@ -259,13 +259,13 @@ void TMVA::MethodRuleFit::DeclareOptions() } //////////////////////////////////////////////////////////////////////////////// -/// process the options specified by the user +/// process the options specified by the user -void TMVA::MethodRuleFit::ProcessOptions() +void TMVA::MethodRuleFit::ProcessOptions() { if (IgnoreEventsWithNegWeightsInTraining()) { Log() << kFATAL << "Mechanism to ignore events with negative weights in training not yet available for method: " - << GetMethodTypeName() + << GetMethodTypeName() << " --> please remove \"IgnoreNegWeightsInTraining\" option from booking string." << Endl; } @@ -450,7 +450,7 @@ void TMVA::MethodRuleFit::Train( void ) if (fUseRuleFitJF) { TrainJFRuleFit(); - } + } else { TrainTMVARuleFit(); } @@ -464,8 +464,8 @@ void TMVA::MethodRuleFit::Train( void ) void TMVA::MethodRuleFit::TrainTMVARuleFit( void ) { - if (IsNormalised()) Log() << kFATAL << "\"Normalise\" option cannot be used with RuleFit; " - << "please remove the optoin from the configuration string, or " + if (IsNormalised()) Log() << kFATAL << "\"Normalise\" option cannot be used with RuleFit; " + << "please remove the option from the configuration string, or " << "use \"!Normalise\"" << Endl; @@ -475,7 +475,7 @@ void TMVA::MethodRuleFit::TrainTMVARuleFit( void ) // test tree nmin cut -> for debug purposes // the routine will generate trees with stopping cut on N(eve) given by // a fraction between [20,N(eve)-1]. - // + // // MakeForestRnd(); // exit(1); // @@ -519,8 +519,8 @@ void TMVA::MethodRuleFit::TrainTMVARuleFit( void ) fNTSSB = rule->GetSSB(); fMonitorNtuple->Fill(); } - - fRuleFit.MakeVisHists(); + + fRuleFit.MakeVisHists(); fRuleFit.MakeDebugHists(); } Log() << kDEBUG << "Training done" << Endl; @@ -573,7 +573,7 @@ void TMVA::MethodRuleFit::TrainJFRuleFit( void ) //////////////////////////////////////////////////////////////////////////////// /// computes ranking of input variables -const TMVA::Ranking* TMVA::MethodRuleFit::CreateRanking() +const TMVA::Ranking* TMVA::MethodRuleFit::CreateRanking() { // create the ranking object fRanking = new Ranking( GetName(), "Importance" ); @@ -588,7 +588,7 @@ const TMVA::Ranking* TMVA::MethodRuleFit::CreateRanking() //////////////////////////////////////////////////////////////////////////////// /// add the rules to XML node -void TMVA::MethodRuleFit::AddWeightsXMLTo( void* parent ) const +void TMVA::MethodRuleFit::AddWeightsXMLTo( void* parent ) const { fRuleFit.GetRuleEnsemble().AddXMLTo( parent ); } @@ -731,7 +731,7 @@ void TMVA::MethodRuleFit::MakeClassLinear( std::ostream& fout ) const fout << " rval+=" // << std::setprecision(10) << rens->GetLinCoefficients(il)*norm << "*std::min(" << setprecision(10) << rens->GetLinDP(il) // << ", std::max( inputValues[" << il << "]," << std::setprecision(10) << rens->GetLinDM(il) << "));" - << std::setprecision(10) << rens->GetLinCoefficients(il)*norm + << std::setprecision(10) << rens->GetLinCoefficients(il)*norm << "*std::min( double(" << std::setprecision(10) << rens->GetLinDP(il) << "), std::max( double(inputValues[" << il << "]), double(" << std::setprecision(10) << rens->GetLinDM(il) << ")));" << std::flush; @@ -743,7 +743,7 @@ void TMVA::MethodRuleFit::MakeClassLinear( std::ostream& fout ) const //////////////////////////////////////////////////////////////////////////////// /// get help message text /// -/// typical length of text line: +/// typical length of text line: /// "|--------------------------------------------------------------|" void TMVA::MethodRuleFit::GetHelpMessage() const @@ -785,12 +785,12 @@ void TMVA::MethodRuleFit::GetHelpMessage() const Log() << "evolution of the path is defined by a cut-off parameter, tau." << Endl; Log() << "This parameter is unknown and depends on the training data." << Endl; Log() << "A large value will tend to give large weights to a few rules." << Endl; - Log() << "Similarily, a small value will lead to a large set of rules" << Endl; + Log() << "Similarly, a small value will lead to a large set of rules" << Endl; Log() << "with similar weights." << Endl; Log() << Endl; Log() << "A final point is the model used; rules and/or linear terms." << Endl; Log() << "For a given training sample, the result may improve by adding" << Endl; - Log() << "linear terms. If best performance is optained using only linear" << Endl; + Log() << "linear terms. If best performance is obtained using only linear" << Endl; Log() << "terms, it is very likely that the Fisher discriminant would be" << Endl; Log() << "a better choice. Ideally the fitting procedure should be able to" << Endl; Log() << "make this choice by giving appropriate weights for either terms." << Endl; @@ -800,7 +800,7 @@ void TMVA::MethodRuleFit::GetHelpMessage() const Log() << "I. TUNING OF RULE ENSEMBLE:" << Endl; Log() << Endl; Log() << " " << col << "ForestType " << colres - << ": Recomended is to use the default \"AdaBoost\"." << brk << Endl; + << ": Recommended is to use the default \"AdaBoost\"." << brk << Endl; Log() << " " << col << "nTrees " << colres << ": More trees leads to more rules but also slow" << Endl; Log() << " performance. With too few trees the risk is" << Endl; @@ -829,7 +829,7 @@ void TMVA::MethodRuleFit::GetHelpMessage() const Log() << " Increasing this fraction will improve the path" << Endl; Log() << " finding. However, a too high value will give few" << Endl; Log() << " unique events available for error estimation." << Endl; - Log() << " It is recomended to usethe default = 0.5." << brk << Endl; + Log() << " It is recommended to use the default = 0.5." << brk << Endl; Log() << " " << col << "GDTau " << colres << ": cutoff parameter tau" << Endl; Log() << " By default this value is set to -1.0." << Endl; -- GitLab