Logo ROOT   6.10/09
Reference Guide
Envelope.cxx
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Omar Zapata
3 
4 /*! \class TMVA::Envelope
5 \ingroup TMVA
6 
7 Base class for all machine learning algorithms
8 
9 */
10 
11 #include "TMVA/Envelope.h"
12 
13 #include "TMVA/Configurable.h"
14 #include "TMVA/DataLoader.h"
15 #include "TMVA/MethodBase.h"
16 #include "TMVA/OptionMap.h"
18 #include "TMVA/Types.h"
19 
20 #include "TAxis.h"
21 #include "TCanvas.h"
22 #include "TFile.h"
23 #include "TGraph.h"
24 #include "TSystem.h"
25 
26 #include <iostream>
27 
28 using namespace TMVA;
29 
30 ////////////////////////////////////////////////////////////////////////////////
31 
32 Envelope::Envelope(const TString &name,DataLoader *dalaloader,TFile *file,const TString options):Configurable(options),fDataLoader(dalaloader),fFile(file),fVerbose(kFALSE)
33 {
34  SetName(name.Data());
36 }
37 
38 ////////////////////////////////////////////////////////////////////////////////
39 
41 {}
42 
43 ////////////////////////////////////////////////////////////////////////////////
44 
45 Bool_t Envelope::IsSilentFile(){return fFile==nullptr;}
46 
47 ////////////////////////////////////////////////////////////////////////////////
48 
49 TFile* Envelope::GetFile(){return fFile.get();}
50 // TFile* Envelope::GetFile(){return fFile==nullptr?0:fFile.get();}
51 
52 ////////////////////////////////////////////////////////////////////////////////
53 
54 void Envelope::SetFile(TFile *file){fFile=std::shared_ptr<TFile>(file);}
55 
56 ////////////////////////////////////////////////////////////////////////////////
57 
59 
60 ////////////////////////////////////////////////////////////////////////////////
61 
62 void Envelope::SetVerbose(Bool_t status){fVerbose=status;}
63 
64 ////////////////////////////////////////////////////////////////////////////////
65 
67 
68 ////////////////////////////////////////////////////////////////////////////////
69 
71 
72 ////////////////////////////////////////////////////////////////////////////////
73 
75  fDataLoader=std::shared_ptr<DataLoader>(dalaloader) ;
76 }
77 
78 ////////////////////////////////////////////////////////////////////////////////
79 
81 
82 ////////////////////////////////////////////////////////////////////////////////
83 
85 
86 ////////////////////////////////////////////////////////////////////////////////
87 
88 void TMVA::Envelope::BookMethod(Types::EMVA method, TString methodTitle, TString options){
89  return BookMethod(Types::Instance().GetMethodName( method ),methodTitle,options);
90 }
91 
92 ////////////////////////////////////////////////////////////////////////////////
93 
94 void TMVA::Envelope::BookMethod(TString methodName, TString methodTitle, TString options){
95  fMethod["MethodName"] = methodName;
96  fMethod["MethodTitle"] = methodTitle;
97  fMethod["MethodOptions"] = options;
98 }
virtual void BookMethod(TString methodname, TString methodtitle, TString options="")
Method to book the machine learning method to perform the algorithm.
Definition: Envelope.cxx:94
Bool_t fVerbose
Definition: Envelope.h:42
~Envelope()
Default destructor.
Definition: Envelope.cxx:40
void SetFile(TFile *file)
Method to set the pointer to TFile object, with a writable file.
Definition: Envelope.cxx:54
static Types & Instance()
the the single instance of "Types" if existing already, or create it (Singleton)
Definition: Types.cxx:70
Bool_t IsModelPersistence()
Method to see if the algorithm model is saved in xml or serialized files.
Definition: Envelope.cxx:80
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:131
class to storage options for the differents methods
Definition: OptionMap.h:35
bool Bool_t
Definition: RtypesCore.h:59
std::shared_ptr< TFile > fFile
Definition: Envelope.h:40
Bool_t IsSilentFile()
Method to see if a file is available to save results.
Definition: Envelope.cxx:45
DataLoader * GetDataLoader()
Method to get the pointer to TMVA::DataLoader object.
Definition: Envelope.cxx:70
OptionMap fMethod
Definition: Envelope.h:38
Envelope(const TString &name, DataLoader *dataloader=nullptr, TFile *file=nullptr, const TString options="")
Constructor for the initialization of Envelopes, differents Envelopes may needs differents constructo...
Definition: Envelope.cxx:32
std::string GetMethodName(TCppMethod_t)
Definition: Cppyy.cxx:733
void SetVerbose(Bool_t status)
Method enable print extra information in the algorithms.
Definition: Envelope.cxx:62
void SetDataLoader(DataLoader *dalaloader)
Method to set the pointer to TMVA::DataLoader object.
Definition: Envelope.cxx:74
Bool_t IsVerbose()
Method to see if the algorithm should print extra information.
Definition: Envelope.cxx:58
const Bool_t kFALSE
Definition: RtypesCore.h:92
void SetModelPersistence(Bool_t status=kTRUE)
Method enable model persistence, then algorithms model is saved in xml or serialized files...
Definition: Envelope.cxx:84
OptionMap & GetMethod()
Method get the Booked method in a option map object.
Definition: Envelope.cxx:66
Bool_t fModelPersistence
file to save the results
Definition: Envelope.h:41
std::shared_ptr< DataLoader > fDataLoader
Definition: Envelope.h:39
Abstract ClassifierFactory template that handles arbitrary types.
TFile * GetFile()
Method to get the pointer to TFile object.
Definition: Envelope.cxx:49
Definition: file.py:1
const Bool_t kTRUE
Definition: RtypesCore.h:91