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 =
"" );
149 virtual void Train() = 0;
175 virtual void Init() = 0;
212 std::vector<Float_t>* ptr =
new std::vector<Float_t>(0);
218 std::vector<Float_t>* ptr =
new std::vector<Float_t>(0);
306 Double_t& optimal_significance_value )
const;
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);
virtual void DeclareOptions()=0
Types::EAnalysisType fAnalysisType
void SetModelPersistence(Bool_t status)
virtual const char * GetTitle() const
Returns title of object.
virtual void AddClassifierOutputProb(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
virtual void SetTuneParameters(std::map< TString, Double_t > tuneParameters)
set the tuning parameters according to the argument This is just a dummy .
virtual void ReadWeightsFromStream(TFile &)
const TString & GetWeightFileDir() const
virtual const std::vector< Float_t > & GetMulticlassValues()
void AddInfoItem(void *gi, const TString &name, const TString &value) const
xml writing
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 ...
TString GetTrainingROOTVersionString() const
calculates the ROOT version string from the training version code on the fly
void AddOutput(Types::ETreeType type, Types::EAnalysisType analysisType)
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.
Bool_t fIgnoreNegWeightsInTraining
void ReadStateFromXML(void *parent)
virtual Double_t GetMvaValue(Double_t *errLower=0, Double_t *errUpper=0)=0
virtual Double_t GetValueForRoot(Double_t)
returns efficiency as function of cut
std::vector< TGraph * > fGraphs
const TString & GetExpression() const
const char * GetName() const
virtual const Ranking * CreateRanking()=0
Bool_t IgnoreEventsWithNegWeightsInTraining() const
static Types & Instance()
the the single instance of "Types" if existing already, or create it (Singleton)
virtual void WriteEvaluationHistosToFile(Types::ETreeType treetype)
writes all MVA evaluation histograms to file
TString GetTrainingTMVAVersionString() const
calculates the TMVA version string from the training version code on the fly
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.
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...
const Event * GetTestingEvent(Long64_t ievt) const
A TMultiGraph is a collection of TGraph (or derived) objects.
const TString & GetOriginalVarName(Int_t ivar) const
UInt_t GetNTargets() const
void InitIPythonInteractive()
Virtual base Class for all MVA method.
const std::vector< Float_t > & GetRegressionValues(const TMVA::Event *const ev)
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 ...
void SetSignalReferenceCutOrientation(Double_t cutOrientation)
virtual const std::vector< Float_t > & GetRegressionValues()
Bool_t IsNormalised() const
tomato 1-D histogram with a float per channel (see TH1 documentation)}
void SetTrainTime(Double_t trainTime)
TMultiGraph * fMultiGraph
TransformationHandler & GetTransformationHandler(Bool_t takeReroutedIfAvailable=true)
Ranking for variables in method (implementation)
virtual Double_t GetKSTrainingVsTest(Char_t SorB, TString opt="X")
virtual void TestMulticlass()
test multiclass classification
ECutOrientation GetCutOrientation() const
std::vector< TString > * fInputVars
void SetSilentFile(Bool_t status)
void ReadTargetsFromXML(void *tarnode)
read target info from XML
const TransformationHandler & GetTransformationHandler(Bool_t takeReroutedIfAvailable=true) const
UInt_t GetNVariables() const
const TString & GetInputVar(Int_t i) const
DataSet * GetDataSet() const
returns data set
virtual Bool_t IsSignalLike()
uses a pre-set cut on the MVA output (SetSignalReferenceCut and SetSignalReferenceCutOrientation) for...
const TString & GetMethodName() const
void CreateMVAPdfs()
Create PDFs of the MVA output variables.
Bool_t IsConstructedFromWeightFile() const
TString GetWeightFileName() const
retrieve weight file name
void SetMethodDir(TDirectory *methodDir)
void ReadVariablesFromXML(void *varnode)
read variable info from XML
const TString & GetInternalName() const
const char * Data() const
Types::EAnalysisType GetAnalysisType() const
DataSetInfo & fDataSetInfo
#define ClassDef(name, id)
ECutOrientation fCutOrientation
void WriteStateToStream(std::ostream &tf) const
general method used in writing the header of the weight files where the used variables, variable transformation type etc.
virtual ~MethodBase()
destructor
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
UInt_t GetNTargets() const
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 ...
MethodBase(const TString &jobName, Types::EMVA methodType, const TString &methodTitle, DataSetInfo &dsi, const TString &theOption="")
standard constructor
void ClearGraphs()
This function sets the point number to 0 for all graphs.
Virtual base class for combining several TMVA method.
void ReadStateFromFile()
Function to write options and weights to file.
virtual void MakeClass(const TString &classFileName=TString("")) const
create reader class for method (classification only at present)
~IPythonInteractive()
standard destructor
virtual void AddClassifierOutput(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
Bool_t DoMulticlass() const
void ReadClassesFromXML(void *clsnode)
read number of classes from XML
std::vector< std::vector< double > > Data
void SetupMethod()
setup of methods
UInt_t GetNEvents() const
temporary event when testing on a different DataSet than the own one
void Init(std::vector< TString > &graphTitles)
This function gets some title and it creates a TGraph for every title.
Types::EMVA GetMethodType() const
Double_t GetTestTime() const
Class that contains all the data information.
virtual void ProcessOptions()=0
virtual Double_t GetProba(const Event *ev)
PDF wrapper for histograms; uses user-defined spline interpolation.
virtual Double_t GetEfficiency(const TString &, Types::ETreeType, Double_t &err)
fill background efficiency (resp.
Bool_t HasMVAPdfs() const
virtual std::vector< Float_t > GetMulticlassEfficiency(std::vector< std::vector< Float_t > > &purity)
virtual void AddWeightsXMLTo(void *parent) const =0
UInt_t fTMVATrainingVersion
Class for boosting a TMVA method.
TransformationHandler fTransformation
void ReadStateFromXMLString(const char *xmlstr)
for reading from memory
UInt_t GetNVariables() const
void AddClassesXMLTo(void *parent) const
write class info to XML
Class that contains all the data information.
virtual void ReadWeightsFromXML(void *wghtnode)=0
Double_t GetMean(Int_t ivar) const
Bool_t HasTrainingTree() const
const Event * GetTrainingEvent(Long64_t ievt) const
TDirectory * fMethodBaseDir
UInt_t fROOTTrainingVersion
void ReadVarsFromStream(std::istream &istr)
Read the variables (name, min, max) for a given data transformation method from the stream...
virtual void WriteMonitoringHistosToFile() const
write special monitoring histograms to file dummy implementation here --------------— ...
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...
const Event * GetEvent() const
virtual Double_t GetSignificance() const
compute significance of mean difference
TSpline * fSplTrainEffBvsS
This is the main MVA steering class.
void DeclareBaseOptions()
define the options (their key words) that can be set in the option string here the options valid for ...
UInt_t GetTrainingROOTVersionCode() const
tomato 1-D histogram with a double per channel (see TH1 documentation)}
Double_t GetTrainTime() const
Linear interpolation of TGraph.
void SetNormalised(Bool_t norm)
void ProcessBaseOptions()
the option string is decoded, for available options see "DeclareOptions"
Double_t GetRMS(Int_t ivar) const
std::vector< const std::vector< TMVA::Event * > * > fEventCollections
TString fVerbosityLevelString
Class for categorizing the phase space.
void WriteStateToFile() const
write options and weights to file note that each one text file for the main configuration information...
void AddTargetsXMLTo(void *parent) const
write target info to XML
void AddVarsXMLTo(void *parent) const
write variable info to XML
TString GetMethodName(Types::EMVA method) const
virtual void MakeClassSpecific(std::ostream &, const TString &="") const
const std::vector< TMVA::Event * > & GetEventCollection(Types::ETreeType type)
returns the event collection (i.e.
virtual void CheckSetup()
check may be overridden by derived class (sometimes, eg, fitters are used which can only be implement...
void RerouteTransformationHandler(TransformationHandler *fTargetTransformation)
void SetTestTime(Double_t testTime)
virtual void AddRegressionOutput(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
Multivariate optimisation of signal efficiency for given background efficiency, applying rectangular ...
void SetWeightFileName(TString)
set the weight file name (depreciated)
Describe directory structure in memory.
std::vector< Float_t > * fMulticlassReturnVal
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 ...
TDirectory * BaseDir() const
returns the ROOT directory where info/histograms etc of the corresponding MVA method instance are sto...
void SetFile(TFile *file)
Long64_t GetNEvents(Types::ETreeType type=Types::kMaxTreeType) const
DataSetInfo & DataInfo() const
VariableInfo & GetVariableInfo(Int_t i)
const TString & GetInputLabel(Int_t i) const
IPythonInteractive()
standard constructor
Bool_t TxtWeightsOnly() const
virtual void GetRegressionDeviation(UInt_t tgtNum, Types::ETreeType type, Double_t &stddev, Double_t &stddev90Percent) const
Double_t GetSignalReferenceCutOrientation() const
const TString GetProbaName() const
Bool_t fConstructedFromWeightFile
void ProcessSetup()
process all options the "CheckForUnusedOptions" is done in an independent call, since it may be overr...
TString fVarTransformString
virtual void AddMulticlassOutput(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
Interface for all concrete MVA method implementations.
Bool_t DoRegression() const
virtual Double_t GetSeparation(TH1 *, TH1 *) const
compute "separation" defined as
virtual void MakeClassSpecificHeader(std::ostream &, const TString &="") 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...
virtual std::vector< Float_t > GetMulticlassTrainingEfficiency(std::vector< std::vector< Float_t > > &purity)
IPythonInteractive * fInteractive
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 ...
const TString & GetJobName() const
Double_t GetXmax(Int_t ivar) const
void PrintHelpMessage() const
prints out method-specific help method
UInt_t GetTrainingTMVAVersionCode() const
virtual void DeclareCompatibilityOptions()
options that are used ONLY for the READER to ensure backward compatibility they are hence without any...
Class that is the base-class for a vector of result.
Double_t fSignalReferenceCut
the data set information (sometimes needed)
TDirectory * MethodBaseDir() const
returns the ROOT directory where all instances of the corresponding MVA method are stored ...
void SetWeightFileDir(TString fileDir)
set directory of weight file
void AddSpectatorsXMLTo(void *parent) const
write spectator info to XML
A Graph is a graphics object made of two arrays X and Y with npoints each.
virtual Double_t GetTrainingEfficiency(const TString &)
void ReadSpectatorsFromXML(void *specnode)
read spectator info from XML
void DisableWriting(Bool_t setter)
void InitBase()
default initialization called by all constructors
std::vector< Float_t > * fRegressionReturnVal
Long64_t GetNTrainingEvents() const
A TTree object has a header with a name and a title.
const TString & GetInternalVarName(Int_t ivar) const
Double_t GetSignalReferenceCut() const
virtual Double_t GetRarity(Double_t mvaVal, Types::ESBType reftype=Types::kBackground) const
compute rarity: where PDF(x) is the PDF of the classifier's signal or background distribution ...
TString GetMethodTypeName() const
const TString & GetLabel() const
virtual void ReadWeightsFromStream(std::istream &)=0
virtual TMatrixD GetMulticlassConfusionMatrix(Double_t effB, Types::ETreeType type)
Construct a confusion matrix for a multiclass classifier.
void SetTestvarName(const TString &v="")
TMultiGraph * GetInteractiveTrainingError()
double norm(double *x, double *p)
void WriteStateToXML(void *parent) const
general method used in writing the header of the weight files where the used variables, variable transformation type etc.
virtual void TestClassification()
initialization
void SetBaseDir(TDirectory *methodDir)
void ReadStateFromStream(std::istream &tf)
read the header from the weight files of the different MVA methods
virtual void SetAnalysisType(Types::EAnalysisType type)
void NoErrorCalc(Double_t *const err, Double_t *const errUpper)
void SetSignalReferenceCut(Double_t cut)
Double_t fSignalReferenceCutOrientation
Double_t GetXmin(Int_t ivar) const
const TString & GetTestvarName() const
const char * GetInputTitle(Int_t i) const
Bool_t IsModelPersistence()