33#ifndef ROOT_TMVA_MethodBase
34#define ROOT_TMVA_MethodBase
89 namespace Experimental {
92 class TrainingHistory;
98 void Init(std::vector<TString>& graphTitles);
101 void AddPoint(std::vector<Double_t>& dat);
129 const TString& theOption =
"" );
222 std::vector<Float_t>* ptr =
new std::vector<Float_t>(0);
228 std::vector<Float_t>* ptr =
new std::vector<Float_t>(0);
234 std::vector<Float_t>* ptr =
new std::vector<Float_t>(0);
322 Double_t& optimal_significance_value )
const;
754 return GetTransformationHandler().Transform(fTmpEvent);
756 return GetTransformationHandler().Transform(Data()->GetEvent());
761 assert(fTmpEvent==
nullptr);
762 return GetTransformationHandler().Transform(Data()->GetEvent(ievt));
767 assert(fTmpEvent==
nullptr);
768 return GetTransformationHandler().Transform(Data()->GetEvent(ievt,
type));
773 assert(fTmpEvent==
nullptr);
779 assert(fTmpEvent==
nullptr);
#define ClassDef(name, id)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char y1
Describe directory structure in memory.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
A TGraph is an object made of two arrays X and Y with npoints each.
1-D histogram with a double per channel (see TH1 documentation)
1-D histogram with a float per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
Class to perform two class classification.
Class to perform cross validation, splitting the dataloader into folds.
Class that contains all the data information.
UInt_t GetNVariables() const
UInt_t GetNTargets() const
DataSet * GetDataSet() const
returns data set
VariableInfo & GetVariableInfo(Int_t i)
Class that contains all the data information.
Long64_t GetNEvents(Types::ETreeType type=Types::kMaxTreeType) const
Long64_t GetNTrainingEvents() const
This is the main MVA steering class.
Interface for all concrete MVA method implementations.
This class is needed by JsMVA, and it's a helper class for tracking errors during the training in Jup...
void Init(std::vector< TString > &graphTitles)
This function gets some title and it creates a TGraph for every title.
IPythonInteractive()
standard constructor
TMultiGraph * fMultiGraph
std::vector< TGraph * > fGraphs
~IPythonInteractive()
standard destructor
void ClearGraphs()
This function sets the point number to 0 for all graphs.
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.
Virtual base Class for all MVA method.
TransformationHandler * fTransformationPointer
pointer to the rest of transformations
virtual void MakeClassSpecificHeader(std::ostream &, const TString &="") const
TString fVerbosityLevelString
verbosity level (user input string)
TDirectory * MethodBaseDir() const
returns the ROOT directory where all instances of the corresponding MVA method are stored
virtual const std::vector< Float_t > & GetRegressionValues()
const std::vector< Float_t > & GetRegressionValues(const TMVA::Event *const ev)
PDF * fSplB
PDFs of MVA distribution (background)
Bool_t fVerbose
verbose flag
virtual Double_t GetKSTrainingVsTest(Char_t SorB, TString opt="X")
virtual Double_t GetMvaValue(Double_t *errLower=nullptr, Double_t *errUpper=nullptr)=0
virtual Double_t GetSeparation(TH1 *, TH1 *) const
compute "separation" defined as
TString fFileDir
unix sub-directory for weight files (default: DataLoader's Name + "weights")
DataSet * fTmpData
temporary event when testing on a different DataSet than the own one
Bool_t HasTrainingTree() const
virtual void DeclareOptions()=0
void SetSilentFile(Bool_t status)
void ReadClassesFromXML(void *clsnode)
read number of classes from XML
TMultiGraph * GetInteractiveTrainingError()
void SetWeightFileDir(TString fileDir)
set directory of weight file
void WriteStateToXML(void *parent) const
general method used in writing the header of the weight files where the used variables,...
void DeclareBaseOptions()
define the options (their key words) that can be set in the option string here the options valid for ...
Double_t fRmsB
RMS (background)
Double_t GetXmin(Int_t ivar) const
virtual void TestRegression(Double_t &bias, Double_t &biasT, Double_t &dev, Double_t &devT, Double_t &rms, Double_t &rmsT, Double_t &mInf, Double_t &mInfT, Double_t &corr, Types::ETreeType type)
calculate <sum-of-deviation-squared> of regression output versus "true" value from test sample
Double_t GetMean(Int_t ivar) const
virtual void DeclareCompatibilityOptions()
options that are used ONLY for the READER to ensure backward compatibility they are hence without any...
PDF * fSplTrainB
PDFs of training MVA distribution (background)
TString GetMethodTypeName() const
Bool_t DoMulticlass() const
virtual Double_t GetSignificance() const
compute significance of mean difference
void DisableWriting(Bool_t setter)
virtual void ReadWeightsFromXML(void *wghtnode)=0
virtual Double_t GetProba(const Event *ev)
TH1 * fEffS
efficiency histogram for rootfinder
const char * GetName() const
TString fParentDir
method parent name, like booster name
virtual const std::vector< Float_t > & GetMulticlassValues()
TSpline * fSplTrainEffBvsS
splines for training signal eff. versus background eff.
Types::EAnalysisType GetAnalysisType() const
virtual TMatrixD GetMulticlassConfusionMatrix(Double_t effB, Types::ETreeType type)
Construct a confusion matrix for a multiclass classifier.
UInt_t GetTrainingTMVAVersionCode() const
UInt_t fTMVATrainingVersion
Bool_t IsModelPersistence() const
Double_t fXmax
maximum (signal and background)
Double_t fMeanS
mean (signal)
Types::ESBType fVariableTransformType
const TString & GetInputVar(Int_t i) const
PDF * fSplTrainS
PDFs of training MVA distribution (signal)
void PrintHelpMessage() const
prints out method-specific help method
void SetMethodDir(TDirectory *methodDir)
const TString & GetJobName() const
Bool_t IgnoreEventsWithNegWeightsInTraining() const
virtual void WriteEvaluationHistosToFile(Types::ETreeType treetype)
writes all MVA evaluation histograms to file
virtual void TestMulticlass()
test multiclass classification
const TString & GetTestvarName() const
const std::vector< TMVA::Event * > & GetEventCollection(Types::ETreeType type)
returns the event collection (i.e.
virtual std::vector< Double_t > GetDataMvaValues(DataSet *data=nullptr, Long64_t firstEvt=0, Long64_t lastEvt=-1, Bool_t logProgress=false)
get all the MVA values for the events of the given Data type
void SetupMethod()
setup of methods
TDirectory * BaseDir() const
returns the ROOT directory where info/histograms etc of the corresponding MVA method instance are sto...
const Event * GetTestingEvent(Long64_t ievt) const
virtual std::vector< Float_t > GetMulticlassEfficiency(std::vector< std::vector< Float_t > > &purity)
UInt_t GetNTargets() const
EMsgType fVerbosityLevel
verbosity level
const TString GetProbaName() const
TransformationHandler fTransformation
the list of transformations
virtual void ReadWeightsFromStream(std::istream &)=0
void AddInfoItem(void *gi, const TString &name, const TString &value) const
xml writing
TDirectory * fMethodBaseDir
virtual void AddClassifierOutputProb(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
PDF * fSplS
PDFs of MVA distribution (signal)
virtual void MakeClassSpecific(std::ostream &, const TString &="") const
Double_t fSignalReferenceCutOrientation
virtual Double_t GetEfficiency(const TString &, Types::ETreeType, Double_t &err)
fill background efficiency (resp.
TString GetTrainingTMVAVersionString() const
calculates the TMVA version string from the training version code on the fly
TSpline * fSpleffBvsS
splines for signal eff. versus background eff.
TString fVariableTransformTypeString
const TString & GetWeightFileDir() const
virtual void SetAnalysisType(Types::EAnalysisType type)
const TString & GetMethodName() const
Bool_t TxtWeightsOnly() const
void Statistics(Types::ETreeType treeType, const TString &theVarName, Double_t &, Double_t &, Double_t &, Double_t &, Double_t &, Double_t &)
calculates rms,mean, xmin, xmax of the event variable this can be either done for the variables as th...
virtual void ReadWeightsFromStream(TFile &)
UInt_t GetNEvents() const
Bool_t DoRegression() const
std::vector< Float_t > * fRegressionReturnVal
std::vector< Float_t > * fMulticlassReturnVal
Double_t fRmsS
RMS (signal)
Bool_t GetLine(std::istream &fin, char *buf)
reads one line from the input stream checks for certain keywords and interprets the line if keywords ...
const Event * GetEvent() const
TString fVarTransformString
labels variable transform method
void ProcessSetup()
process all options the "CheckForUnusedOptions" is done in an independent call, since it may be overr...
virtual void ProcessOptions()=0
virtual std::vector< Double_t > GetMvaValues(Long64_t firstEvt=0, Long64_t lastEvt=-1, Bool_t logProgress=false)
get all the MVA values for the events of the current Data type
virtual Bool_t IsSignalLike()
uses a pre-set cut on the MVA output (SetSignalReferenceCut and SetSignalReferenceCutOrientation) for...
void RerouteTransformationHandler(TransformationHandler *fTargetTransformation)
virtual ~MethodBase()
destructor
Bool_t HasMVAPdfs() const
PDF * fMVAPdfS
signal MVA PDF
virtual Double_t GetMaximumSignificance(Double_t SignalEvents, Double_t BackgroundEvents, Double_t &optimal_significance_value) const
plot significance, , curve for given number of signal and background events; returns cut for maximum ...
virtual Double_t GetTrainingEfficiency(const TString &)
void SetWeightFileName(TString)
set the weight file name (depreciated)
DataSetInfo & DataInfo() const
virtual void MakeClass(const TString &classFileName=TString("")) const
create reader class for method (classification only at present)
TString GetWeightFileName() const
retrieve weight file name
void SetTestTime(Double_t testTime)
virtual void TestClassification()
initialization
void AddOutput(Types::ETreeType type, Types::EAnalysisType analysisType)
virtual void WriteMonitoringHistosToFile() const
write special monitoring histograms to file dummy implementation here --------------—
UInt_t GetNVariables() const
Types::EAnalysisType fAnalysisType
virtual void AddRegressionOutput(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
void InitBase()
default initialization called by all constructors
std::vector< const std::vector< TMVA::Event * > * > fEventCollections
virtual void GetRegressionDeviation(UInt_t tgtNum, Types::ETreeType type, Double_t &stddev, Double_t &stddev90Percent) const
void InitIPythonInteractive()
void ReadStateFromXMLString(const char *xmlstr)
for reading from memory
void CreateMVAPdfs()
Create PDFs of the MVA output variables.
TString GetTrainingROOTVersionString() const
calculates the ROOT version string from the training version code on the fly
virtual Double_t GetValueForRoot(Double_t)
returns efficiency as function of cut
UInt_t GetTrainingROOTVersionCode() const
void ReadStateFromFile()
Function to write options and weights to file.
void WriteVarsToStream(std::ostream &tf, const TString &prefix="") const
write the list of variables (name, min, max) for a given data transformation method to the stream
void ReadVarsFromStream(std::istream &istr)
Read the variables (name, min, max) for a given data transformation method from the stream.
virtual void AddWeightsXMLTo(void *parent) const =0
void ReadSpectatorsFromXML(void *specnode)
read spectator info from XML
virtual const std::vector< Float_t > & GetTrainingHistory(const char *)
void SetNormalised(Bool_t norm)
void SetTestvarName(const TString &v="")
void ReadVariablesFromXML(void *varnode)
read variable info from XML
Bool_t fConstructedFromWeightFile
virtual std::map< TString, Double_t > OptimizeTuningParameters(TString fomType="ROCIntegral", TString fitType="FitGA")
call the Optimizer with the set of parameters and ranges that are meant to be tuned.
void SetTrainTime(Double_t trainTime)
Double_t GetXmax(Int_t ivar) const
virtual std::vector< Float_t > GetMulticlassTrainingEfficiency(std::vector< std::vector< Float_t > > &purity)
DataSetInfo & fDataSetInfo
Bool_t fHasMVAPdfs
MVA Pdfs are created for this classifier.
void WriteStateToStream(std::ostream &tf) const
general method used in writing the header of the weight files where the used variables,...
virtual Double_t GetRarity(Double_t mvaVal, Types::ESBType reftype=Types::kBackground) const
compute rarity:
virtual void SetTuneParameters(std::map< TString, Double_t > tuneParameters)
set the tuning parameters according to the argument This is just a dummy .
Double_t GetTrainTime() const
void SetBaseDir(TDirectory *methodDir)
void ReadStateFromStream(std::istream &tf)
read the header from the weight files of the different MVA methods
void AddVarsXMLTo(void *parent) const
write variable info to XML
TransformationHandler & GetTransformationHandler(Bool_t takeReroutedIfAvailable=true)
Bool_t IsSilentFile() const
Types::EMVA GetMethodType() const
void AddTargetsXMLTo(void *parent) const
write target info to XML
Double_t fXmin
minimum (signal and background)
PDF * fDefaultPDF
default PDF definitions
void ReadTargetsFromXML(void *tarnode)
read target info from XML
void SetFile(TFile *file)
void ProcessBaseOptions()
the option string is decoded, for available options see "DeclareOptions"
UInt_t fROOTTrainingVersion
void ReadStateFromXML(void *parent)
Double_t GetSignalReferenceCutOrientation() const
void SetSignalReferenceCut(Double_t cut)
std::vector< TString > * fInputVars
void NoErrorCalc(Double_t *const err, Double_t *const errUpper)
Double_t fSignalReferenceCut
the data set information (sometimes needed)
Double_t GetTestTime() const
Double_t fMeanB
mean (background)
const TransformationHandler & GetTransformationHandler(Bool_t takeReroutedIfAvailable=true) const
void SetSignalReferenceCutOrientation(Double_t cutOrientation)
Bool_t fIgnoreNegWeightsInTraining
If true, events with negative weights are not used in training.
void WriteStateToFile() const
write options and weights to file note that each one text file for the main configuration information...
void AddClassesXMLTo(void *parent) const
write class info to XML
const TString & GetInputLabel(Int_t i) const
ECutOrientation GetCutOrientation() const
TrainingHistory fTrainHistory
void SetMethodBaseDir(TDirectory *methodDir)
virtual void AddClassifierOutput(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
PDF * fMVAPdfB
background MVA PDF
void AddSpectatorsXMLTo(void *parent) const
write spectator info to XML
void SetModelPersistence(Bool_t status)
TString fWeightFile
weight file name
Bool_t IsNormalised() const
const TString & GetInternalVarName(Int_t ivar) const
const Event * GetTrainingEvent(Long64_t ievt) const
Double_t GetSignalReferenceCut() const
virtual Double_t GetROCIntegral(TH1D *histS, TH1D *histB) const
calculate the area (integral) under the ROC curve as a overall quality measure of the classification
ECutOrientation fCutOrientation
virtual const Ranking * CreateRanking()=0
Double_t GetRMS(Int_t ivar) const
IPythonInteractive * fInteractive
temporary dataset used when evaluating on a different data (used by MethodCategory::GetMvaValues)
const char * GetInputTitle(Int_t i) const
const TString & GetOriginalVarName(Int_t ivar) const
virtual void AddMulticlassOutput(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
Bool_t IsConstructedFromWeightFile() const
virtual void CheckSetup()
check may be overridden by derived class (sometimes, eg, fitters are used which can only be implement...
Class for boosting a TMVA method.
Class for categorizing the phase space.
Virtual base class for combining several TMVA method.
Multivariate optimisation of signal efficiency for given background efficiency, applying rectangular ...
PDF wrapper for histograms; uses user-defined spline interpolation.
Ranking for variables in method (implementation)
Class that is the base-class for a vector of result.
Root finding using Brents algorithm (translated from CERNLIB function RZERO)
Linear interpolation of TGraph.
Tracking data from training.
TString GetMethodName(Types::EMVA method) const
static Types & Instance()
The single instance of "Types" if existing already, or create it (Singleton)
const TString & GetLabel() const
const TString & GetExpression() const
const TString & GetInternalName() const
A TMultiGraph is a collection of TGraph (or derived) objects.
const char * GetTitle() const override
Returns title of object.
Base class for spline implementation containing the Draw/Paint methods.
const char * Data() const
A TTree represents a columnar dataset.
create variable transformations