33 #ifndef ROOT_TMVA_MethodBase 34 #define ROOT_TMVA_MethodBase 93 void Init(std::vector<TString>& graphTitles);
96 void AddPoint(std::vector<Double_t>& dat);
120 const TString& theOption =
"" );
134 virtual void CheckSetup();
146 virtual std::map<TString,Double_t> OptimizeTuningParameters(
TString fomType=
"ROCIntegral",
TString fitType=
"FitGA");
147 virtual void SetTuneParameters(std::map<TString,Double_t> tuneParameters);
149 virtual void Train() = 0;
160 virtual void TestClassification();
164 virtual void TestMulticlass();
175 virtual void Init() = 0;
176 virtual void DeclareOptions() = 0;
177 virtual void ProcessOptions() = 0;
178 virtual void DeclareCompatibilityOptions();
199 virtual std::vector<Double_t> GetMvaValues(
Long64_t firstEvt = 0,
Long64_t lastEvt = -1,
Bool_t logProgress =
false);
206 const std::vector<Float_t>* ptr = &GetRegressionValues();
212 std::vector<Float_t>* ptr =
new std::vector<Float_t>(0);
218 std::vector<Float_t>* ptr =
new std::vector<Float_t>(0);
230 virtual const Ranking* CreateRanking() = 0;
233 virtual void MakeClass(
const TString& classFileName =
TString(
"") )
const;
236 void PrintHelpMessage()
const;
242 void WriteStateToFile ()
const;
243 void ReadStateFromFile ();
247 virtual void AddWeightsXMLTo (
void* parent )
const = 0;
248 virtual void ReadWeightsFromXML (
void* wghtnode ) = 0;
249 virtual void ReadWeightsFromStream( std::istream& ) = 0;
255 void WriteStateToXML (
void* parent )
const;
256 void ReadStateFromXML (
void* parent );
257 void WriteStateToStream ( std::ostream& tf )
const;
258 void WriteVarsToStream ( std::ostream& tf,
const TString& prefix =
"" )
const;
262 void ReadStateFromStream ( std::istream& tf );
263 void ReadStateFromStream (
TFile& rf );
264 void ReadStateFromXMLString(
const char* xmlstr );
268 void AddVarsXMLTo (
void* parent )
const;
269 void AddSpectatorsXMLTo (
void* parent )
const;
270 void AddTargetsXMLTo (
void* parent )
const;
271 void AddClassesXMLTo (
void* parent )
const;
272 void ReadVariablesFromXML (
void* varnode );
273 void ReadSpectatorsFromXML(
void* specnode);
274 void ReadTargetsFromXML (
void* tarnode );
275 void ReadClassesFromXML (
void* clsnode );
276 void ReadVarsFromStream ( std::istream& istr );
285 virtual void WriteMonitoringHistosToFile()
const;
299 virtual std::vector<Float_t> GetMulticlassEfficiency( std::vector<std::vector<Float_t> >& purity );
300 virtual std::vector<Float_t> GetMulticlassTrainingEfficiency(std::vector<std::vector<Float_t> >& purity );
302 virtual Double_t GetSignificance()
const;
306 Double_t& optimal_significance_value )
const;
308 virtual Double_t GetSeparation(
PDF* pdfS = 0,
PDF* pdfB = 0 )
const;
318 const char*
GetName ()
const {
return fMethodName.Data(); }
321 TString GetWeightFileName()
const;
375 TString GetTrainingTMVAVersionString()
const;
376 TString GetTrainingROOTVersionString()
const;
380 if(fTransformationPointer && takeReroutedIfAvailable)
return *fTransformationPointer;
else return fTransformation;
384 if(fTransformationPointer && takeReroutedIfAvailable)
return *fTransformationPointer;
else return fTransformation;
402 const Event* GetEvent ()
const;
408 const std::vector<TMVA::Event*>& GetEventCollection(
Types::ETreeType type );
415 virtual Bool_t IsSignalLike();
431 bool fExitFromTraining =
false;
432 UInt_t fIPyMaxIter = 0, fIPyCurrentIter = 0;
438 if (fInteractive)
delete fInteractive;
447 fExitFromTraining =
true;
452 if (fExitFromTraining && fInteractive){
454 fInteractive =
nullptr;
456 return fExitFromTraining;
472 void SetWeightFileName(
TString );
475 void SetWeightFileDir(
TString fileDir );
529 void DeclareBaseOptions();
530 void ProcessBaseOptions();
539 void ResetThisBase();
544 void CreateMVAPdfs();
551 Bool_t GetLine( std::istream& fin,
char * buf );
730 return GetTransformationHandler().Transform(ev);
736 return GetTransformationHandler().Transform(fTmpEvent);
738 return GetTransformationHandler().Transform(
Data()->GetEvent());
743 assert(fTmpEvent==0);
744 return GetTransformationHandler().Transform(
Data()->GetEvent(ievt));
749 assert(fTmpEvent==0);
750 return GetTransformationHandler().Transform(
Data()->GetEvent(ievt, type));
755 assert(fTmpEvent==0);
761 assert(fTmpEvent==0);
Bool_t HasMVAPdfs() const
Types::EAnalysisType fAnalysisType
void SetModelPersistence(Bool_t status)
virtual void ReadWeightsFromStream(TFile &)
virtual const std::vector< Float_t > & GetMulticlassValues()
void AddPoint(Double_t x, Double_t y1, Double_t y2)
This function is used only in 2 TGraph case, and it will add new data points to graphs.
TString GetMethodName(Types::EMVA method) const
Bool_t fIgnoreNegWeightsInTraining
Bool_t IsConstructedFromWeightFile() const
virtual void MakeClassSpecificHeader(std::ostream &, const TString &="") const
const TString GetProbaName() const
std::vector< TGraph * > fGraphs
const TransformationHandler & GetTransformationHandler(Bool_t takeReroutedIfAvailable=true) const
static Types & Instance()
the the single instance of "Types" if existing already, or create it (Singleton)
const TString & GetOriginalVarName(Int_t ivar) const
TString fVariableTransformTypeString
void SetMethodBaseDir(TDirectory *methodDir)
Base class for spline implementation containing the Draw/Paint methods.
TransformationHandler * fTransformationPointer
Types::ESBType fVariableTransformType
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
A TMultiGraph is a collection of TGraph (or derived) objects.
void InitIPythonInteractive()
Virtual base Class for all MVA method.
const std::vector< Float_t > & GetRegressionValues(const TMVA::Event *const ev)
void SetSignalReferenceCutOrientation(Double_t cutOrientation)
virtual const std::vector< Float_t > & GetRegressionValues()
tomato 1-D histogram with a float per channel (see TH1 documentation)}
void SetTrainTime(Double_t trainTime)
TMultiGraph * fMultiGraph
const TString & GetInternalVarName(Int_t ivar) const
TransformationHandler & GetTransformationHandler(Bool_t takeReroutedIfAvailable=true)
Ranking for variables in method (implementation)
UInt_t GetNTargets() const
std::vector< TString > * fInputVars
const char * GetInputTitle(Int_t i) const
void SetSilentFile(Bool_t status)
Double_t GetMean(Int_t ivar) const
Double_t GetTrainTime() const
const TString & GetInputLabel(Int_t i) const
void SetMethodDir(TDirectory *methodDir)
const TString & GetWeightFileDir() const
const TString & GetInputVar(Int_t i) const
DataSetInfo & fDataSetInfo
#define ClassDef(name, id)
ECutOrientation fCutOrientation
Bool_t TxtWeightsOnly() const
UInt_t GetTrainingTMVAVersionCode() const
const Event * GetEvent() const
void ClearGraphs()
This function sets the point number to 0 for all graphs.
Virtual base class for combining several TMVA method.
~IPythonInteractive()
standard destructor
std::vector< std::vector< double > > Data
Double_t GetXmin(Int_t ivar) const
void Init(std::vector< TString > &graphTitles)
This function gets some title and it creates a TGraph for every title.
DataSetInfo & DataInfo() const
Bool_t DoRegression() const
Class that contains all the data information.
PDF wrapper for histograms; uses user-defined spline interpolation.
const Event * GetTrainingEvent(Long64_t ievt) const
UInt_t fTMVATrainingVersion
UInt_t GetNEvents() const
temporary event when testing on a different DataSet than the own one
Class for boosting a TMVA method.
Double_t GetXmax(Int_t ivar) const
TransformationHandler fTransformation
Bool_t DoMulticlass() const
Class that contains all the data information.
virtual void MakeClassSpecific(std::ostream &, const TString &="") const
const Event * GetTestingEvent(Long64_t ievt) const
Bool_t HasTrainingTree() const
std::string GetMethodName(TCppMethod_t)
TDirectory * fMethodBaseDir
UInt_t fROOTTrainingVersion
const char * GetName() const
UInt_t GetTrainingROOTVersionCode() const
const TString & GetJobName() const
const TString & GetMethodName() const
TSpline * fSplTrainEffBvsS
This is the main MVA steering class.
tomato 1-D histogram with a double per channel (see TH1 documentation)}
Linear interpolation of TGraph.
Double_t GetSignalReferenceCutOrientation() const
void SetNormalised(Bool_t norm)
Double_t GetTestTime() const
UInt_t GetNVariables() const
std::vector< const std::vector< TMVA::Event * > * > fEventCollections
TString fVerbosityLevelString
Class for categorizing the phase space.
Bool_t IgnoreEventsWithNegWeightsInTraining() const
void RerouteTransformationHandler(TransformationHandler *fTargetTransformation)
void SetTestTime(Double_t testTime)
Multivariate optimisation of signal efficiency for given background efficiency, applying rectangular ...
Describe directory structure in memory.
std::vector< Float_t > * fMulticlassReturnVal
Bool_t IsNormalised() const
void SetFile(TFile *file)
IPythonInteractive()
standard constructor
Bool_t fConstructedFromWeightFile
TString fVarTransformString
Interface for all concrete MVA method implementations.
Double_t GetRMS(Int_t ivar) const
Root finding using Brents algorithm (translated from CERNLIB function RZERO)
This class is needed by JsMVA, and it's a helper class for tracking errors during the training in Jup...
Abstract ClassifierFactory template that handles arbitrary types.
TString GetMethodTypeName() const
Class that is the base-class for a vector of result.
Double_t fSignalReferenceCut
the data set information (sometimes needed)
Double_t GetSignalReferenceCut() const
A Graph is a graphics object made of two arrays X and Y with npoints each.
void DisableWriting(Bool_t setter)
ECutOrientation GetCutOrientation() const
std::vector< Float_t > * fRegressionReturnVal
Types::EAnalysisType GetAnalysisType() const
A TTree object has a header with a name and a title.
const TString & GetTestvarName() const
void SetTestvarName(const TString &v="")
TMultiGraph * GetInteractiveTrainingError()
double norm(double *x, double *p)
Types::EMVA GetMethodType() const
void SetBaseDir(TDirectory *methodDir)
virtual void SetAnalysisType(Types::EAnalysisType type)
void SetSignalReferenceCut(Double_t cut)
Double_t fSignalReferenceCutOrientation
Bool_t IsModelPersistence()