115   fInvHMatrixS = 
new TMatrixD( GetNvar(), GetNvar() );
 
  116   fInvHMatrixB = 
new TMatrixD( GetNvar(), GetNvar() );
 
  117   fVecMeanS    = 
new TVectorD( GetNvar() );
 
  118   fVecMeanB    = 
new TVectorD( GetNvar() );
 
  121   SetSignalReferenceCut( 0.0 );
 
 
  129   if (
NULL != fInvHMatrixS) 
delete fInvHMatrixS;
 
  130   if (
NULL != fInvHMatrixB) 
delete fInvHMatrixB;
 
  131   if (
NULL != fVecMeanS   ) 
delete fVecMeanS;
 
  132   if (
NULL != fVecMeanB   ) 
delete fVecMeanB;
 
 
  165   ComputeCovariance( 
kTRUE,  fInvHMatrixS );
 
  166   ComputeCovariance( 
kFALSE, fInvHMatrixB );
 
  169   if (
TMath::Abs(fInvHMatrixS->Determinant()) < 10E-24) {
 
  170      Log() << kWARNING << 
"<Train> H-matrix  S is almost singular with determinant= " 
  172            << 
" did you use the variables that are linear combinations or highly correlated ???" 
  175   if (
TMath::Abs(fInvHMatrixB->Determinant()) < 10E-24) {
 
  176      Log() << kWARNING << 
"<Train> H-matrix  B is almost singular with determinant= " 
  178            << 
" did you use the variables that are linear combinations or highly correlated ???" 
  182   if (
TMath::Abs(fInvHMatrixS->Determinant()) < 10E-120) {
 
  183      Log() << kFATAL << 
"<Train> H-matrix  S is singular with determinant= " 
  185            << 
" did you use the variables that are linear combinations ???" 
  188   if (
TMath::Abs(fInvHMatrixB->Determinant()) < 10E-120) {
 
  189      Log() << kFATAL << 
"<Train> H-matrix  B is singular with determinant= " 
  191            << 
" did you use the variables that are linear combinations ???" 
  196   fInvHMatrixS->Invert();
 
  197   fInvHMatrixB->Invert();
 
 
  208   const UInt_t nvar = DataInfo().GetNVariables();
 
  227      if (IgnoreEventsWithNegWeightsInTraining() && weight <= 0) 
continue;
 
  232      GetTransformationHandler().SetTransformationReferenceClass( 
origEvt->GetClass() );
 
  233      const Event* 
ev = GetTransformationHandler().Transform( 
origEvt );
 
 
  276   if (s+
b < 0) Log() << kFATAL << 
"big trouble: s+b: " << s+
b << 
Endl;
 
  281   return (
b - s)/(s + 
b);
 
 
  291   const Event* 
origEvt = fTmpEvent ? fTmpEvent:Data()->GetEvent();
 
  295   std::vector<Double_t> val( nvar );
 
  299      GetTransformationHandler().SetTransformationReferenceClass( fSignalClass     );
 
  301      GetTransformationHandler().SetTransformationReferenceClass( fBackgroundClass );
 
  303   const Event* 
ev = GetTransformationHandler().Transform( 
origEvt );
 
  320   if (
chi2 < 0) Log() << kFATAL << 
"<GetChi2> negative chi2: " << 
chi2 << 
Endl;
 
 
  384   fout << 
"   // arrays of input evt vs. variable " << std::endl;
 
  385   fout << 
"   double fInvHMatrixS[" << GetNvar() << 
"][" << GetNvar() << 
"]; // inverse H-matrix (signal)" << std::endl;
 
  386   fout << 
"   double fInvHMatrixB[" << GetNvar() << 
"][" << GetNvar() << 
"]; // inverse H-matrix (background)" << std::endl;
 
  387   fout << 
"   double fVecMeanS[" << GetNvar() << 
"];    // vector of mean values (signal)" << std::endl;
 
  388   fout << 
"   double fVecMeanB[" << GetNvar() << 
"];    // vector of mean values (background)" << std::endl;
 
  389   fout << 
"   " << std::endl;
 
  390   fout << 
"   double GetChi2( const std::vector<double>& inputValues, int type ) const;" << std::endl;
 
  391   fout << 
"};" << std::endl;
 
  392   fout << 
"   " << std::endl;
 
  393   fout << 
"void " << className << 
"::Initialize() " << std::endl;
 
  394   fout << 
"{" << std::endl;
 
  395   fout << 
"   // init vectors with mean values" << std::endl;
 
  397      fout << 
"   fVecMeanS[" << 
ivar << 
"] = " << (*fVecMeanS)(
ivar) << 
";" << std::endl;
 
  398      fout << 
"   fVecMeanB[" << 
ivar << 
"] = " << (*fVecMeanB)(
ivar) << 
";" << std::endl;
 
  400   fout << 
"   " << std::endl;
 
  401   fout << 
"   // init H-matrices" << std::endl;
 
  404         fout << 
"   fInvHMatrixS[" << 
ivar << 
"][" << 
jvar << 
"] = " 
  405              << (*fInvHMatrixS)(
ivar,
jvar) << 
";" << std::endl;
 
  406         fout << 
"   fInvHMatrixB[" << 
ivar << 
"][" << 
jvar << 
"] = " 
  407              << (*fInvHMatrixB)(
ivar,
jvar) << 
";" << std::endl;
 
  410   fout << 
"}" << std::endl;
 
  411   fout << 
"   " << std::endl;
 
  412   fout << 
"inline double " << className << 
"::GetMvaValue__( const std::vector<double>& inputValues ) const" << std::endl;
 
  413   fout << 
"{" << std::endl;
 
  414   fout << 
"   // returns the H-matrix signal estimator" << std::endl;
 
  415   fout << 
"   std::vector<double> inputValuesSig = inputValues;" << std::endl;
 
  416   fout << 
"   std::vector<double> inputValuesBgd = inputValues;" << std::endl;
 
  417   if (GetTransformationHandler().GetTransformationList().GetSize() != 0) {
 
  422      fout << 
"   Transform(inputValuesSig," << 
signalClass << 
");" << std::endl;
 
  428   fout << 
"   double s = GetChi2( inputValuesSig, " << 
Types::kSignal << 
" );" << std::endl;
 
  433   fout << 
"   " << std::endl;
 
  434   fout << 
"   if (s+b <= 0) std::cout << \"Problem in class " << className << 
"::GetMvaValue__: s+b = \"" << std::endl;
 
  435   fout << 
"                           << s+b << \" <= 0 \"  << std::endl;" << std::endl;
 
  436   fout << 
"   " << std::endl;
 
  437   fout << 
"   return (b - s)/(s + b);" << std::endl;
 
  438   fout << 
"}" << std::endl;
 
  439   fout << 
"   " << std::endl;
 
  440   fout << 
"inline double " << className << 
"::GetChi2( const std::vector<double>& inputValues, int type ) const" << std::endl;
 
  441   fout << 
"{" << std::endl;
 
  442   fout << 
"   // compute chi2-estimator for event according to type (signal/background)" << std::endl;
 
  443   fout << 
"   " << std::endl;
 
  444   fout << 
"   size_t ivar,jvar;" << std::endl;
 
  445   fout << 
"   double chi2 = 0;" << std::endl;
 
  446   fout << 
"   for (ivar=0; ivar<GetNvar(); ivar++) {" << std::endl;
 
  447   fout << 
"      for (jvar=0; jvar<GetNvar(); jvar++) {" << std::endl;
 
  449   fout << 
"            chi2 += ( (inputValues[ivar] - fVecMeanS[ivar])*(inputValues[jvar] - fVecMeanS[jvar])" << std::endl;
 
  450   fout << 
"                      * fInvHMatrixS[ivar][jvar] );" << std::endl;
 
  451   fout << 
"         else" << std::endl;
 
  452   fout << 
"            chi2 += ( (inputValues[ivar] - fVecMeanB[ivar])*(inputValues[jvar] - fVecMeanB[jvar])" << std::endl;
 
  453   fout << 
"                      * fInvHMatrixB[ivar][jvar] );" << std::endl;
 
  454   fout << 
"      }" << std::endl;
 
  455   fout << 
"   }   // loop over variables   " << std::endl;
 
  456   fout << 
"   " << std::endl;
 
  457   fout << 
"   // sanity check" << std::endl;
 
  458   fout << 
"   if (chi2 < 0) std::cout << \"Problem in class " << className << 
"::GetChi2: chi2 = \"" << std::endl;
 
  459   fout << 
"                           << chi2 << \" < 0 \"  << std::endl;" << std::endl;
 
  460   fout << 
"   " << std::endl;
 
  461   fout << 
"   return chi2;" << std::endl;
 
  462   fout << 
"}" << std::endl;
 
  463   fout << 
"   " << std::endl;
 
  464   fout << 
"// Clean up" << std::endl;
 
  465   fout << 
"inline void " << className << 
"::Clear() " << std::endl;
 
  466   fout << 
"{" << std::endl;
 
  467   fout << 
"   // nothing to clear" << std::endl;
 
  468   fout << 
"}" << std::endl;
 
 
  482   Log() << 
"The H-Matrix classifier discriminates one class (signal) of a feature" << 
Endl;
 
  483   Log() << 
"vector from another (background). The correlated elements of the" << 
Endl;
 
  484   Log() << 
"vector are assumed to be Gaussian distributed, and the inverse of" << 
Endl;
 
  485   Log() << 
"the covariance matrix is the H-Matrix. A multivariate chi-squared" << 
Endl;
 
  486   Log() << 
"estimator is built that exploits differences in the mean values of" << 
Endl;
 
  487   Log() << 
"the vector elements between the two classes for the purpose of" << 
Endl;
 
  488   Log() << 
"discrimination." << 
Endl;
 
  492   Log() << 
"The TMVA implementation of the H-Matrix classifier has been shown" << 
Endl;
 
  493   Log() << 
"to underperform in comparison with the corresponding Fisher discriminant," << 
Endl;
 
  494   Log() << 
"when using similar assumptions and complexity. Its use is therefore" << 
Endl;
 
  495   Log() << 
"depreciated. Only in cases where the background model is strongly" << 
Endl;
 
  496   Log() << 
"non-Gaussian, H-Matrix may perform better than Fisher. In such" << 
Endl;
 
  497   Log() << 
"occurrences the user is advised to employ non-linear classifiers. " << 
Endl;
 
  501   Log() << 
"None" << 
Endl;
 
 
#define REGISTER_METHOD(CLASS)
for example
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
 
TMatrixT< Double_t > TMatrixD
 
TVectorT< Double_t > TVectorD
 
Class that contains all the data information.
 
Virtual base Class for all MVA method.
 
H-Matrix method, which is implemented as a simple comparison of chi-squared estimators for signal and...
 
Double_t GetMvaValue(Double_t *err=nullptr, Double_t *errUpper=nullptr)
returns the H-matrix signal estimator
 
virtual ~MethodHMatrix()
destructor
 
MethodHMatrix(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="")
standard constructor for the H-Matrix method
 
void ComputeCovariance(Bool_t, TMatrixD *)
compute covariance matrix
 
void DeclareOptions()
MethodHMatrix options: none (apart from those implemented in MethodBase)
 
virtual Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)
FDA can handle classification with 2 classes and regression with one regression-target.
 
Double_t GetChi2(Types::ESBType)
compute chi2-estimator for event according to type (signal/background)
 
void ProcessOptions()
process user options
 
void MakeClassSpecific(std::ostream &, const TString &) const
write Fisher-specific classifier response
 
void Init()
default initialization called by all constructors
 
void GetHelpMessage() const
get help message text
 
void ReadWeightsFromXML(void *wghtnode)
read weights from XML file
 
void Train()
computes H-matrices for signal and background samples
 
void ReadWeightsFromStream(std::istream &istr)
read variable names and min/max NOTE: the latter values are mandatory for the normalisation in the re...
 
void AddWeightsXMLTo(void *parent) const
create XML description for HMatrix classification
 
Singleton class for Global types used by TMVA.
 
@ kSignal
Never change this number - it is elsewhere assumed to be zero !
 
create variable transformations
 
MsgLogger & Endl(MsgLogger &ml)
 
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.