/usr/include/root/TMVA/MethodPDEFoam.h is in libroot-tmva-dev 5.34.30-0ubuntu8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | // @(#)root/tmva $Id$
// Author: Tancredi Carli, Dominik Dannheim, Alexander Voigt
/**********************************************************************************
* Project: TMVA - a Root-integrated toolkit for multivariate Data analysis *
* Package: TMVA *
* Class : MethodPDEFoam *
* Web : http://tmva.sourceforge.net *
* *
* Description: *
* The PDEFoam method is an extension of the PDERS method, which divides *
* the multi-dimensional phase space in a finite number of hyper-rectangles *
* (cells) of constant event density. This "foam" of cells is filled with *
* averaged probability-density information sampled from a training event *
* sample. *
* *
* Authors (alphabetical): *
* Tancredi Carli - CERN, Switzerland *
* Dominik Dannheim - CERN, Switzerland *
* Peter Speckmayer <peter.speckmayer@cern.ch> - CERN, Switzerland *
* Alexander Voigt - TU Dresden, Germany *
* *
* Original author of the TFoam implementation: *
* S. Jadach - Institute of Nuclear Physics, Cracow, Poland *
* *
* Copyright (c) 2008, 2010: *
* CERN, Switzerland *
* MPI-K Heidelberg, Germany *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted according to the terms listed in LICENSE *
* (http://tmva.sourceforge.net/LICENSE) *
**********************************************************************************/
#ifndef ROOT_TMVA_MethodPDEFoam
#define ROOT_TMVA_MethodPDEFoam
//////////////////////////////////////////////////////////////////////////////
// //
// MethodPDEFoam //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef ROOT_TMVA_MethodBase
#include "TMVA/MethodBase.h"
#endif
#ifndef ROOT_TMVA_PDEFoam
#include "TMVA/PDEFoam.h"
#endif
#ifndef ROOT_TMVA_PDEFoamDecisionTree
#include "TMVA/PDEFoamDecisionTree.h"
#endif
#ifndef ROOT_TMVA_PDEFoamEvent
#include "TMVA/PDEFoamEvent.h"
#endif
#ifndef ROOT_TMVA_PDEFoamDiscriminant
#include "TMVA/PDEFoamDiscriminant.h"
#endif
#ifndef ROOT_TMVA_PDEFoamTarget
#include "TMVA/PDEFoamTarget.h"
#endif
#ifndef ROOT_TMVA_PDEFoamMultiTarget
#include "TMVA/PDEFoamMultiTarget.h"
#endif
#ifndef ROOT_TMVA_PDEFoamDensityBase
#include "TMVA/PDEFoamDensityBase.h"
#endif
#ifndef ROOT_TMVA_PDEFoamTargetDensity
#include "TMVA/PDEFoamTargetDensity.h"
#endif
#ifndef ROOT_TMVA_PDEFoamEventDensity
#include "TMVA/PDEFoamEventDensity.h"
#endif
#ifndef ROOT_TMVA_PDEFoamDiscriminantDensity
#include "TMVA/PDEFoamDiscriminantDensity.h"
#endif
#ifndef ROOT_TMVA_PDEFoamDecisionTreeDensity
#include "TMVA/PDEFoamDecisionTreeDensity.h"
#endif
#ifndef ROOT_TMVA_PDEFoamKernelBase
#include "TMVA/PDEFoamKernelBase.h"
#endif
#ifndef ROOT_TMVA_PDEFoamKernelTrivial
#include "TMVA/PDEFoamKernelTrivial.h"
#endif
#ifndef ROOT_TMVA_PDEFoamKernelLinN
#include "TMVA/PDEFoamKernelLinN.h"
#endif
#ifndef ROOT_TMVA_PDEFoamKernelGauss
#include "TMVA/PDEFoamKernelGauss.h"
#endif
namespace TMVA {
class MethodPDEFoam : public MethodBase {
public:
// kernel types
typedef enum EKernel { kNone=0, kGaus=1, kLinN=2 } EKernel;
MethodPDEFoam( const TString& jobName,
const TString& methodTitle,
DataSetInfo& dsi,
const TString& theOption = "PDEFoam",
TDirectory* theTargetDir = 0 );
MethodPDEFoam( DataSetInfo& dsi,
const TString& theWeightFile,
TDirectory* theTargetDir = NULL );
virtual ~MethodPDEFoam( void );
virtual Bool_t HasAnalysisType( Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets );
// training methods
void Train( void );
void TrainMonoTargetRegression( void ); // Regression output: one value
void TrainMultiTargetRegression( void ); // Regression output: any number of values
void TrainSeparatedClassification( void ); // Classification: one foam for Sig, one for Bg
void TrainUnifiedClassification( void ); // Classification: one foam for Signal and Bg
void TrainMultiClassification(); // Classification: one foam for every class
using MethodBase::ReadWeightsFromStream;
// write weights to stream
void AddWeightsXMLTo( void* parent ) const;
// read weights from stream
void ReadWeightsFromStream( std::istream & i );
void ReadWeightsFromXML ( void* wghtnode );
// write/read pure foams to/from file
void WriteFoamsToFile() const;
void ReadFoamsFromFile();
PDEFoam* ReadClonedFoamFromFile(TFile*, const TString&);
// calculate the MVA value
Double_t GetMvaValue( Double_t* err = 0, Double_t* errUpper = 0 );
// calculate multiclass MVA values
const std::vector<Float_t>& GetMulticlassValues();
// regression procedure
virtual const std::vector<Float_t>& GetRegressionValues();
// reset the method
virtual void Reset();
// ranking of input variables
const Ranking* CreateRanking();
// get number of cuts in every dimension, starting at cell
void GetNCuts(PDEFoamCell *cell, std::vector<UInt_t> &nCuts);
// helper functions to convert enum types to UInt_t and back
EKernel GetKernel( void ) { return fKernel; }
UInt_t KernelToUInt(EKernel ker) const { return UInt_t(ker); }
EKernel UIntToKernel(UInt_t iker);
UInt_t TargetSelectionToUInt(ETargetSelection ts) const { return UInt_t(ts); }
ETargetSelection UIntToTargetSelection(UInt_t its);
protected:
// make ROOT-independent C++ class for classifier response (classifier-specific implementation)
void MakeClassSpecific( std::ostream&, const TString& ) const;
// get help message text
void GetHelpMessage() const;
// calculate the error on the Mva value
Double_t CalculateMVAError();
// calculate Xmin and Xmax for Foam
void CalcXminXmax();
// Set Xmin, Xmax in foam with index 'foam_index'
void SetXminXmax(TMVA::PDEFoam*);
// create foam and set foam options
PDEFoam* InitFoam(TString, EFoamType, UInt_t cls=0);
// create pdefoam kernel
PDEFoamKernelBase* CreatePDEFoamKernel();
// delete all trained foams
void DeleteFoams();
// fill variable names into foam
void FillVariableNamesToFoam() const;
private:
// the option handling methods
void DeclareOptions();
void DeclareCompatibilityOptions();
void ProcessOptions();
// nice output
void PrintCoefficients( void );
// Square function (fastest implementation)
template<typename T> T Sqr(T x) const { return x*x; }
// options to be used
Bool_t fSigBgSeparated; // Separate Sig and Bg, or not
Float_t fFrac; // Fraction used for calc of Xmin, Xmax
Float_t fDiscrErrCut; // cut on discrimant error
Float_t fVolFrac; // volume fraction (used for density calculation during buildup)
Int_t fnCells; // Number of Cells (1000)
Int_t fnActiveCells; // Number of active cells
Int_t fnSampl; // Number of MC events per cell in build-up (1000)
Int_t fnBin; // Number of bins in build-up (100)
Int_t fEvPerBin; // Maximum events (equiv.) per bin in buid-up (1000)
Bool_t fCompress; // compress foam output file
Bool_t fMultiTargetRegression; // do regression on multible targets
UInt_t fNmin; // minimal number of events in cell necessary to split cell"
Bool_t fCutNmin; // Keep for bw compatibility: Grabbing cell with maximal RMS to split next (TFoam default)
UInt_t fMaxDepth; // maximum depth of cell tree
TString fKernelStr; // Kernel for GetMvaValue() (option string)
EKernel fKernel; // Kernel for GetMvaValue()
PDEFoamKernelBase *fKernelEstimator;// Kernel estimator
TString fTargetSelectionStr; // method of selecting the target (only mulit target regr.)
ETargetSelection fTargetSelection; // method of selecting the target (only mulit target regr.)
Bool_t fFillFoamWithOrigWeights; // fill the foam with boost weights
Bool_t fUseYesNoCell; // return -1 or 1 for bg or signal like event
TString fDTLogic; // use DT algorithm to split cells
EDTSeparation fDTSeparation; // enum which specifies the separation to use for the DT logic
Bool_t fPeekMax; // BACKWARDS COMPATIBILITY: peek up cell with max. driver integral for split
std::vector<Float_t> fXmin, fXmax; // range for histograms and foams
std::vector<PDEFoam*> fFoam; // grown PDEFoams
// default initialisation called by all constructors
void Init( void );
ClassDef(MethodPDEFoam,0) // Multi-dimensional probability density estimator using TFoam (PDE-Foam)
};
} // namespace TMVA
#endif // MethodPDEFoam_H
|