33 #ifndef ROOT_TMVA_MethodBase
34 #define ROOT_TMVA_MethodBase
53 #ifndef ROOT_TMVA_IMethod
56 #ifndef ROOT_TMVA_Configurable
59 #ifndef ROOT_TMVA_Types
62 #ifndef ROOT_TMVA_DataSet
65 #ifndef ROOT_TMVA_Event
68 #ifndef ROOT_TMVA_TransformationHandler
71 #ifndef ROOT_TMVA_OptimizeConfigParameters
135 virtual void Train() = 0;
161 virtual void Init() = 0;
194 std::vector<Float_t>* ptr =
new std::vector<Float_t>(0);
200 std::vector<Float_t>* ptr =
new std::vector<Float_t>(0);
287 Double_t& optimal_significance_value )
const;
670 return GetTransformationHandler().Transform(fTmpEvent);
672 return GetTransformationHandler().Transform(
Data()->GetEvent());
678 return GetTransformationHandler().Transform(
Data()->GetEvent(ievt));
684 return GetTransformationHandler().Transform(
Data()->GetEvent(ievt, type));
virtual void DeclareOptions()=0
Types::EAnalysisType fAnalysisType
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 accoding 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)
static void CreateVariableTransforms(const TString &trafoDefinition, TMVA::DataSetInfo &dataInfo, TMVA::TransformationHandler &transformationHandler, TMVA::MsgLogger &log)
create variable transformations
Bool_t fIgnoreNegWeightsInTraining
void ReadStateFromXML(void *parent)
virtual Double_t GetMvaValue(Double_t *errLower=0, Double_t *errUpper=0)=0
const TString & GetExpression() const
const char * GetName() const
Returns name of object.
virtual const Ranking * CreateRanking()=0
Bool_t IgnoreEventsWithNegWeightsInTraining() const
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 Optimzier with the set of paremeters 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
const TString & GetOriginalVarName(Int_t ivar) const
UInt_t GetNTargets() const
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, S/Sqrt(S^2 + B^2), curve for given number of signal and background events; returns...
void SetSignalReferenceCutOrientation(Double_t cutOrientation)
virtual const std::vector< Float_t > & GetRegressionValues()
Bool_t IsNormalised() const
1-D histogram with a float per channel (see TH1 documentation)}
void SetTrainTime(Double_t trainTime)
TransformationHandler & GetTransformationHandler(Bool_t takeReroutedIfAvailable=true)
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="", TDirectory *theBaseDir=0)
standard constructur
virtual void TestMulticlass()
test multiclass classification
ECutOrientation GetCutOrientation() const
std::vector< TString > * fInputVars
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
static Types & Instance()
the the single instance of "Types" if existin already, or create it (Signleton)
Types::EAnalysisType GetAnalysisType() const
DataSetInfo & fDataSetInfo
set to true in order to suppress writing to XML
#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
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 ...
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)
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
void ResetThisBase()
reset required for RootFinder
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
Types::EMVA GetMethodType() const
Double_t GetTestTime() const
virtual void ProcessOptions()=0
virtual Double_t GetProba(const Event *ev)
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)
Double_t GetEffForRoot(Double_t)
returns efficiency as function of cut
virtual void AddWeightsXMLTo(void *parent) const =0
UInt_t fTMVATrainingVersion
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
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
TString GetMethodName(Types::EMVA method) const
void ReadVarsFromStream(std::istream &istr)
Read the variables (name, min, max) for a given data transformation method from the stream...
const TString & GetTitle() const
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 significance = | - |/Sqrt(RMS_S2 + RMS_B2) ...
TSpline * fSplTrainEffBvsS
static MethodBase *& GetThisBaseThreadLocal()
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
1-D histogram with a double per channel (see TH1 documentation)}
Double_t GetTrainTime() const
void SetNormalised(Bool_t norm)
void ProcessBaseOptions()
the option string is decoded, for availabel options see "DeclareOptions"
Double_t GetRMS(Int_t ivar) const
std::vector< const std::vector< TMVA::Event * > * > fEventCollections
TString fVerbosityLevelString
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
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
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...
Long64_t GetNEvents(Types::ETreeType type=Types::kMaxTreeType) const
DataSetInfo & DataInfo() const
VariableInfo & GetVariableInfo(Int_t i)
const TString & GetInputLabel(Int_t i) const
const TString & GetInputTitle(Int_t i) const
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
Bool_t DoRegression() const
virtual Double_t GetSeparation(TH1 *, TH1 *) const
compute "separation" defined as = (1/2) Int_-oo..+oo { (S(x) - B(x))^2/(S(x) + B(x)) dx } ...
virtual void MakeClassSpecificHeader(std::ostream &, const TString &="") const
Abstract ClassifierFactory template that handles arbitrary types.
virtual std::vector< Float_t > GetMulticlassTrainingEfficiency(std::vector< std::vector< Float_t > > &purity)
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 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
static MethodBase * GetThisBase()
return a pointer the base class of this 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...
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: R(x) = Integrate_[-oo..x] { PDF(x') dx' } where PDF(x) is the PDF of the classifier's...
static Double_t IGetEffForRoot(Double_t)
interface for RootFinder
TString GetMethodTypeName() const
const TString & GetLabel() const
virtual void ReadWeightsFromStream(std::istream &)=0
void SetTestvarName(const TString &v="")
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