45Envelope::Envelope(
const TString &
name,
DataLoader *dalaloader, TFile *
file,
const TString options)
47 fTransformations(
"I"), fSilentFile(
kFALSE), fJobs(1)
58 "Option to save the trained model in xml file or using serialization");
60 "\"Transformations=I;D;P;U;G,D\", for identity, "
61 "decorrelation, PCA, Uniform and Gaussianisation followed by "
62 "decorrelation transformations");
169 for (
auto &meth : fMethods) {
170 if (meth.GetValue<TString>(
"MethodName") == methodName && meth.GetValue<TString>(
"MethodTitle") == methodTitle) {
171 Log() << kFATAL <<
"Booking failed since method with title <" << methodTitle <<
"> already exists "
172 <<
"in with DataSet Name <" << fDataLoader->GetName() <<
"> " <<
Endl;
176 fMethod[
"MethodName"] = methodName;
177 fMethod[
"MethodTitle"] = methodTitle;
178 fMethod[
"MethodOptions"] = options;
180 fMethods.push_back(fMethod);
200 DeclareOptionRef(color,
"Color",
"Flag for coloured screen output (default: True, if in batch mode: False)");
201 DeclareOptionRef(drawProgressBar,
"DrawProgressBar",
202 "Draw progress bar to display training, testing and evaluation schedule (default: True)");
203 DeclareOptionRef(silent,
"Silent",
"Batch mode: boolean silent flag inhibiting any output from TMVA after the "
204 "creation of the factory class object (default: False)");
207 CheckForUnusedOptions();
210 Log().SetMinType(kVERBOSE);
227 for (
auto &meth : fMethods) {
228 if (meth.GetValue<TString>(
"MethodName") == methodname && meth.GetValue<TString>(
"MethodTitle") == methodtitle)
244 if (!RootBaseDir()->GetDirectory(fDataSetInfo.
GetName()))
245 RootBaseDir()->mkdir(fDataSetInfo.
GetName());
249 RootBaseDir()->cd(fDataSetInfo.
GetName());
261 TString(
"Correlation Matrix (") + fDataSetInfo.
GetClassInfo(cls)->
GetName() + TString(
")"));
292 TString processTrfs =
"I";
295 processTrfs = fTransformations;
298 std::vector<TMVA::TransformationHandler *> trfs;
302 std::vector<TString>::iterator trfsDefIt = trfsDef.begin();
303 for (; trfsDefIt != trfsDef.end(); ++trfsDefIt) {
305 TString trfS = (*trfsDefIt);
308 Log() << kDEBUG <<
"current transformation string: '" << trfS.Data() <<
"'" <<
Endl;
311 if (trfS.BeginsWith(
'I'))
312 identityTrHandler = trfs.back();
318 std::vector<TMVA::TransformationHandler *>::iterator trfIt = trfs.begin();
320 for (; trfIt != trfs.end(); ++trfIt) {
322 (*trfIt)->SetRootDir(RootBaseDir()->GetDirectory(fDataSetInfo.
GetName()));
323 (*trfIt)->CalcTransformations(inputEvents);
325 if (identityTrHandler)
329 for (trfIt = trfs.begin(); trfIt != trfs.end(); ++trfIt)
Service class for 2-Dim histogram classes.
void SetDrawProgressBar(Bool_t d)
void SetUseColor(Bool_t uc)
OptionBase * DeclareOptionRef(T &ref, const TString &name, const TString &desc="")
virtual void ParseOptions()
options parser
const TString & GetOptions() const
Class that contains all the data information.
virtual const char * GetName() const
Returns name of object.
const TMatrixD * CorrelationMatrix(const TString &className) const
UInt_t GetNClasses() const
DataSet * GetDataSet() const
returns data set
TH2 * CreateCorrelationMatrixHist(const TMatrixD *m, const TString &hName, const TString &hTitle) const
ClassInfo * GetClassInfo(Int_t clNum) const
const std::vector< Event * > & GetEventCollection(Types::ETreeType type=Types::kMaxTreeType) const
Bool_t HasMethod(TString methodname, TString methodtitle)
function to check methods booked
~Envelope()
Default destructor.
Bool_t IsModelPersistence()
Method to see if the algorithm model is saved in xml or serialized files.
std::shared_ptr< TFile > fFile
data
DataLoader * GetDataLoader()
Method to get the pointer to TMVA::DataLoader object.
Bool_t fModelPersistence
file to save the results
Bool_t IsSilentFile()
Method to see if a file is available to save results.
void SetDataLoader(DataLoader *dalaloader)
Method to set the pointer to TMVA::DataLoader object.
virtual void BookMethod(TString methodname, TString methodtitle, TString options="")
Method to book the machine learning method to perform the algorithm.
std::vector< OptionMap > fMethods
void SetVerbose(Bool_t status)
Method enable print extra information in the algorithms.
void SetFile(TFile *file)
Method to set the pointer to TFile object, with a writable file.
Bool_t IsVerbose()
Method to see if the algorithm should print extra information.
Bool_t fVerbose
flag to save the trained model
void SetModelPersistence(Bool_t status=kTRUE)
Method enable model persistence, then algorithms model is saved in xml or serialized files.
std::shared_ptr< DataLoader > fDataLoader
Booked method information.
virtual void ParseOptions()
Method to parse the internal option string.
TFile * GetFile()
Method to get the pointer to TFile object.
std::vector< OptionMap > & GetMethods()
Method get the Booked methods in a option map object.
TString fTransformations
flag for extra information
UInt_t fJobs
procpool object
void WriteDataInformation(TMVA::DataSetInfo &fDataSetInfo, TMVA::Types::EAnalysisType fAnalysisType)
method to save Train/Test information into the output file.
static void InhibitOutput()
class to storage options for the differents methods
static Types & Instance()
the the single instance of "Types" if existing already, or create it (Singleton)
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual const char * GetName() const
Returns name of object.
std::string GetMethodName(TCppMethod_t)
Abstract ClassifierFactory template that handles arbitrary types.
void CreateVariableTransforms(const TString &trafoDefinition, TMVA::DataSetInfo &dataInfo, TMVA::TransformationHandler &transformationHandler, TMVA::MsgLogger &log)
MsgLogger & Endl(MsgLogger &ml)