Implementation of PDEFoam The PDEFoam method is an extension of the PDERS method, which uses self-adapting binning to divide the multi-dimensional phase space in a finite number of hyper-rectangles (boxes). For a given number of boxes, the binning algorithm adjusts the size and position of the boxes inside the multidimensional phase space, minimizing the variance of the signal and background densities inside the boxes. The binned density information is stored in binary trees, allowing for a very fast and memory-efficient classification of events. The implementation of the PDEFoam is based on the monte-carlo integration package PDEFoam included in the analysis package ROOT.
virtual | ~PDEFoam() |
void | TObject::AbstractMethod(const char* method) const |
void | AddVariableName(const char* s) |
void | AddVariableName(TObjString* s) |
void | AddXMLTo(void* parent) |
virtual void | TObject::AppendPad(Option_t* option = "") |
virtual void | TObject::Browse(TBrowser* b) |
void | CalcCellDiscr() |
void | CalcCellTarget() |
void | CheckAll(Int_t) |
void | CheckCells(Bool_t remove_empty_cells = false) |
static TClass* | Class() |
virtual const char* | TObject::ClassName() const |
virtual void | TObject::Clear(Option_t* = "") |
virtual TObject* | TObject::Clone(const char* newname = "") const |
virtual Int_t | TObject::Compare(const TObject* obj) const |
virtual void | TObject::Copy(TObject& object) const |
void | Create() |
virtual void | TObject::Delete(Option_t* option = "")MENU |
void | DeleteBinarySearchTree() |
virtual Int_t | TObject::DistancetoPrimitive(Int_t px, Int_t py) |
virtual void | TObject::Draw(Option_t* option = "") |
TH1D* | Draw1Dim(const char* opt, Int_t nbin) |
virtual void | TObject::DrawClass() constMENU |
virtual TObject* | TObject::DrawClone(Option_t* option = "") constMENU |
virtual void | TObject::Dump() constMENU |
virtual void | TObject::Error(const char* method, const char* msgfmt) const |
virtual void | TObject::Execute(const char* method, const char* params, Int_t* error = 0) |
virtual void | TObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0) |
virtual void | TObject::ExecuteEvent(Int_t event, Int_t px, Int_t py) |
virtual void | TObject::Fatal(const char* method, const char* msgfmt) const |
void | FillBinarySearchTree(const TMVA::Event* ev, Bool_t NoNegWeights = kFALSE) |
void | FillFoamCells(const TMVA::Event* ev, Bool_t NoNegWeights = kFALSE) |
virtual TObject* | TObject::FindObject(const char* name) const |
virtual TObject* | TObject::FindObject(const TObject* obj) const |
Double_t | GetAverageNeighborsValue(vector<Float_t>& txvec, TMVA::ECellValue cv) |
Double_t | GetCellDensity(vector<Float_t>& xvec, TMVA::EKernel kernel = kNone) |
Double_t | GetCellDiscr(vector<Float_t>& xvec, TMVA::EKernel kernel = kNone) |
Double_t | GetCellRegValue0(vector<Float_t>&, TMVA::EKernel kernel = kNone) |
Double_t | GetCellValue(vector<Float_t>&, TMVA::ECellValue) |
virtual Option_t* | TObject::GetDrawOption() const |
static Long_t | TObject::GetDtorOnly() |
Bool_t | GetFillFoamWithOrigWeights() const |
TString | GetFoamName() const |
TMVA::EFoamType | GetFoamType() const |
virtual const char* | TObject::GetIconName() const |
UInt_t | GetMaxDepth() const |
UInt_t | GetNActiveCells() const |
virtual const char* | TObject::GetName() const |
UInt_t | GetNCells() const |
UInt_t | GetNElements() const |
UInt_t | GetNInActiveCells() const |
UInt_t | GetNmin() |
virtual char* | TObject::GetObjectInfo(Int_t px, Int_t py) const |
static Bool_t | TObject::GetObjectStat() |
virtual Option_t* | TObject::GetOption() const |
vector<Float_t> | GetProjectedRegValue(vector<Float_t>& vals, TMVA::EKernel kernel = kNone, TMVA::ETargetSelection ts = kMean) |
Double_t | GetProjectionCellValue(TMVA::PDEFoamCell* cell, Int_t idim1, Int_t idim2, TMVA::ECellValue cv) |
TMVA::PDEFoamCell* | GetRootCell() const |
virtual const char* | TObject::GetTitle() const |
Int_t | GetTotDim() const |
virtual UInt_t | TObject::GetUniqueID() const |
TObjString* | GetVariableName(Int_t idx) |
Float_t | GetVolumeFraction() const |
Double_t | GetXmax(Int_t idim) const |
Double_t | GetXmin(Int_t idim) const |
virtual Bool_t | TObject::HandleTimer(TTimer* timer) |
virtual ULong_t | TObject::Hash() const |
virtual void | TObject::Info(const char* method, const char* msgfmt) const |
virtual Bool_t | TObject::InheritsFrom(const char* classname) const |
virtual Bool_t | TObject::InheritsFrom(const TClass* cl) const |
void | Init() |
virtual void | TObject::Inspect() constMENU |
void | TObject::InvertBit(UInt_t f) |
virtual TClass* | IsA() const |
virtual Bool_t | TObject::IsEqual(const TObject* obj) const |
virtual Bool_t | TObject::IsFolder() const |
Bool_t | TObject::IsOnHeap() const |
virtual Bool_t | TObject::IsSortable() const |
Bool_t | TObject::IsZombie() const |
TMVA::MsgLogger& | Log() const |
virtual void | TObject::ls(Option_t* option = "") const |
void | TObject::MayNotUse(const char* method) const |
virtual Bool_t | TObject::Notify() |
static void | TObject::operator delete(void* ptr) |
static void | TObject::operator delete(void* ptr, void* vp) |
static void | TObject::operator delete[](void* ptr) |
static void | TObject::operator delete[](void* ptr, void* vp) |
void* | TObject::operator new(size_t sz) |
void* | TObject::operator new(size_t sz, void* vp) |
void* | TObject::operator new[](size_t sz) |
void* | TObject::operator new[](size_t sz, void* vp) |
TMVA::PDEFoam& | operator=(const TMVA::PDEFoam&) |
virtual void | TObject::Paint(Option_t* option = "") |
TMVA::PDEFoam | PDEFoam() |
TMVA::PDEFoam | PDEFoam(const TString&) |
virtual void | TObject::Pop() |
virtual void | TObject::Print(Option_t* option = "") const |
void | PrintCell(Long_t iCell = 0) |
void | PrintCellElements() |
void | PrintCells() |
void | PrintStream(ostream&) const |
TH2D* | Project2(Int_t idim1, Int_t idim2, const char* opt = "cell_value", const char* ker = "kNone", UInt_t maxbins = 50) |
virtual Int_t | TObject::Read(const char* name) |
void | ReadStream(istream&) |
void | ReadXML(void* parent) |
virtual void | TObject::RecursiveRemove(TObject* obj) |
void | RemoveEmptyCell(Int_t iCell) |
void | TObject::ResetBit(UInt_t f) |
void | ResetCellElements(Bool_t allcells = false) |
void | RootPlot2dim(const TString& filename, TString opt, Bool_t CreateCanvas = kTRUE, Bool_t colors = kTRUE, Bool_t log_colors = kFALSE) |
virtual void | TObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU |
virtual void | TObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "") |
void | TObject::SetBit(UInt_t f) |
void | TObject::SetBit(UInt_t f, Bool_t set) |
void | SetDim(Int_t kDim) |
virtual void | TObject::SetDrawOption(Option_t* option = "")MENU |
static void | TObject::SetDtorOnly(void* obj) |
void | SetDTSeparation(TMVA::EDTSeparation new_val) |
void | SetEvPerBin(Int_t EvPerBin) |
void | SetFillFoamWithOrigWeights(Bool_t new_val) |
void | SetFoamType(TMVA::EFoamType ft) |
void | SetInhiDiv(Int_t, Int_t) |
void | SetMaxDepth(UInt_t maxdepth) |
void | SetnBin(Int_t nBin) |
void | SetnCells(Long_t nCells) |
void | SetNElements(UInt_t numb) |
void | SetNmin(UInt_t val) |
void | SetnSampl(Long_t nSampl) |
static void | TObject::SetObjectStat(Bool_t stat) |
void | SetPeekMax(Bool_t new_val) |
virtual void | TObject::SetUniqueID(UInt_t uid) |
void | SetVolumeFraction(Float_t vfr) |
void | SetXmax(Int_t idim, Double_t wmax) |
void | SetXmin(Int_t idim, Double_t wmin) |
virtual void | ShowMembers(TMemberInspector& insp) |
virtual void | Streamer(TBuffer& b) |
void | StreamerNVirtual(TBuffer& b) |
virtual void | TObject::SysError(const char* method, const char* msgfmt) const |
Bool_t | TObject::TestBit(UInt_t f) const |
Int_t | TObject::TestBits(UInt_t f) const |
virtual void | TObject::UseCurrentStyle() |
vector<Float_t> | VarTransform(vector<Float_t>& invec) const |
Float_t | VarTransform(Int_t idim, Float_t x) const |
vector<Float_t> | VarTransformInvers(vector<Float_t>& invec) const |
Float_t | VarTransformInvers(Int_t idim, Float_t x) const |
virtual void | TObject::Warning(const char* method, const char* msgfmt) const |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const |
TMVA::PDEFoamDistr* | GetDistr() const |
enum TObject::EStatusBits { | kCanDelete | |
kMustCleanup | ||
kObjInCanvas | ||
kIsReferenced | ||
kHasUUID | ||
kCannotPick | ||
kNoContextMenu | ||
kInvalidObject | ||
}; | ||
enum TObject::[unnamed] { | kIsOnHeap | |
kNotDeleted | ||
kZombie | ||
kBitMask | ||
kSingleKey | ||
kOverwrite | ||
kWriteDelete | ||
}; |
Double_t* | fAlpha | [fDim] Internal parameters of the hyperrectangle |
TMVA::PDEFoamCell** | fCells | [fNCells] Array of ALL cells |
TMVA::EDTSeparation | fDTSeparation | split cells according to decision tree logic |
Int_t | fDim | Dimension of the integration/simulation space |
TMVA::PDEFoamDistr* | fDistr | ! distribution of training events |
Int_t | fEvPerBin | Maximum number of effective (wt=1) events per bin |
Bool_t | fFillFoamWithOrigWeights | fill the foam with boost or orig. weights |
TMVA::EFoamType | fFoamType | type of foam |
TObjArray* | fHistEdg | Histograms of wt, one for each cell edge |
Int_t* | fInhiDiv | ! [fDim] Flags for inhibiting cell division |
Int_t | fLastCe | Index of the last cell |
TMVA::MsgLogger* | fLogger | ! message logger |
Int_t* | fMaskDiv | ! [fDim] Dynamic Mask for cell division |
UInt_t | fMaxDepth | maximum depth of cell tree |
Int_t | fNBin | No. of bins in the edge histogram for cell MC exploration |
Int_t | fNCells | Maximum number of cells |
UInt_t | fNElements | number of variables in every cell |
Int_t | fNSampl | No. of MC events, when dividing (exploring) cell |
TString | fName | Name of a given instance of the FOAM class |
UInt_t | fNmin | minimal number of events in cell to split cell |
Int_t | fNoAct | Number of active cells |
Bool_t | fPeekMax | peek up cell with max. driver integral for split |
TRandom3* | fPseRan | Pointer to user-defined generator of pseudorandom numbers |
Double_t* | fRvec | [fDim] random number vector from r.n. generator fDim+1 maximum elements |
TMVA::Timer* | fTimer | timer for graphical output |
TObjArray* | fVariableNames | collection of all variable names |
Float_t | fVolFrac | volume fraction (with respect to total phase space |
Double_t* | fXmax | [fDim] maximum for variable transform |
Double_t* | fXmin | [fDim] minimum for variable transform |
Basic initialization of FOAM invoked by the user. IMPORTANT: Random number generator and the distribution object has to be provided using SetPseRan and SetRho prior to invoking this initializator! After the foam is grown, space for 2 variables is reserved in every cell. They are used for filling the foam cells.
Internal subprogram used by Create. It initializes "root part" of the FOAM of the tree of cells.
Internal subprogram used by Create. It initializes content of the newly allocated active cell.
Internal subprogram used by Create. It explores newly defined cell with help of special short MC sampling. As a result, estimates of kTRUE and drive volume is defined/determined Average and dispersion of the weight distribution will is found along each edge and the best edge (minimum dispersion, best maximum weight) is memorized for future use. The optimal division point for eventual future cell division is determined/recorded. Recorded are also minimum and maximum weight etc. The volume estimate in all (inactive) parent cells is updated. Note that links to parents and initial volume = 1/2 parent has to be already defined prior to calling this routine. If fNmin > 0 then the total number of (training) events found in the cell during the exploration is stored in the cell. This information is used withing PeekMax() to avoid splitting cells which contain less than fNmin events.
Internal subprogram used by Create. It explores newly defined cell with according to the decision tree logic. The separation set by the 'fDTSeparation' option is used (see also GetSeparation()). The optimal division point for eventual future cell division is determined/recorded. Note that links to parents and initial volume = 1/2 parent has to be already defined prior to calling this routine. Note, that according to the decision tree logic, a cell is only split, if the number of (unweighted) events in each dautghter cell is greater than fNmin.
Calculate the separation depending on 'fDTSeparation' for the given number of signal and background events 's', 'b'. Note, that if (s+b) < 0 or s < 0 or b < 0 than the return value is 0.
Internal subprogram used by Create. It finds cell with maximal driver integral for the purpose of the division. This function is overridden by the PDEFoam Class to apply cuts on the number of events in the cell (fNmin) and the cell tree depth (GetMaxDepth() > 0) during cell buildup.
Internal subprogram used by Create. It finds the last created active cell for the purpose of the division. Analogous to PeekMax() it is cut on the number of events in the cell (fNmin) and the cell tree depth (GetMaxDepth() > 0).
Internal subrogram used by Create. It divides cell iCell into two daughter cells. The iCell is retained and tagged as inactive, daughter cells are appended at the end of the buffer. New vertex is added to list of vertices. List of active cells is updated, iCell removed, two daughters added and their properties set with help of MC sampling (PDEFoam_Explore) Returns Code RC=-1 of buffer limit is reached, fLastCe=fnBuf.
Internal subprogram. Evaluates (training) distribution.
This can be called before Create, after setting kDim It defines which variables are excluded in the process of the cell division. For example 'FoamX->SetInhiDiv(1, 1);' inhibits division of y-variable.
User utility, miscellaneous and debug. Checks all pointers in the tree of cells. This is useful autodiagnostic. level=0, no printout, failures causes STOP level=1, printout, failures lead to WARNINGS only
This function removes a cell iCell, which has a volume equal to zero. It works the following way: 1) find grandparent to iCell 2) set daughter of the grandparent cell to the sister of iCell Result: iCell and its parent are alone standing ==> will be removed
debug function: checks all cells with respect to critical values, f.e. cell volume, ...
creates a TVectorD object with fNElements in every cell and initializes them by zero. The TVectorD object is used to store classification or regression data in every foam cell. Parameter: allcells == true : create TVectorD on every cell allcells == false : create TVectorD on active cells with cell index <= fLastCe (default)
Calculate average cell target in every cell and save them to the cell. This function is called when the Mono target regression option is set.
Calc discriminator and its error for every cell and save it to the cell. This function is called when the fSigBgSeparated==False option is set.
Get discriminator saved in cell (previously calculated in CalcCellDiscr()) which encloses the coordinates given in xvec. This function is used, when the fSigBgSeparated==False option is set (unified foams).
This function fills an event into the foam. In case of Mono-Target regression this function prepares the calculation of the average target value in every cell. Note, that only target 0 is saved in the cell! In case of a unified foam this function prepares the calculation of the cell discriminator in every cell. If 'NoNegWeights' is true, an event with negative weight will not be filled into the foam. (Default value: false)
Get regression value 0 from cell that contains the event vector xvec. This function is used when the MultiTargetRegression==False option is set.
This function returns the average value 'cv' of only nearest neighbor cells. It is used in cases, where empty cells shall not be evaluated. Parameters: - txvec - event vector, transformed into foam coordinates [0, 1] - cv - cell value, see definition of ECellValue
Returns true, if the value of the given cell is undefined.
This function is used when the MultiTargetRegression==True option is set. It calculates the mean target or most probable target values if 'tvals' variables are given ('tvals' does not contain targets) Parameters: - tvals - transformed event variables (element of [0,1]) (no targets!) - ts - method of target selection (kMean, kMpv) Result: vetor of mean targets or most probable targets over all cells which first coordinates enclose 'tvals'
This function is used when the MultiTargetRegression==True option is set. Returns regression value i, given the event variables 'vals'. Note: number of foam dimensions = number of variables + number of targets Parameters: - vals - event variables (no targets) - kernel - used kernel (None or Gaus) - ts - method of target selection (Mean or Mpv)
Returns density (=number of entries / volume) of cell that encloses the untransformed event vector 'xvec'. This function is called by GetMvaValue() in case of two separated foams (signal and background). 'kernel' can be either kNone or kGaus.
This function returns a value, which was saved in the foam cell, depending on the foam type. The value to return is specified with the 'cv' parameter.
This function finds the cell, which corresponds to the given untransformed event vector 'xvec' and return its value, which is given by the parameter 'cv'.
Returns the number of events, saved in the 'cell' during foam build-up. Only used during foam build-up!
Returns the cell value, corresponding to 'txvec' (foam coordinates [0,1]), weighted by the neighbor cells via a linear function. Parameters: - txvec - event vector, transformed into foam coordinates [0,1] - cv - cell value to be weighted - dim1, dim2 - dimensions for two-dimensional projection. Default values: dim1 = dim2 = -1 If dim1 and dim2 are set to values >=0 and <fDim, than the function GetProjectionCellValue() is used to get cell value. This is used for projection to two dimensions within Project2(). - TreatEmptyCells - if this option is set false (default), it is not checked, wether the cell or its neighbors are empty or not. If this option is set true, than only non-empty neighbor cells are taken into account for weighting. If the cell, which contains txvec is empty, than its value is replaced by the average value of the non-empty neighbor cells
Returns the gauss weight between the 'cell' and a given coordinate 'txvec'. Parameters: - cell - the cell - txvec - the transformed event variables (in [0,1]) (coordinates <0 are set to 0, >1 are set to 1) - dim - number of dimensions for the calculation of the euclidean distance. If dim=0, all dimensions of the foam are taken. Else only the first 'dim' coordinates of 'txvec' are used for the calculation of the euclidean distance. Returns: exp(-(d/sigma)^2/2), where - d - is the euclidean distance between 'txvec' and the point of the 'cell' which is most close to 'txvec' (in order to avoid artefacts because of the form of the cells). - sigma = 1/VolFrac
Find cell that contains 'xvec' (in foam coordinates [0,1]). Loop to find cell that contains 'xvec' starting at root cell, and traversing binary tree to find the cell quickly. Note, that if 'xvec' lies outside the foam, the cell which is nearest to 'xvec' is returned. (The returned pointer should never be NULL.)
This is a helper function for FindCells(). It saves in 'cells' all cells, which contain txvec. It works analogous to FindCell(). Parameters: - txvec - vector of variables (no targets!) (transformed into foam) - cell - cell to start searching with (usually root cell fCells[0]) - cells - list of cells found
Find all cells, that contain txvec. This function can be used, when the dimension of the foam is greater than the dimension of txvec. E.G this is the case for multi-target regression Parameters: - txvec - vector of variables (no targets!) (transformed into foam) Return value: - vector of cells, that fit txvec
Draws 1-dimensional foam (= histogram) Parameters: - opt - cell_value, rms, rms_ov_mean if cell_value is set, the following values will be filled into the result histogram: - number of events - in case of classification with 2 separate foams or multi-target regression - discriminator - in case of classification with one unified foam - target - in case of mono-target regression - nbin - number of bins of result histogram Warning: This function is not well tested!
Project foam variable idim1 and variable idim2 to histogram. Parameters: - idim1, idim2 - dimensions to project to - opt - cell_value, rms, rms_ov_mean if cell_value is set, the following values will be filled into the result histogram: - number of events - in case of classification with 2 separate foams or multi-target regression - discriminator - in case of classification with one unified foam - target - in case of mono-target regression - ker - kGaus, kNone (warning: Gaus may be very slow!) - nbin - number of bins in x and y direction of result histogram. Returns: a 2-dimensional histogram
Set cell element i of cell to value.
Debugging tool which plots the cells of a 2-dimensional PDEFoam as rectangles in C++ format readable for ROOT. Parameters: - filename - filename of ouput root macro - opt - cell_value, rms, rms_ov_mean If cell_value is set, the following values will be filled into the result histogram: - number of events - in case of classification with 2 separate foams or multi-target regression - discriminator - in case of classification with one unified foam - target - in case of mono-target regression If none of {cell_value, rms, rms_ov_mean} is given, the cells will not be filled. If 'opt' contains the string 'cellnumber', the index of each cell is draw in addition. - CreateCanvas - whether to create a new canvas or not - colors - whether to fill cells with colors or shades of grey - log_colors - whether to fill cells with colors (logarithmic scale) Example: The following commands load a mono-target regression foam from file 'foam.root' and create a ROOT macro 'output.C', which draws all PDEFoam cells with little boxes. The latter are filled with colors according to the target value stored in the cell. Also the cell number is drawn. TFile file("foam.root"); TMVA::PDEFoam *foam = (TMVA::PDEFoam*) gDirectory->Get("MonoTargetRegressionFoam"); foam->RootPlot2dim("output.C","cell_value,cellnumber"); gROOT->Macro("output.C");
Insert event to internal foam density PDEFoamDistr.
Set the foam type. This determinates the method of the calculation of the density during the foam build-up.
Getters and Setters for variable names
{ AddVariableName(new TObjString(s)); }