#ifndef ROOT_TMVA_MethodPDEFoam
#define ROOT_TMVA_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:
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 );
void Train( void );
void TrainMonoTargetRegression( void );
void TrainMultiTargetRegression( void );
void TrainSeparatedClassification( void );
void TrainUnifiedClassification( void );
void TrainMultiClassification();
using MethodBase::ReadWeightsFromStream;
void AddWeightsXMLTo( void* parent ) const;
void ReadWeightsFromStream( std::istream & i );
void ReadWeightsFromXML ( void* wghtnode );
void WriteFoamsToFile() const;
void ReadFoamsFromFile();
PDEFoam* ReadClonedFoamFromFile(TFile*, const TString&);
Double_t GetMvaValue( Double_t* err = 0, Double_t* errUpper = 0 );
const std::vector<Float_t>& GetMulticlassValues();
virtual const std::vector<Float_t>& GetRegressionValues();
virtual void Reset();
const Ranking* CreateRanking();
void GetNCuts(PDEFoamCell *cell, std::vector<UInt_t> &nCuts);
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:
void MakeClassSpecific( std::ostream&, const TString& ) const;
void GetHelpMessage() const;
Double_t CalculateMVAError();
void CalcXminXmax();
void SetXminXmax(TMVA::PDEFoam*);
PDEFoam* InitFoam(TString, EFoamType, UInt_t cls=0);
PDEFoamKernelBase* CreatePDEFoamKernel();
void DeleteFoams();
void FillVariableNamesToFoam() const;
private:
void DeclareOptions();
void DeclareCompatibilityOptions();
void ProcessOptions();
void PrintCoefficients( void );
template<typename T> T Sqr(T x) const { return x*x; }
Bool_t fSigBgSeparated;
Float_t fFrac;
Float_t fDiscrErrCut;
Float_t fVolFrac;
Int_t fnCells;
Int_t fnActiveCells;
Int_t fnSampl;
Int_t fnBin;
Int_t fEvPerBin;
Bool_t fCompress;
Bool_t fMultiTargetRegression;
UInt_t fNmin;
Bool_t fCutNmin;
UInt_t fMaxDepth;
TString fKernelStr;
EKernel fKernel;
PDEFoamKernelBase *fKernelEstimator;
TString fTargetSelectionStr;
ETargetSelection fTargetSelection;
Bool_t fFillFoamWithOrigWeights;
Bool_t fUseYesNoCell;
TString fDTLogic;
EDTSeparation fDTSeparation;
Bool_t fPeekMax;
std::vector<Float_t> fXmin, fXmax;
std::vector<PDEFoam*> fFoam;
void Init( void );
ClassDef(MethodPDEFoam,0)
};
}
#endif // MethodPDEFoam_H