33 #ifndef ROOT_TMVA_MethodBase 34 #define ROOT_TMVA_MethodBase 88 namespace Experimental {
96 void Init(std::vector<TString>& graphTitles);
99 void AddPoint(std::vector<Double_t>& dat);
125 const TString& theOption =
"" );
154 virtual void Train() = 0;
180 virtual void Init() = 0;
217 std::vector<Float_t>* ptr =
new std::vector<Float_t>(0);
223 std::vector<Float_t>* ptr =
new std::vector<Float_t>(0);
311 Double_t& optimal_significance_value )
const;
741 return GetTransformationHandler().Transform(fTmpEvent);
743 return GetTransformationHandler().Transform(Data()->GetEvent());
748 assert(fTmpEvent==0);
749 return GetTransformationHandler().Transform(Data()->GetEvent(ievt));
754 assert(fTmpEvent==0);
755 return GetTransformationHandler().Transform(Data()->GetEvent(ievt, type));
760 assert(fTmpEvent==0);
766 assert(fTmpEvent==0);
virtual void DeclareOptions()=0
Bool_t HasMVAPdfs() const
Types::EAnalysisType fAnalysisType
void SetModelPersistence(Bool_t status)
virtual void AddClassifierOutputProb(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
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 SetTuneParameters(std::map< TString, Double_t > tuneParameters)
set the tuning parameters according to the argument This is just a dummy .
virtual void MakeClass(const TString &classFileName=TString("")) const
create reader class for method (classification only at present)
UInt_t GetNVariables() const
virtual void ReadWeightsFromStream(TFile &)
virtual const std::vector< Float_t > & GetMulticlassValues()
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 ...
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.
TString GetMethodName(Types::EMVA method) const
Bool_t fIgnoreNegWeightsInTraining
void ReadStateFromXML(void *parent)
const TString & GetInternalName() 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 ...
Bool_t IsConstructedFromWeightFile() const
virtual Double_t GetMvaValue(Double_t *errLower=0, Double_t *errUpper=0)=0
virtual void MakeClassSpecificHeader(std::ostream &, const TString &="") const
const TString GetProbaName() const
virtual Double_t GetValueForRoot(Double_t)
returns efficiency as function of cut
std::vector< TGraph * > fGraphs
const TransformationHandler & GetTransformationHandler(Bool_t takeReroutedIfAvailable=true) const
virtual const Ranking * CreateRanking()=0
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
const TString & GetOriginalVarName(Int_t ivar) const
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...
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()
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)
virtual Double_t GetKSTrainingVsTest(Char_t SorB, TString opt="X")
virtual void TestMulticlass()
test multiclass classification
TString GetTrainingROOTVersionString() const
calculates the ROOT version string from the training version code on the fly
UInt_t GetNTargets() const
std::vector< TString > * fInputVars
virtual void GetRegressionDeviation(UInt_t tgtNum, Types::ETreeType type, Double_t &stddev, Double_t &stddev90Percent) const
const TString & GetLabel() const
const char * GetInputTitle(Int_t i) const
void SetSilentFile(Bool_t status)
void ReadTargetsFromXML(void *tarnode)
read target info from XML
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 AddInfoItem(void *gi, const TString &name, const TString &value) const
xml writing
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 * MethodBaseDir() const
returns the ROOT directory where all instances of the corresponding MVA method are stored ...
Double_t GetMean(Int_t ivar) const
Double_t GetTrainTime() const
const TString & GetInputLabel(Int_t i) const
virtual Bool_t IsSignalLike()
uses a pre-set cut on the MVA output (SetSignalReferenceCut and SetSignalReferenceCutOrientation) for...
void CreateMVAPdfs()
Create PDFs of the MVA output variables.
void SetMethodDir(TDirectory *methodDir)
void ReadVariablesFromXML(void *varnode)
read variable info from XML
const TString & GetExpression() const
const TString & GetWeightFileDir() const
void WriteStateToFile() const
write options and weights to file note that each one text file for the main configuration information...
const TString & GetInputVar(Int_t i) const
TString GetTrainingTMVAVersionString() const
calculates the TMVA version string from the training version code on the fly
DataSetInfo & fDataSetInfo
#define ClassDef(name, id)
ECutOrientation fCutOrientation
virtual ~MethodBase()
destructor
Bool_t TxtWeightsOnly() const
UInt_t GetTrainingTMVAVersionCode() const
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
const Event * GetEvent() const
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.
~IPythonInteractive()
standard destructor
virtual void AddClassifierOutput(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
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 ...
void PrintHelpMessage() const
prints out method-specific help method
void ReadClassesFromXML(void *clsnode)
read number of classes from XML
Double_t GetXmin(Int_t ivar) const
void SetupMethod()
setup of methods
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.
virtual void ProcessOptions()=0
virtual Double_t GetProba(const Event *ev)
PDF wrapper for histograms; uses user-defined spline interpolation.
Long64_t GetNTrainingEvents() const
virtual Double_t GetEfficiency(const TString &, Types::ETreeType, Double_t &err)
fill background efficiency (resp.
virtual std::vector< Float_t > GetMulticlassEfficiency(std::vector< std::vector< Float_t > > &purity)
const Event * GetTrainingEvent(Long64_t ievt) const
virtual void AddWeightsXMLTo(void *parent) const =0
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
void ReadStateFromXMLString(const char *xmlstr)
for reading from memory
Bool_t DoMulticlass() const
Class that contains all the data information.
virtual void MakeClassSpecific(std::ostream &, const TString &="") const
virtual void ReadWeightsFromXML(void *wghtnode)=0
const Event * GetTestingEvent(Long64_t ievt) const
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.
UInt_t GetNTargets() const
Bool_t HasTrainingTree() const
TDirectory * fMethodBaseDir
UInt_t fROOTTrainingVersion
const char * GetName() const
void ReadVarsFromStream(std::istream &istr)
Read the variables (name, min, max) for a given data transformation method from the stream...
void AddClassesXMLTo(void *parent) const
write class info to XML
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...
UInt_t GetTrainingROOTVersionCode() const
const TString & GetJobName() const
const TString & GetMethodName() const
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 ...
1-D histogram with a double per channel (see TH1 documentation)}
virtual Double_t GetSignificance() const
compute significance of mean difference
TString GetWeightFileName() const
retrieve weight file name
Linear interpolation of TGraph.
Double_t GetSignalReferenceCutOrientation() const
void SetNormalised(Bool_t norm)
void ProcessBaseOptions()
the option string is decoded, for available options see "DeclareOptions"
Double_t GetTestTime() const
UInt_t GetNVariables() const
std::vector< const std::vector< TMVA::Event * > * > fEventCollections
void AddSpectatorsXMLTo(void *parent) const
write spectator info to XML
TString fVerbosityLevelString
Class for categorizing the phase space.
Bool_t IgnoreEventsWithNegWeightsInTraining() 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)
virtual Double_t GetSeparation(TH1 *, TH1 *) const
compute "separation" defined as
Describe directory structure in memory.
std::vector< Float_t > * fMulticlassReturnVal
Bool_t IsNormalised() const
void SetFile(TFile *file)
void AddVarsXMLTo(void *parent) const
write variable info to XML
VariableInfo & GetVariableInfo(Int_t i)
IPythonInteractive()
standard constructor
virtual void WriteMonitoringHistosToFile() const
write special monitoring histograms to file dummy implementation here --------------— ...
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.
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.
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 ...
TDirectory * BaseDir() const
returns the ROOT directory where info/histograms etc of the corresponding MVA method instance are sto...
TString GetMethodTypeName() 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)
void SetWeightFileDir(TString fileDir)
set directory of weight file
Double_t GetSignalReferenceCut() const
A Graph is a graphics object made of two arrays X and Y with npoints each.
Long64_t GetNEvents(Types::ETreeType type=Types::kMaxTreeType) const
virtual Double_t GetTrainingEfficiency(const TString &)
void ReadSpectatorsFromXML(void *specnode)
read spectator info from XML
void DisableWriting(Bool_t setter)
ECutOrientation GetCutOrientation() const
void InitBase()
default initialization called by all constructors
std::vector< Float_t > * fRegressionReturnVal
Types::EAnalysisType GetAnalysisType() const
A TTree object has a header with a name and a title.
void AddTargetsXMLTo(void *parent) const
write target info to XML
const TString & GetTestvarName() 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()
DataSet * GetDataSet() const
returns data set
Types::EMVA GetMethodType() const
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
virtual const char * GetTitle() const
Returns title of object.
const char * Data() const
Bool_t IsModelPersistence()