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(Bool_t CreateCellElements = false) |
Bool_t | CutNmin() |
void | CutNmin(Bool_t cut) |
Bool_t | CutRMSmin() |
void | CutRMSmin(Bool_t cut) |
virtual void | TObject::Delete(Option_t* option = "")MENU |
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() |
TString | GetFoamName() const |
TMVA::EFoamType | GetFoamType() const |
virtual const char* | TObject::GetIconName() 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 |
Double_t | GetPDEFoamVolumeFraction() 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) |
Double_t | GetRMSmin() |
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) |
Double_t | GetXmax(Int_t idim) |
Double_t | GetXmin(Int_t idim) |
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 |
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&) |
TMVA::PDEFoam | PDEFoam(const TMVA::PDEFoam&) |
virtual void | TObject::Pop() |
virtual void | TObject::Print(Option_t* option = "") const |
void | PrintCellElements() |
void | PrintCells() |
void | PrintStream(ostream&) const |
TH2D* | Project2(Int_t idim1, Int_t idim2, const char* opt = "nev", const char* ker = "kNone", UInt_t maxbins = 0) |
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, string what, 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 | SetBackgroundClass(Int_t cls) |
void | TObject::SetBit(UInt_t f) |
void | TObject::SetBit(UInt_t f, Bool_t set) |
virtual void | TObject::SetDrawOption(Option_t* option = "")MENU |
static void | TObject::SetDtorOnly(void* obj) |
void | SetEvPerBin(Int_t EvPerBin) |
void | SetFoamType(TMVA::EFoamType ft) |
void | SetInhiDiv(Int_t, Int_t) |
void | SetkDim(Int_t kDim) |
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 | SetPDEFoamVolumeFraction(Double_t vfr) |
void | SetRMSmin(Double_t val) |
void | SetSignalClass(Int_t cls) |
virtual void | TObject::SetUniqueID(UInt_t uid) |
void | SetVolumeFraction(Double_t) |
void | SetXmax(Int_t idim, Double_t wmax) |
void | SetXmin(Int_t idim, Double_t wmin) |
virtual void | ShowMembers(TMemberInspector& insp, char* parent) |
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) |
Float_t | VarTransform(Int_t idim, Float_t x) |
vector<Float_t> | VarTransformInvers(vector<Float_t> invec) |
Float_t | VarTransformInvers(Int_t idim, Float_t x) |
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 |
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 |
Int_t | fBackgroundClass | TODO: intermediate solution to keep IsSignal() of Event working. TODO: remove IsSignal() from Event |
TMVA::PDEFoamCell** | fCells | [fNCells] Array of ALL cells |
Bool_t | fCutNmin | true: activate cut on minimal number of events in cell |
Bool_t | fCutRMSmin | true: peek cell with max. RMS for next split |
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 |
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 |
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 |
TRandom3* | fPseRan | Pointer to user-defined generator of pseudorandom numbers |
Double_t | fRMSmin | activate cut: minimal RMS in cell to split cell |
Double_t* | fRvec | [fDim] random number vector from r.n. generator fDim+1 maximum elements |
Int_t | fSignalClass | TODO: intermediate solution to keep IsSignal() of Event working. TODO: remove IsSignal() from Event |
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!
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. This function is overridden from the original PDEFoam::Explore() to provide an extra option: Filling edge histograms directly from the input distributions, w/o MC sampling if fNSampl == 0 Warning: This option is not tested jet!
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 distribution to be generated.
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 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 [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 '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 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!
results the cell value, corresponding to txvec, weighted by the neighor cells via a linear function Parameters - txvec - event vector, transformed to interval [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 loop to find cell that contains xvec start from root Cell, uses binary tree to find cell quickly
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!) - maxbins - maximal number of bins in result histogram. Set maxbins to 0 if no maximum bin number should be used. Returns: a 2-dimensional histogram
Returns pointer to cell elements. The given event vector 'xvec' must be untransformed (i.e. [xmin, xmax]).
Set cell element i of cell to value.
Debugging tool which plots 2-dimensional cells as rectangles in C++ format readable for root. Parameters: - filename - filename of ouput root macro - CreateCanvas - whether to create a new canvas or not
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)); }