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 =
"" );
221 std::vector<Float_t>* ptr =
new std::vector<Float_t>(0);
227 std::vector<Float_t>* ptr =
new std::vector<Float_t>(0);
233 std::vector<Float_t>* ptr =
new std::vector<Float_t>(0);
321 Double_t& optimal_significance_value )
const;
752 return GetTransformationHandler().Transform(fTmpEvent);
754 return GetTransformationHandler().Transform(Data()->GetEvent());
759 assert(fTmpEvent==0);
760 return GetTransformationHandler().Transform(Data()->GetEvent(ievt));
765 assert(fTmpEvent==0);
766 return GetTransformationHandler().Transform(Data()->GetEvent(ievt,
type));
771 assert(fTmpEvent==0);
777 assert(fTmpEvent==0);
#define ClassDef(name, id)
Describe directory structure in memory.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
A Graph is a graphics 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)}
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
virtual void MakeClassSpecificHeader(std::ostream &, const TString &="") const
TString fVerbosityLevelString
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)
virtual Double_t GetKSTrainingVsTest(Char_t SorB, TString opt="X")
MethodBase(const TString &jobName, Types::EMVA methodType, const TString &methodTitle, DataSetInfo &dsi, const TString &theOption="")
standard constructor
virtual Double_t GetSeparation(TH1 *, TH1 *) const
compute "separation" defined as
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 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...
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)
const char * GetName() const
virtual const std::vector< Float_t > & GetMulticlassValues()
TSpline * fSplTrainEffBvsS
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
Types::ESBType fVariableTransformType
const TString & GetInputVar(Int_t i) const
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.
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
const TString GetProbaName() const
TransformationHandler fTransformation
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
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
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
temporary event when testing on a different DataSet than the own one
Bool_t DoRegression() const
std::vector< Float_t > * fRegressionReturnVal
std::vector< Float_t > * fMulticlassReturnVal
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
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
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 *)
virtual Double_t GetMvaValue(Double_t *errLower=0, Double_t *errUpper=0)=0
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
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
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
const TransformationHandler & GetTransformationHandler(Bool_t takeReroutedIfAvailable=true) const
void SetSignalReferenceCutOrientation(Double_t cutOrientation)
Bool_t fIgnoreNegWeightsInTraining
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
void AddSpectatorsXMLTo(void *parent) const
write spectator info to XML
void SetModelPersistence(Bool_t status)
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
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 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.
virtual const char * GetTitle() const
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