171 const TString& theWeightFile) :
205 if ((*
fPDFSig)[ivar] !=0)
delete (*fPDFSig)[ivar];
206 if ((*
fPDFBgd)[ivar] !=0)
delete (*fPDFBgd)[ivar];
245 "Transform likelihood output by inverse sigmoid function" );
258 (*fPDFSig)[ivar]->DeclareOptions();
259 (*fPDFSig)[ivar]->ParseOptions();
260 updatedOptions = (*fPDFSig)[ivar]->GetOptions();
263 (*fPDFBgd)[ivar]->DeclareOptions();
264 (*fPDFBgd)[ivar]->ParseOptions();
265 updatedOptions = (*fPDFBgd)[ivar]->GetOptions();
279 "Number of smoothing iterations for the input histograms");
281 "Average number of events per PDF bin");
283 "Fine tuning factor for Adaptive KDE: Factor to multiply the width of the kernel");
285 "Border effects treatment (1=no treatment , 2=kernel renormalization, 3=sample mirroring)" );
287 "Number of iterations (1=non-adaptive, 2=adaptive)" );
289 "KDE kernel type (1=Gauss)" );
301 "Average num of events per PDF bin and variable (signal)");
303 "Average num of events per PDF bin and variable (background)");
305 "Number of smoothing iterations for the input histograms");
307 "Number of smoothing iterations for the input histograms");
321 (*fPDFBgd)[ivar]->ProcessOptions();
322 (*fPDFSig)[ivar]->ProcessOptions();
337 std::vector<Double_t>
xmin(nvar),
xmax(nvar);
338 for (
UInt_t ivar=0; ivar<nvar; ivar++) {
xmin[ivar]=1e30;
xmax[ivar]=-1e30;}
341 for (
UInt_t ievt=0; ievt<nevents; ievt++) {
344 const Event* origEv =
Data()->GetEvent(ievt);
347 for (
int cls=0;cls<2;cls++){
350 for (
UInt_t ivar=0; ivar<nvar; ivar++) {
352 if (value <
xmin[ivar])
xmin[ivar] = value;
353 if (value >
xmax[ivar])
xmax[ivar] = value;
361 TString var = (*fInputVars)[ivar];
368 if (
DataInfo().GetVariableInfo(ivar).GetVarType() ==
'I') {
373 Int_t nbins = ixmax - ixmin;
374 (*fHistSig)[ivar] =
new TH1F(
GetMethodName()+
"_"+var +
"_sig", var +
" signal training", nbins, ixmin, ixmax );
375 (*fHistBgd)[ivar] =
new TH1F(
GetMethodName()+
"_"+var +
"_bgd", var +
" background training", nbins, ixmin, ixmax );
379 Int_t nbinsS = (*fPDFSig)[ivar]->GetHistNBins( minNEvt );
380 Int_t nbinsB = (*fPDFBgd)[ivar]->GetHistNBins( minNEvt );
392 Log() << kINFO <<
"Filling reference histograms" <<
Endl;
395 for (
Int_t ievt=0; ievt<
Data()->GetNEvents(); ievt++) {
399 const Event* origEv =
Data()->GetEvent(ievt);
411 if (value >=
xmax[ivar]) value =
xmax[ivar] - 1.0e-10;
412 else if (value <
xmin[ivar]) value =
xmin[ivar] + 1.0e-10;
417 <<
"error in filling likelihood reference histograms var="
418 <<(*fInputVars)[ivar]
419 <<
", xmin="<<(*fHistSig)[ivar]->GetXaxis()->GetXmin()
421 <<
", xmax="<<(*fHistSig)[ivar]->GetXaxis()->GetXmax()
424 if (
DataInfo().IsSignal(ev)) (*fHistSig)[ivar]->Fill( value, weight );
425 else (*
fHistBgd)[ivar]->Fill( value, weight );
430 Log() << kINFO <<
"Building PDF out of reference histograms" <<
Endl;
435 (*fPDFSig)[ivar]->BuildPDF( (*
fHistSig)[ivar] );
436 (*fPDFBgd)[ivar]->BuildPDF( (*
fHistBgd)[ivar] );
438 (*fPDFSig)[ivar]->ValidatePDF( (*
fHistSig)[ivar] );
439 (*fPDFBgd)[ivar]->ValidatePDF( (*
fHistBgd)[ivar] );
442 if ((*
fPDFSig)[ivar]->GetSmoothedHist() != 0) (*fHistSig_smooth)[ivar] = (*fPDFSig)[ivar]->GetSmoothedHist();
443 if ((*
fPDFBgd)[ivar]->GetSmoothedHist() != 0) (*fHistBgd_smooth)[ivar] = (*fPDFBgd)[ivar]->GetSmoothedHist();
480 for (ivar=0; ivar<
GetNvar(); ivar++) {
487 for (
UInt_t itype=0; itype < 2; itype++) {
490 if (
x[itype] >= (*
fPDFSig)[ivar]->
GetXmax())
x[itype] = (*fPDFSig)[ivar]->GetXmax() - 1.0e-10;
491 else if (
x[itype] < (*
fPDFSig)[ivar]->
GetXmin())
x[itype] = (*fPDFSig)[ivar]->GetXmin();
494 PDF* pdf = (itype == 0) ? (*
fPDFSig)[ivar] : (*fPDFBgd)[ivar];
495 if (pdf == 0)
Log() << kFATAL <<
"<GetMvaValue> Reference histograms don't exist" <<
Endl;
505 DataInfo().GetVariableInfo(ivar).GetVarType() ==
'N') {
522 if (itype == 0) ps *= p;
539 if (
r >= 1.0)
r = 1. - 1.e-15;
546 else if (
r >= 1.0)
r = 1. - 1.e-15;
564 o << prefix << std::endl << prefix <<
"#Default Likelihood PDF Options:" << std::endl << prefix << std::endl;
569 o << prefix << std::endl << prefix <<
TString::Format(
"#Signal[%d] Likelihood PDF Options:",ivar) << std::endl << prefix << std::endl;
570 (*fPDFSig)[ivar]->WriteOptionsToStream( o, prefix );
573 o << prefix << std::endl << prefix <<
"#Background[%d] Likelihood PDF Options:" << std::endl << prefix << std::endl;
574 (*fPDFBgd)[ivar]->WriteOptionsToStream( o, prefix );
590 Log() << kFATAL <<
"Reference histograms for variable " << ivar
591 <<
" don't exist, can't write it to weight file" <<
Endl;
595 (*fPDFSig)[ivar]->AddXMLTo(pdfwrap);
599 (*fPDFBgd)[ivar]->AddXMLTo(pdfwrap);
620 TH1* rS =
new TH1F( nameS, nameS, 80, 0, 1 );
621 TH1* rB =
new TH1F( nameB, nameB, 80, 0, 1 );
624 for (
Int_t ievt=0; ievt<
Data()->GetNTrainingEvents(); ievt++) {
626 const Event* origEv =
Data()->GetEvent(ievt);
633 else rB->
Fill( lk, w );
638 if (ivar == -1) sepRef = sep;
645 if (ivar >= 0)
fRanking->AddRank(
Rank(
DataInfo().GetVariableInfo(ivar).GetInternalName(), sep ) );
660 (*fPDFSig)[ivar]->Write( pname +
GetInputVar( ivar ) +
"_S" );
661 (*fPDFBgd)[ivar]->Write( pname +
GetInputVar( ivar ) +
"_B" );
675 for (
UInt_t ivar=0; ivar<nvars; ivar++){
677 Log() << kDEBUG <<
"Reading signal and background PDF for variable: " <<
GetInputVar( ivar ) <<
Endl;
678 if ((*
fPDFSig)[ivar] !=0)
delete (*fPDFSig)[ivar];
679 if ((*
fPDFBgd)[ivar] !=0)
delete (*fPDFBgd)[ivar];
684 (*(*fPDFSig)[ivar]).ReadXML(pdfnode);
687 (*(*fPDFBgd)[ivar]).ReadXML(pdfnode);
701 Log() << kDEBUG <<
"Reading signal and background PDF for variable: " <<
GetInputVar( ivar ) <<
Endl;
702 if ((*
fPDFSig)[ivar] !=0)
delete (*fPDFSig)[ivar];
703 if ((*
fPDFBgd)[ivar] !=0)
delete (*fPDFBgd)[ivar];
708 istr >> *(*fPDFSig)[ivar];
709 istr >> *(*fPDFBgd)[ivar];
731 Log() << kINFO <<
"Write monitoring histograms to file: " <<
BaseDir()->GetPath() <<
Endl;
735 (*fHistSig)[ivar]->Write();
736 (*fHistBgd)[ivar]->Write();
739 (*fPDFSig)[ivar]->GetPDFHist()->Write();
740 (*fPDFBgd)[ivar]->GetPDFHist()->Write();
742 if ((*
fPDFSig)[ivar]->GetNSmoothHist() != 0) (*fPDFSig)[ivar]->GetNSmoothHist()->Write();
743 if ((*
fPDFBgd)[ivar]->GetNSmoothHist() != 0) (*fPDFBgd)[ivar]->GetNSmoothHist()->Write();
746 Float_t xmin=((*fPDFSig)[ivar]->GetPDFHist()->GetXaxis())->GetXmin();
747 Float_t xmax=((*fPDFSig)[ivar]->GetPDFHist()->GetXaxis())->GetXmax();
751 for (
Int_t bin=0; bin < 15000; bin++) {
758 TH1*
h[2] = { (*fHistSig)[ivar], (*fHistBgd)[ivar] };
759 for (
UInt_t i=0; i<2; i++) {
765 hclone->
Rebin( resFactor );
766 hclone->
Scale( 1.0/resFactor );
779 fout <<
"#include <cmath>" << std::endl;
780 fout <<
"#include <cstdlib>" << std::endl;
788 Int_t dp = fout.precision();
789 fout <<
" double fEpsilon;" << std::endl;
795 nbin[ivar]=(*fPDFSig)[ivar]->GetPDFHist()->GetNbinsX();
796 if (nbin[ivar] > nbinMax) nbinMax=nbin[ivar];
799 fout <<
" static float fRefS[][" << nbinMax <<
"]; "
800 <<
"// signal reference vector [nvars][max_nbins]" << std::endl;
801 fout <<
" static float fRefB[][" << nbinMax <<
"]; "
802 <<
"// backgr reference vector [nvars][max_nbins]" << std::endl << std::endl;
803 fout <<
"// if a variable has its PDF encoded as a spline0 --> treat it like an Integer valued one" <<std::endl;
804 fout <<
" bool fHasDiscretPDF[" <<
GetNvar() <<
"]; "<< std::endl;
805 fout <<
" int fNbin[" <<
GetNvar() <<
"]; "
806 <<
"// number of bins (discrete variables may have less bins)" << std::endl;
807 fout <<
" double fHistMin[" <<
GetNvar() <<
"]; " << std::endl;
808 fout <<
" double fHistMax[" <<
GetNvar() <<
"]; " << std::endl;
810 fout <<
" double TransformLikelihoodOutput( double, double ) const;" << std::endl;
811 fout <<
"};" << std::endl;
812 fout <<
"" << std::endl;
813 fout <<
"inline void " << className <<
"::Initialize() " << std::endl;
814 fout <<
"{" << std::endl;
815 fout <<
" fEpsilon = " <<
fEpsilon <<
";" << std::endl;
817 fout <<
" fNbin[" << ivar <<
"] = " << (*fPDFSig)[ivar]->GetPDFHist()->GetNbinsX() <<
";" << std::endl;
818 fout <<
" fHistMin[" << ivar <<
"] = " << (*fPDFSig)[ivar]->GetPDFHist()->GetXaxis()->GetXmin() <<
";" << std::endl;
819 fout <<
" fHistMax[" << ivar <<
"] = " << (*fPDFSig)[ivar]->GetPDFHist()->GetXaxis()->GetXmax() <<
";" << std::endl;
821 if ((((*
fPDFSig)[ivar]->GetPDFHist()->GetNbinsX() != nbin[ivar] ||
822 (*
fPDFBgd)[ivar]->GetPDFHist()->GetNbinsX() != nbin[ivar])
824 (*
fPDFSig)[ivar]->GetPDFHist()->GetNbinsX() != (*
fPDFBgd)[ivar]->GetPDFHist()->GetNbinsX()) {
825 Log() << kFATAL <<
"<MakeClassSpecific> Mismatch in binning of variable "
828 <<
"nxS = " << (*fPDFSig)[ivar]->GetPDFHist()->GetNbinsX() <<
", "
829 <<
"nxB = " << (*fPDFBgd)[ivar]->GetPDFHist()->GetNbinsX()
830 <<
" while we expect " << nbin[ivar]
836 fout <<
" fHasDiscretPDF[" << ivar <<
"] = true; " << std::endl;
838 fout <<
" fHasDiscretPDF[" << ivar <<
"] = false; " << std::endl;
841 fout <<
"}" << std::endl << std::endl;
843 fout <<
"inline double " << className
844 <<
"::GetMvaValue__( const std::vector<double>& inputValues ) const" << std::endl;
845 fout <<
"{" << std::endl;
846 fout <<
" double ps(1), pb(1);" << std::endl;
847 fout <<
" std::vector<double> inputValuesSig = inputValues;" << std::endl;
848 fout <<
" std::vector<double> inputValuesBgd = inputValues;" << std::endl;
850 fout <<
" Transform(inputValuesSig,0);" << std::endl;
851 fout <<
" Transform(inputValuesBgd,1);" << std::endl;
853 fout <<
" for (size_t ivar = 0; ivar < GetNvar(); ivar++) {" << std::endl;
855 fout <<
" // dummy at present... will be used for variable transforms" << std::endl;
856 fout <<
" double x[2] = { inputValuesSig[ivar], inputValuesBgd[ivar] };" << std::endl;
858 fout <<
" for (int itype=0; itype < 2; itype++) {" << std::endl;
860 fout <<
" // interpolate linearly between adjacent bins" << std::endl;
861 fout <<
" // this is not useful for discrete variables (or forced Spline0)" << std::endl;
862 fout <<
" int bin = int((x[itype] - fHistMin[ivar])/(fHistMax[ivar] - fHistMin[ivar])*fNbin[ivar]) + 0;" << std::endl;
864 fout <<
" // since the test data sample is in general different from the training sample" << std::endl;
865 fout <<
" // it can happen that the min/max of the training sample are trespassed --> correct this" << std::endl;
866 fout <<
" if (bin < 0) {" << std::endl;
867 fout <<
" bin = 0;" << std::endl;
868 fout <<
" x[itype] = fHistMin[ivar];" << std::endl;
869 fout <<
" }" << std::endl;
870 fout <<
" else if (bin >= fNbin[ivar]) {" << std::endl;
871 fout <<
" bin = fNbin[ivar]-1;" << std::endl;
872 fout <<
" x[itype] = fHistMax[ivar];" << std::endl;
873 fout <<
" }" << std::endl;
875 fout <<
" // find corresponding histogram from cached indices" << std::endl;
876 fout <<
" float ref = (itype == 0) ? fRefS[ivar][bin] : fRefB[ivar][bin];" << std::endl;
878 fout <<
" // sanity check" << std::endl;
879 fout <<
" if (ref < 0) {" << std::endl;
880 fout <<
" std::cout << \"Fatal error in " << className
881 <<
": bin entry < 0 ==> abort\" << std::endl;" << std::endl;
882 fout <<
" std::exit(1);" << std::endl;
883 fout <<
" }" << std::endl;
885 fout <<
" double p = ref;" << std::endl;
887 fout <<
" if (GetType(ivar) != 'I' && !fHasDiscretPDF[ivar]) {" << std::endl;
888 fout <<
" float bincenter = (bin + 0.5)/fNbin[ivar]*(fHistMax[ivar] - fHistMin[ivar]) + fHistMin[ivar];" << std::endl;
889 fout <<
" int nextbin = bin;" << std::endl;
890 fout <<
" if ((x[itype] > bincenter && bin != fNbin[ivar]-1) || bin == 0) " << std::endl;
891 fout <<
" nextbin++;" << std::endl;
892 fout <<
" else" << std::endl;
893 fout <<
" nextbin--; " << std::endl;
895 fout <<
" double refnext = (itype == 0) ? fRefS[ivar][nextbin] : fRefB[ivar][nextbin];" << std::endl;
896 fout <<
" float nextbincenter = (nextbin + 0.5)/fNbin[ivar]*(fHistMax[ivar] - fHistMin[ivar]) + fHistMin[ivar];" << std::endl;
898 fout <<
" double dx = bincenter - nextbincenter;" << std::endl;
899 fout <<
" double dy = ref - refnext;" << std::endl;
900 fout <<
" p += (x[itype] - bincenter) * dy/dx;" << std::endl;
901 fout <<
" }" << std::endl;
903 fout <<
" if (p < fEpsilon) p = fEpsilon; // avoid zero response" << std::endl;
905 fout <<
" if (itype == 0) ps *= p;" << std::endl;
906 fout <<
" else pb *= p;" << std::endl;
907 fout <<
" } " << std::endl;
908 fout <<
" } " << std::endl;
910 fout <<
" // the likelihood ratio (transform it ?)" << std::endl;
911 fout <<
" return TransformLikelihoodOutput( ps, pb ); " << std::endl;
912 fout <<
"}" << std::endl << std::endl;
914 fout <<
"inline double " << className <<
"::TransformLikelihoodOutput( double ps, double pb ) const" << std::endl;
915 fout <<
"{" << std::endl;
916 fout <<
" // returns transformed or non-transformed output" << std::endl;
917 fout <<
" if (ps < fEpsilon) ps = fEpsilon;" << std::endl;
918 fout <<
" if (pb < fEpsilon) pb = fEpsilon;" << std::endl;
919 fout <<
" double r = ps/(ps + pb);" << std::endl;
920 fout <<
" if (r >= 1.0) r = 1. - 1.e-15;" << std::endl;
923 fout <<
" // inverse Fermi function" << std::endl;
925 fout <<
" // sanity check" << std::endl;
926 fout <<
" if (r <= 0.0) r = fEpsilon;" << std::endl;
927 fout <<
" else if (r >= 1.0) r = 1. - 1.e-15;" << std::endl;
929 fout <<
" double tau = 15.0;" << std::endl;
930 fout <<
" r = - log(1.0/r - 1.0)/tau;" << std::endl;
931 fout <<
" }" << std::endl;
933 fout <<
" return r;" << std::endl;
934 fout <<
"}" << std::endl;
937 fout <<
"// Clean up" << std::endl;
938 fout <<
"inline void " << className <<
"::Clear() " << std::endl;
939 fout <<
"{" << std::endl;
940 fout <<
" // nothing to clear" << std::endl;
941 fout <<
"}" << std::endl << std::endl;
943 fout <<
"// signal map" << std::endl;
944 fout <<
"float " << className <<
"::fRefS[][" << nbinMax <<
"] = " << std::endl;
945 fout <<
"{ " << std::endl;
948 for (
Int_t ibin=1; ibin<=nbinMax; ibin++) {
949 if (ibin-1 < nbin[ivar])
950 fout << (*fPDFSig)[ivar]->GetPDFHist()->GetBinContent(ibin);
954 if (ibin < nbinMax) fout <<
", ";
956 fout <<
" }, " << std::endl;
958 fout <<
"}; " << std::endl;
961 fout <<
"// background map" << std::endl;
962 fout <<
"float " << className <<
"::fRefB[][" << nbinMax <<
"] = " << std::endl;
963 fout <<
"{ " << std::endl;
966 fout << std::setprecision(8);
967 for (
Int_t ibin=1; ibin<=nbinMax; ibin++) {
968 if (ibin-1 < nbin[ivar])
969 fout << (*fPDFBgd)[ivar]->GetPDFHist()->GetBinContent(ibin);
973 if (ibin < nbinMax) fout <<
", ";
975 fout <<
" }, " << std::endl;
977 fout <<
"}; " << std::endl;
979 fout << std::setprecision(dp);
995 Log() <<
"The maximum-likelihood classifier models the data with probability " <<
Endl;
996 Log() <<
"density functions (PDF) reproducing the signal and background" <<
Endl;
997 Log() <<
"distributions of the input variables. Correlations among the " <<
Endl;
998 Log() <<
"variables are ignored." <<
Endl;
1002 Log() <<
"Required for good performance are decorrelated input variables" <<
Endl;
1003 Log() <<
"(PCA transformation via the option \"VarTransform=Decorrelate\"" <<
Endl;
1004 Log() <<
"may be tried). Irreducible non-linear correlations may be reduced" <<
Endl;
1005 Log() <<
"by precombining strongly correlated input variables, or by simply" <<
Endl;
1006 Log() <<
"removing one of the variables." <<
Endl;
1010 Log() <<
"High fidelity PDF estimates are mandatory, i.e., sufficient training " <<
Endl;
1011 Log() <<
"statistics is required to populate the tails of the distributions" <<
Endl;
1012 Log() <<
"It would be a surprise if the default Spline or KDE kernel parameters" <<
Endl;
1013 Log() <<
"provide a satisfying fit to the data. The user is advised to properly" <<
Endl;
1014 Log() <<
"tune the events per bin and smooth options in the spline cases" <<
Endl;
1015 Log() <<
"individually per variable. If the KDE kernel is used, the adaptive" <<
Endl;
1016 Log() <<
"Gaussian kernel may lead to artefacts, so please always also try" <<
Endl;
1017 Log() <<
"the non-adaptive one." <<
Endl;
1019 Log() <<
"All tuning parameters must be adjusted individually for each input" <<
Endl;
#define REGISTER_METHOD(CLASS)
for example
int Int_t
Signed integer 4 bytes (int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
float Float_t
Float 4 bytes (float).
TVectorT< Float_t > TVector
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
TDirectory::TContext keeps track and restore the current directory.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
1-D histogram with a float per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
void SetTitle(const char *title) override
Change/set the title.
virtual Int_t GetNbinsX() const
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
virtual TH1 * Rebin(Int_t ngroup=2, const char *newname="", const Double_t *xbins=nullptr)
Rebin this histogram.
void SetName(const char *name) override
Change the name of this histogram.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
virtual Int_t FindBin(Double_t x, Double_t y=0, Double_t z=0)
Return Global bin number corresponding to x,y,z.
OptionBase * DeclareOptionRef(T &ref, const TString &name, const TString &desc="")
void WriteOptionsToStream(std::ostream &o, const TString &prefix) const
write options to output stream (e.g. in writing the MVA weight files
const TString & GetOptions() const
void SetOptions(const TString &s)
Class that contains all the data information.
Float_t GetValue(UInt_t ivar) const
return value of i'th variable
Double_t GetWeight() const
return the event weight - depending on whether the flag IgnoreNegWeightsInTraining is or not.
MethodBase(const TString &jobName, Types::EMVA methodType, const TString &methodTitle, DataSetInfo &dsi, const TString &theOption="")
standard constructor
const char * GetName() const override
Double_t GetXmin(Int_t ivar) const
virtual void DeclareCompatibilityOptions()
options that are used ONLY for the READER to ensure backward compatibility they are hence without any...
UInt_t GetTrainingTMVAVersionCode() const
const TString & GetInputVar(Int_t i) const
Bool_t IgnoreEventsWithNegWeightsInTraining() const
TDirectory * BaseDir() const
returns the ROOT directory where info/histograms etc of the corresponding MVA method instance are sto...
const TString & GetMethodName() const
const Event * GetEvent() const
DataSetInfo & DataInfo() const
Double_t GetXmax(Int_t ivar) const
TransformationHandler & GetTransformationHandler(Bool_t takeReroutedIfAvailable=true)
void SetSignalReferenceCut(Double_t cut)
std::vector< TString > * fInputVars
void NoErrorCalc(Double_t *const err, Double_t *const errUpper)
const TString & GetOriginalVarName(Int_t ivar) const
Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets) override
FDA can handle classification with 2 classes.
Int_t fDropVariable
for ranking test
TString fKDEtypeString
Kernel type to use for KDE (string).
void ProcessOptions() override
process user options reference cut value to distinguish signal-like from background-like events
virtual void WriteOptionsToStream(std::ostream &o, const TString &prefix) const
write options to stream
Int_t * fNsmoothVarB
number of smooth passes
void MakeClassSpecific(std::ostream &, const TString &) const override
write specific classifier response
Int_t * fAverageEvtPerBinVarS
average events per bin; used to calculate fNbins
const Ranking * CreateRanking() override
computes ranking of input variables
void ReadWeightsFromStream(std::istream &istr) override
read weight info from file nothing to do for this method
std::vector< TH1 * > * fHistSig
signal PDFs (histograms)
void Train() override
create reference distributions (PDFs) from signal and background events: fill histograms and smooth t...
void GetHelpMessage() const override
get help message text
virtual ~MethodLikelihood()
destructor
void DeclareOptions() override
define the options (their key words) that can be set in the option string
void ReadWeightsFromXML(void *wghtnode) override
read weights from XML
std::vector< TH1 * > * fHistBgd
background PDFs (histograms)
std::vector< PDF * > * fPDFSig
list of PDFs (signal)
Double_t fEpsilon
minimum number of likelihood (to avoid zero)
TString * fInterpolateString
which interpolation method used for reference histograms (individual for each variable)
MethodLikelihood(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="")
standard constructor
void WriteMonitoringHistosToFile() const override
write histograms and PDFs to file for monitoring purposes
void Init() override
default initialisation called by all constructors
void DeclareCompatibilityOptions() override
options that are used ONLY for the READER to ensure backward compatibility they are hence without any...
std::vector< TH1 * > * fHistSig_smooth
signal PDFs (smoothed histograms)
Bool_t fTransformLikelihoodOutput
likelihood output is sigmoid-transformed
void AddWeightsXMLTo(void *parent) const override
write weights to XML
TString fKDEiterString
Number of iterations (string).
Double_t TransformLikelihoodOutput(Double_t ps, Double_t pb) const
returns transformed or non-transformed output
std::vector< TH1 * > * fHistBgd_smooth
background PDFs (smoothed histograms)
TString fBorderMethodString
the method to take care about "border" effects (string)
Double_t GetMvaValue(Double_t *err=nullptr, Double_t *errUpper=nullptr) override
returns the likelihood estimator for signal fill a new Likelihood branch into the testTree
std::vector< PDF * > * fPDFBgd
list of PDFs (background)
void WriteWeightsToStream(TFile &rf) const
write reference PDFs to ROOT file
Int_t * fNsmoothVarS
number of smooth passes
Int_t fNsmooth
number of smooth passes
Float_t fKDEfineFactor
fine tuning factor for Adaptive KDE
Int_t * fAverageEvtPerBinVarB
average events per bin; used to calculate fNbins
Int_t fAverageEvtPerBin
average events per bin; used to calculate fNbins
void MakeClassSpecificHeader(std::ostream &, const TString &="") const override
write specific header of the classifier (mostly include files)
PDF * fDefaultPDFLik
pdf that contains default definitions
PDF wrapper for histograms; uses user-defined spline interpolation.
Ranking for variables in method (implementation).
Singleton class for Global types used by TMVA.
TObject * Clone(const char *newname="") const override
Make a clone of an object using the Streamer facility.
const char * GetTitle() const override
Returns title of object.
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
const char * Data() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
create variable transformations
MsgLogger & Endl(MsgLogger &ml)
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t Log(Double_t x)
Returns the natural logarithm of x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.