#ifndef ROOT_TMVA_Factory
#define ROOT_TMVA_Factory
#include <string>
#include <vector>
#include <map>
#ifndef ROOT_TCut
#include "TCut.h"
#endif
#ifndef ROOT_TMVA_Configurable
#include "TMVA/Configurable.h"
#endif
#ifndef ROOT_TMVA_Types
#include "TMVA/Types.h"
#endif
#ifndef ROOT_TMVA_DataSet
#include "TMVA/DataSet.h"
#endif
class TFile;
class TTree;
class TDirectory;
class TCanvas;
class TGraph;
class TH1F;
namespace TMVA {
class IMethod;
class MethodBase;
class DataInputHandler;
class DataSetInfo;
class DataSetManager;
class DataLoader;
class VariableTransformBase;
class Factory : public Configurable {
public:
typedef std::vector<IMethod*> MVector;
std::map<TString,MVector*> fMethodsMap;
Factory( TString theJobName, TFile* theTargetFile, TString theOption = "" );
Factory( TString theJobName, TString theOption = "" );
virtual ~Factory();
virtual const char* GetName() const { return "Factory"; }
MethodBase* BookMethod( DataLoader *loader, TString theMethodName, TString methodTitle, TString theOption = "" );
MethodBase* BookMethod( DataLoader *loader, Types::EMVA theMethod, TString methodTitle, TString theOption = "" );
MethodBase* BookMethod( DataLoader *, TMVA::Types::EMVA ,
TString ,
TString ,
TMVA::Types::EMVA ,
TString ) { return 0; }
std::map<TString,Double_t> OptimizeAllMethods (TString fomType="ROCIntegral", TString fitType="FitGA");
void OptimizeAllMethodsForClassification(TString fomType="ROCIntegral", TString fitType="FitGA") { OptimizeAllMethods(fomType,fitType); }
void OptimizeAllMethodsForRegression (TString fomType="ROCIntegral", TString fitType="FitGA") { OptimizeAllMethods(fomType,fitType); }
void TrainAllMethods ();
void TrainAllMethodsForClassification( void ) { TrainAllMethods(); }
void TrainAllMethodsForRegression ( void ) { TrainAllMethods(); }
void TestAllMethods();
void EvaluateAllMethods( void );
void EvaluateAllVariables(DataLoader *loader, TString options = "" );
TH1F* EvaluateImportance( DataLoader *loader,VIType vitype, Types::EMVA theMethod, TString methodTitle, const char *theOption = "" );
void DeleteAllMethods( void );
IMethod* GetMethod( const TString& datasetname, const TString& title )const;
Bool_t Verbose( void ) const { return fVerbose; }
void SetVerbose( Bool_t v=kTRUE );
virtual void MakeClass(const TString& datasetname , const TString& methodTitle = "" ) const;
void PrintHelpMessage(const TString& datasetname , const TString& methodTitle = "" ) const;
TDirectory* RootBaseDir() { return (TDirectory*)fgTargetFile; }
Bool_t IsSilentFile();
Bool_t IsModelPersistence();
Double_t GetROCIntegral(DataLoader *loader,TString theMethodName);
Double_t GetROCIntegral(TString datasetname,TString theMethodName);
TGraph* GetROCCurve(DataLoader *loader,TString theMethodName,Bool_t fLegend=kTRUE);
TGraph* GetROCCurve(TString datasetname,TString theMethodName,Bool_t fLegend=kTRUE);
TCanvas* GetROCCurve(DataLoader *loader);
TCanvas* GetROCCurve(TString datasetname);
private:
void Greetings();
TH1F* EvaluateImportanceShort( DataLoader *loader,Types::EMVA theMethod, TString methodTitle, const char *theOption = "" );
TH1F* EvaluateImportanceAll( DataLoader *loader,Types::EMVA theMethod, TString methodTitle, const char *theOption = "" );
TH1F* EvaluateImportanceRandom( DataLoader *loader,UInt_t nseeds, Types::EMVA theMethod, TString methodTitle, const char *theOption = "" );
TH1F* GetImportance(const int nbits,std::vector<Double_t> importances,std::vector<TString> varNames);
void WriteDataInformation(DataSetInfo& fDataSetInfo);
void SetInputTreesFromEventAssignTrees();
private:
TFile* fgTargetFile;
std::vector<TMVA::VariableTransformBase*> fDefaultTrfs;
TString fOptions;
TString fTransformations;
Bool_t fVerbose;
Bool_t fCorrelations;
Bool_t fROC;
Bool_t fSilentFile;
TString fJobName;
Types::EAnalysisType fAnalysisType;
Bool_t fModelPersistence;
protected:
ClassDef(Factory,0);
};
}
#endif