77 std::map<TString, TString>::const_iterator it =
keyValueMap.find(key);
141 std::vector<double> defaultValue)
149 std::vector<double> values;
156 std::stringstream
sstr;
177 " or cross entropy (binary classification).");
193 "Specify as 0.2 or 20% to use a fifth of the data set as validation set. "
194 "Specify as 100 to use exactly 100 events. (Default: 20%)");
206 "ConvergenceSteps=100,"
212 "Regularization=None,"
214 "TrainingStrategy",
"Defines the training strategies.");
222 Log() << kINFO <<
"Will ignore negative events in training!" <<
Endl;
226 Log() << kWARNING <<
"The STANDARD architecture is not supported anymore. "
227 "Please use Architecture=CPU or Architecture=CPU."
228 "See the TMVA Users' Guide for instructions if you "
229 "encounter problems."
231 Log() << kINFO <<
"We will use instead the CPU architecture" <<
Endl;
235 Log() << kERROR <<
"The OPENCL architecture has not been implemented yet. "
236 "Please use Architecture=CPU or Architecture=CPU for the "
237 "time being. See the TMVA Users' Guide for instructions "
238 "if you encounter problems."
241 Log() << kINFO <<
"We will try using the GPU-CUDA architecture if available" <<
Endl;
250 Log() << kINFO <<
"Will now use the GPU architecture !" <<
Endl;
252 Log() << kERROR <<
"CUDA backend not enabled. Please make sure "
253 "you have CUDA installed and it was successfully "
254 "detected by CMAKE by using -Dtmva-gpu=On "
257 Log() << kINFO <<
"Will now use instead the CPU architecture !" <<
Endl;
263 Log() << kINFO <<
"Will now use the CPU architecture with BLAS and IMT support !" <<
Endl;
265 Log() << kINFO <<
"Multi-core CPU backend not enabled. For better performances, make sure "
266 "you have a BLAS implementation and it was successfully "
267 "detected by CMake as well that the imt CMake flag is set."
269 Log() << kINFO <<
"Will use anyway the CPU architecture but with slower performance" <<
Endl;
289 Log() << kWARNING <<
"For regression only SUMOFSQUARES is a valid "
290 <<
" neural net error function. Setting error function to "
291 <<
" SUMOFSQUARES now." <<
Endl;
353 if (optimizer ==
"SGD") {
355 }
else if (optimizer ==
"ADAM") {
357 }
else if (optimizer ==
"ADAGRAD") {
359 }
else if (optimizer ==
"RMSPROP") {
361 }
else if (optimizer ==
"ADADELTA") {
370 std::vector<TString>
optimParamLabels = {
"_beta1",
"_beta2",
"_eps",
"_rho"};
373 {
"ADADELTA_eps", 1.E-8}, {
"ADADELTA_rho", 0.95},
374 {
"ADAGRAD_eps", 1.E-8},
375 {
"ADAM_beta1", 0.9}, {
"ADAM_beta2", 0.999}, {
"ADAM_eps", 1.E-7},
376 {
"RMSPROP_eps", 1.E-7}, {
"RMSPROP_rho", 0.9},
527template <
typename Architecture_t,
typename Layer_t>
581template <
typename Architecture_t,
typename Layer_t>
592 const size_t inputSize =
GetNvar();
624 }
else if (
width == 0) {
639 size_t outputSize = 1;
667template <
typename Architecture_t,
typename Layer_t>
766template <
typename Architecture_t,
typename Layer_t>
772 int filterHeight = 0;
811 deepNet.AddMaxPoolLayer(filterHeight, filterWidth, strideRows, strideCols);
814 if (
fBuildNet)
fNet->AddMaxPoolLayer(filterHeight, filterWidth, strideRows, strideCols);
827template <
typename Architecture_t,
typename Layer_t>
863 if (
flat ==
"FLAT") {
888template <
typename Architecture_t,
typename Layer_t>
895 double momentum = -1;
896 double epsilon = 0.0001;
907 momentum = std::atof(token->
GetString().Data());
911 epsilon = std::atof(token->
GetString().Data());
919 auto layer =
deepNet.AddBatchNormLayer(momentum, epsilon);
929template <
typename Architecture_t,
typename Layer_t>
1012 Log() << kFATAL <<
"Invalid Recurrent layer type " <<
Endl;
1020 fBatchHeight(), fBatchWidth(), fRandomSeed(0), fWeightInitialization(),
1021 fOutputFunction(), fLossFunction(), fInputLayoutString(), fBatchLayoutString(),
1022 fLayoutString(), fErrorStrategy(), fTrainingStrategyString(), fWeightInitializationString(),
1023 fArchitectureString(), fResume(
false), fBuildNet(
true), fTrainingSettings(),
1033 fBatchWidth(), fRandomSeed(0), fWeightInitialization(), fOutputFunction(),
1034 fLossFunction(), fInputLayoutString(), fBatchLayoutString(), fLayoutString(),
1035 fErrorStrategy(), fTrainingStrategyString(), fWeightInitializationString(),
1036 fArchitectureString(), fResume(
false), fBuildNet(
true), fTrainingSettings(),
1114 if (fNumValidationString.EndsWith(
"%")) {
1122 Log() << kFATAL <<
"Cannot parse number \"" << fNumValidationString
1123 <<
"\". Expected string like \"20%\" or \"20.0%\"." <<
Endl;
1125 }
else if (fNumValidationString.IsFloat()) {
1136 Log() <<
kFATAL <<
"Cannot parse number \"" << fNumValidationString <<
"\". Expected string like \"0.2\" or \"100\"."
1143 Log() <<
kFATAL <<
"Validation size \"" << fNumValidationString <<
"\" is negative." <<
Endl;
1147 Log() <<
kFATAL <<
"Validation size \"" << fNumValidationString <<
"\" is zero." <<
Endl;
1151 Log() <<
kFATAL <<
"Validation size \"" << fNumValidationString
1152 <<
"\" is larger than or equal in size to training set (size=\"" <<
trainingSetSize <<
"\")." <<
Endl;
1162template <
typename Architecture_t>
1166 using Scalar_t =
typename Architecture_t::Scalar_t;
1195 size_t batchSize =
settings.batchSize;
1217 Error(
"Train",
"Given batch depth of %zu (specified in BatchLayout) should be equal to given batch size %zu",
batchDepth,batchSize);
1221 Error(
"Train",
"Given batch height of %zu (specified in BatchLayout) should be equal to given batch size %zu",
batchHeight,batchSize);
1235 Error(
"Train",
"Given input layout %zu x %zu x %zu is not compatible with batch layout %zu x %zu x %zu ",
1242 Log() << kFATAL <<
"Number of samples in the datasets are train: ("
1244 <<
"). One of these is smaller than the batch size of "
1245 <<
settings.batchSize <<
". Please increase the batch"
1246 <<
" size to be at least the same size as the smallest"
1247 <<
" of them." <<
Endl;
1250 DeepNet_t
deepNet(batchSize, inputDepth, inputHeight, inputWidth,
batchDepth,
batchHeight,
batchWidth, J,
I,
R,
weightDecay);
1263 std::vector<DeepNet_t>
nets{};
1265 for (
size_t i = 0; i <
nThreads; i++) {
1285 for (
size_t i = 0; i <
deepNet.GetDepth(); ++i) {
1286 deepNet.GetLayerAt(i)->CopyParameters(*
fNet->GetLayerAt(i));
1307 Log() <<
"***** Deep Learning Network *****" <<
Endl;
1308 if (
Log().GetMinType() <= kINFO)
1316 {inputDepth, inputHeight, inputWidth},
1322 {inputDepth, inputHeight, inputWidth},
1333 Log() <<
"Compute initial loss on the validation data " <<
Endl;
1335 auto inputTensor =
batch.GetInput();
1336 auto outputMatrix =
batch.GetOutput();
1337 auto weights =
batch.GetWeights();
1350 std::unique_ptr<DNN::VOptimizer<Architecture_t, Layer_t, DeepNet_t>> optimizer;
1355 case EOptimizer::kSGD:
1356 optimizer = std::unique_ptr<DNN::TSGD<Architecture_t, Layer_t, DeepNet_t>>(
1360 case EOptimizer::kAdam: {
1361 optimizer = std::unique_ptr<DNN::TAdam<Architecture_t, Layer_t, DeepNet_t>>(
1364 settings.optimizerParams[
"ADAM_beta2"],
settings.optimizerParams[
"ADAM_eps"]));
1368 case EOptimizer::kAdagrad:
1369 optimizer = std::unique_ptr<DNN::TAdagrad<Architecture_t, Layer_t, DeepNet_t>>(
1371 settings.optimizerParams[
"ADAGRAD_eps"]));
1374 case EOptimizer::kRMSProp:
1375 optimizer = std::unique_ptr<DNN::TRMSProp<Architecture_t, Layer_t, DeepNet_t>>(
1377 settings.optimizerParams[
"RMSPROP_rho"],
1378 settings.optimizerParams[
"RMSPROP_eps"]));
1381 case EOptimizer::kAdadelta:
1382 optimizer = std::unique_ptr<DNN::TAdadelta<Architecture_t, Layer_t, DeepNet_t>>(
1384 settings.optimizerParams[
"ADADELTA_rho"],
1385 settings.optimizerParams[
"ADADELTA_eps"]));
1391 std::vector<TTensorBatch<Architecture_t>>
batches{};
1394 size_t convergenceCount = 0;
1398 std::chrono::time_point<std::chrono::system_clock>
tstart,
tend;
1399 tstart = std::chrono::system_clock::now();
1420 <<
" Optimizer " <<
settings.optimizerName
1422 <<
" Learning rate = " <<
settings.learningRate <<
" regularization " << (char)
settings.regularization
1425 std::string separator(62,
'-');
1427 Log() << std::setw(10) <<
"Epoch"
1428 <<
" | " << std::setw(12) <<
"Train Err." << std::setw(12) <<
"Val. Err." << std::setw(12)
1429 <<
"t(s)/epoch" << std::setw(12) <<
"t(s)/Loss" << std::setw(12) <<
"nEvents/s" << std::setw(12)
1430 <<
"Conv. Steps" <<
Endl;
1442 Log() <<
"Initial Deep Net Weights " <<
Endl;
1450 Log() <<
" Start epoch iteration ..." <<
Endl;
1469 if (
debugFirstEpoch) std::cout <<
"\n\n----- batch # " << i <<
"\n\n";
1474 std::cout <<
"got batch data - doing forward \n";
1478 Architecture_t::PrintTensor(
my_batch.GetInput(),
"input tensor",
true);
1479 typename Architecture_t::Tensor_t
tOut(
my_batch.GetOutput());
1480 typename Architecture_t::Tensor_t
tW(
my_batch.GetWeights());
1481 Architecture_t::PrintTensor(
tOut,
"label tensor",
true) ;
1482 Architecture_t::PrintTensor(
tW,
"weight tensor",
true) ;
1488 auto outputMatrix =
my_batch.GetOutput();
1489 auto weights =
my_batch.GetWeights();
1494 std::cout <<
"- doing backward \n";
1499 if (
deepNet.GetLayerAt(
l)->GetWeights().size() > 0)
1500 Architecture_t::PrintTensor(
deepNet.GetLayerAt(
l)->GetWeightsAt(0),
1503 Architecture_t::PrintTensor(
deepNet.GetLayerAt(
l)->GetOutput(),
1513 std::cout <<
"- doing optimizer update \n";
1516 optimizer->IncrementGlobalStep();
1520 std::cout <<
"minmimizer step - momentum " <<
settings.momentum <<
" learning rate " << optimizer->GetLearningRate() << std::endl;
1522 if (
deepNet.GetLayerAt(
l)->GetWeights().size() > 0) {
1523 Architecture_t::PrintTensor(
deepNet.GetLayerAt(
l)->GetWeightsAt(0),
TString::Format(
"weights after step layer %d",
l).Data());
1524 Architecture_t::PrintTensor(
deepNet.GetLayerAt(
l)->GetWeightGradientsAt(0),
"weight gradients");
1531 if (
debugFirstEpoch) std::cout <<
"\n End batch loop - compute validation loss \n";
1536 std::chrono::time_point<std::chrono::system_clock>
t1,
t2;
1538 t1 = std::chrono::system_clock::now();
1546 auto inputTensor =
batch.GetInput();
1547 auto outputMatrix =
batch.GetOutput();
1548 auto weights =
batch.GetWeights();
1560 t2 = std::chrono::system_clock::now();
1564 convergenceCount = 0;
1566 convergenceCount +=
settings.testInterval;
1573 <<
" Minimum Test error found - save the configuration " <<
Endl;
1574 for (
size_t i = 0; i <
deepNet.GetDepth(); ++i) {
1575 fNet->GetLayerAt(i)->CopyParameters(*
deepNet.GetLayerAt(i));
1593 auto inputTensor =
batch.GetInput();
1594 auto outputMatrix =
batch.GetOutput();
1595 auto weights =
batch.GetWeights();
1607 tend = std::chrono::system_clock::now();
1628 << std::setw(12) << seconds /
settings.testInterval
1631 << std::setw(12) << convergenceCount
1637 tstart = std::chrono::system_clock::now();
1661 Log() << kFATAL <<
"Not implemented yet" <<
Endl;
1667#ifdef R__HAS_TMVAGPU
1668 Log() << kINFO <<
"Start of deep neural network training on GPU." <<
Endl <<
Endl;
1675 Log() << kFATAL <<
"CUDA backend not enabled. Please make sure "
1676 "you have CUDA installed and it was successfully "
1677 "detected by CMAKE."
1682#ifdef R__HAS_TMVACPU
1685 Log() << kINFO <<
"Start of deep neural network training on CPU using MT, nthreads = "
1688 Log() << kINFO <<
"Start of deep neural network training on single thread CPU (without ROOT-MT support) " <<
Endl
1696 " is not a supported architecture for TMVA::MethodDL"
1712 if (!fNet || fNet->GetDepth() == 0) {
1713 Log() << kFATAL <<
"The network has not been trained and fNet is not built" <<
Endl;
1715 if (fNet->GetBatchSize() != 1) {
1716 Log() << kFATAL <<
"FillINputTensor::Network batch size must be equal to 1 when doing single event predicition" <<
Endl;
1720 const std::vector<Float_t> &
inputValues = GetEvent()->GetValues();
1721 size_t nVariables = GetEvent()->GetNVariables();
1724 if (fXInput.GetLayout() == TMVA::Experimental::MemoryLayout::ColumnMajor) {
1725 R__ASSERT(fXInput.GetShape().size() < 4);
1727 if (fXInput.GetShape().size() == 2) {
1728 nc = fXInput.GetShape()[0];
1730 ArchitectureImpl_t::PrintTensor(fXInput);
1731 Log() << kFATAL <<
"First tensor dimension should be equal to batch size, i.e. = 1" <<
Endl;
1733 nhw = fXInput.GetShape()[1];
1735 nc = fXInput.GetCSize();
1736 nhw = fXInput.GetWSize();
1739 Log() << kFATAL <<
"Input Event variable dimensions are not compatible with the built network architecture"
1740 <<
" n-event variables " <<
nVariables <<
" expected input tensor " << nc <<
" x " <<
nhw <<
Endl;
1742 for (
size_t j = 0;
j < nc;
j++) {
1743 for (
size_t k = 0; k <
nhw; k++) {
1750 assert(fXInput.GetShape().size() >= 4);
1751 size_t nc = fXInput.GetCSize();
1752 size_t nh = fXInput.GetHSize();
1753 size_t nw = fXInput.GetWSize();
1754 size_t n = nc *
nh *
nw;
1756 Log() << kFATAL <<
"Input Event variable dimensions are not compatible with the built network architecture"
1757 <<
" n-event variables " <<
nVariables <<
" expected input tensor " << nc <<
" x " <<
nh <<
" x " <<
nw
1760 for (
size_t j = 0;
j <
n;
j++) {
1766 fXInput.GetDeviceBuffer().CopyFrom(fXInputBuffer);
1783#ifdef DEBUG_MVAVALUE
1784 using Tensor_t = std::vector<MatrixImpl_t>;
1786 std::cout <<
"Input data - class " <<
GetEvent()->GetClass() << std::endl;
1788 std::cout <<
"Output of DeepNet " <<
mvaValue << std::endl;
1790 std::cout <<
"Loop on layers " << std::endl;
1791 for (
int l = 0;
l <
deepnet.GetDepth(); ++
l) {
1792 std::cout <<
"Layer " <<
l;
1796 std::cout <<
"DNN output " <<
layer_output.size() << std::endl;
1798#ifdef R__HAS_TMVAGPU
1807 std::cout <<
"DNN weights " <<
layer_weights.size() << std::endl;
1810#ifdef R__HAS_TMVAGPU
1826template <
typename Architecture_t>
1831 if (!
fNet ||
fNet->GetDepth() == 0) {
1832 Log() << kFATAL <<
"The network has not been trained and fNet is not built"
1850 using Matrix_t =
typename Architecture_t::Matrix_t;
1854 DeepNet_t
deepNet(batchSize, inputDepth, inputHeight, inputWidth,
batchDepth,
batchHeight,
batchWidth, J,
I,
R,
weightDecay);
1855 std::vector<DeepNet_t>
nets{};
1860 for (
size_t i = 0; i <
deepNet.GetDepth(); ++i) {
1861 deepNet.GetLayerAt(i)->CopyParameters(*
fNet->GetLayerAt(i));
1879 TensorDataLoader_t testData(
testTuple, nEvents, batchSize, {inputDepth, inputHeight, inputWidth}, {
n0,
n1,
n2},
deepNet.GetOutputWidth(), 1);
1896 <<
" sample (" << nEvents <<
" events)" <<
Endl;
1900 std::vector<double> mvaValues(nEvents);
1913 if (
n1 == batchSize &&
n0 == 1) {
1915 Log() << kFATAL <<
"Input Event variable dimensions are not compatible with the built network architecture"
1916 <<
" n-event variables " <<
nVariables <<
" expected input matrix " <<
n1 <<
" x " <<
n2
1921 Log() << kFATAL <<
"Input Event variable dimensions are not compatible with the built network architecture"
1922 <<
" n-event variables " <<
nVariables <<
" expected input tensor " <<
n0 <<
" x " <<
n1 <<
" x " <<
n2
1929 auto inputTensor =
batch.GetInput();
1934 for (
size_t i = 0; i < batchSize; ++i) {
1950 <<
"Elapsed time for evaluation of " << nEvents <<
" events: "
1951 <<
timer.GetElapsedTime() <<
" " <<
Endl;
1966 fNet->Prediction(*fYHat, fXInput, fOutputFunction);
1968 size_t nTargets = DataInfo().GetNTargets();
1972 for (
size_t i = 0; i <
nTargets; i++)
1973 output[i] = (*fYHat)(0, i);
1976 if (fRegressionReturnVal ==
NULL)
1977 fRegressionReturnVal =
new std::vector<Float_t>(
nTargets);
1982 for (
size_t i = 0; i <
nTargets; ++i) {
1985 const Event *
evT2 = GetTransformationHandler().InverseTransform(
evT);
1986 for (
size_t i = 0; i <
nTargets; ++i) {
1987 (*fRegressionReturnVal)[i] =
evT2->GetTarget(i);
1990 return *fRegressionReturnVal;
2000 fNet->Prediction(*fYHat, fXInput, fOutputFunction);
2002 size_t nClasses = DataInfo().GetNClasses();
2005 if (fMulticlassReturnVal ==
NULL) {
2006 fMulticlassReturnVal =
new std::vector<Float_t>(
nClasses);
2010 for (
size_t i = 0; i <
nClasses; i++) {
2011 (*fMulticlassReturnVal)[i] = (*fYHat)(0, i);
2013 return *fMulticlassReturnVal;
2032 if (
size_t(nEvents) < batchSize ) batchSize = nEvents;
2036#ifdef R__HAS_TMVAGPU
2037 Log() << kINFO <<
"Evaluate deep neural network on GPU using batches with size = " << batchSize <<
Endl <<
Endl;
2046 Log() << kINFO <<
"Evaluate deep neural network on CPU using batches with size = " << batchSize <<
Endl <<
Endl;
2054 void*
nn =
xmlEngine.NewChild(parent, 0,
"Weights");
2062 Int_t inputDepth =
fNet->GetInputDepth();
2063 Int_t inputHeight =
fNet->GetInputHeight();
2064 Int_t inputWidth =
fNet->GetInputWidth();
2122 size_t inputDepth, inputHeight, inputWidth;
2172 for (
size_t i = 0; i <
netDepth; i++) {
2199 size_t strideRows, strideCols = 0;
2223 size_t filterHeight, filterWidth = 0;
2224 size_t strideRows, strideCols = 0;
2230 fNet->AddMaxPoolLayer(filterHeight, filterWidth, strideRows, strideCols);
2292 "Cannot use a reset gate after to false with CudNN - use implementation with resetgate=true");
2297 else if (
layerName ==
"BatchNormLayer") {
2299 fNet->AddBatchNormLayer(0., 0.0);
2302 fNet->GetLayers().back()->ReadWeightsFromXML(
layerXML);
#define REGISTER_METHOD(CLASS)
for example
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
double Double_t
Double 8 bytes.
long long Long64_t
Portable signed long integer 8 bytes.
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
const_iterator end() const
OptionBase * DeclareOptionRef(T &ref, const TString &name, const TString &desc="")
void AddPreDefVal(const T &)
Adadelta Optimizer class.
static Tensor_t CreateTensor(size_t n, size_t c, size_t h, size_t w)
Generic Deep Neural Network class.
Stochastic Batch Gradient Descent Optimizer class.
Generic General Layer class.
Class that contains all the data information.
UInt_t GetNClasses() const
Types::ETreeType GetCurrentType() const
Long64_t GetNEvents(Types::ETreeType type=Types::kMaxTreeType) const
void SetCurrentEvent(Long64_t ievt) const
Virtual base Class for all MVA method.
const char * GetName() const override
Bool_t IgnoreEventsWithNegWeightsInTraining() const
const std::vector< TMVA::Event * > & GetEventCollection(Types::ETreeType type)
returns the event collection (i.e.
UInt_t GetNTargets() const
const TString & GetMethodName() const
const Event * GetEvent() const
DataSetInfo & DataInfo() const
UInt_t GetNVariables() const
Types::EAnalysisType fAnalysisType
TrainingHistory fTrainHistory
IPythonInteractive * fInteractive
temporary dataset used when evaluating on a different data (used by MethodCategory::GetMvaValues)
size_t fBatchHeight
The height of the batch used to train the deep net.
DNN::ELossFunction fLossFunction
The loss function.
std::vector< size_t > fInputShape
Contains the batch size (no.
Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets) override
Check the type of analysis the deep learning network can do.
TString fLayoutString
The string defining the layout of the deep net.
std::vector< Double_t > GetMvaValues(Long64_t firstEvt, Long64_t lastEvt, Bool_t logProgress) override
Evaluate the DeepNet on a vector of input values stored in the TMVA Event class Here we will evaluate...
void SetInputDepth(int inputDepth)
Setters.
std::unique_ptr< MatrixImpl_t > fYHat
size_t GetBatchHeight() const
void ReadWeightsFromXML(void *wghtnode) override
TString fWeightInitializationString
The string defining the weight initialization method.
void ParseMaxPoolLayer(DNN::TDeepNet< Architecture_t, Layer_t > &deepNet, std::vector< DNN::TDeepNet< Architecture_t, Layer_t > > &nets, TString layerString, TString delim)
Pases the layer string and creates the appropriate max pool layer.
size_t fRandomSeed
The random seed used to initialize the weights and shuffling batches (default is zero)
TString fArchitectureString
The string defining the architecture: CPU or GPU.
MethodDL(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption)
Constructor.
void Train() override
Methods for training the deep learning network.
void TrainDeepNet()
train of deep neural network using the defined architecture
const std::vector< TTrainingSettings > & GetTrainingSettings() const
DNN::EOutputFunction GetOutputFunction() const
void ParseDenseLayer(DNN::TDeepNet< Architecture_t, Layer_t > &deepNet, std::vector< DNN::TDeepNet< Architecture_t, Layer_t > > &nets, TString layerString, TString delim)
Pases the layer string and creates the appropriate dense layer.
UInt_t GetNumValidationSamples()
parce the validation string and return the number of event data used for validation
TString GetBatchLayoutString() const
void SetInputWidth(int inputWidth)
HostBufferImpl_t fXInputBuffer
size_t fBatchWidth
The width of the batch used to train the deep net.
size_t GetInputDepth() const
std::unique_ptr< DeepNetImpl_t > fNet
TString GetInputLayoutString() const
void SetBatchHeight(size_t batchHeight)
void GetHelpMessage() const override
std::vector< std::map< TString, TString > > KeyValueVector_t
size_t GetInputHeight() const
TString GetArchitectureString() const
void ParseBatchLayout()
Parse the input layout.
void ParseBatchNormLayer(DNN::TDeepNet< Architecture_t, Layer_t > &deepNet, std::vector< DNN::TDeepNet< Architecture_t, Layer_t > > &nets, TString layerString, TString delim)
Pases the layer string and creates the appropriate reshape layer.
Double_t GetMvaValue(Double_t *err=nullptr, Double_t *errUpper=nullptr) override
const std::vector< Float_t > & GetRegressionValues() override
TString fNumValidationString
The string defining the number (or percentage) of training data used for validation.
typename ArchitectureImpl_t::Tensor_t TensorImpl_t
DNN::EOutputFunction fOutputFunction
The output function for making the predictions.
DNN::EInitialization fWeightInitialization
The initialization method.
void AddWeightsXMLTo(void *parent) const override
size_t GetBatchDepth() const
void ParseRecurrentLayer(ERecurrentLayerType type, DNN::TDeepNet< Architecture_t, Layer_t > &deepNet, std::vector< DNN::TDeepNet< Architecture_t, Layer_t > > &nets, TString layerString, TString delim)
Pases the layer string and creates the appropriate rnn layer.
std::vector< TTrainingSettings > fTrainingSettings
The vector defining each training strategy.
size_t GetInputWidth() const
void SetInputShape(std::vector< size_t > inputShape)
DNN::ELossFunction GetLossFunction() const
TString fBatchLayoutString
The string defining the layout of the batch.
void DeclareOptions() override
The option handling methods.
void ParseConvLayer(DNN::TDeepNet< Architecture_t, Layer_t > &deepNet, std::vector< DNN::TDeepNet< Architecture_t, Layer_t > > &nets, TString layerString, TString delim)
Pases the layer string and creates the appropriate convolutional layer.
void ParseReshapeLayer(DNN::TDeepNet< Architecture_t, Layer_t > &deepNet, std::vector< DNN::TDeepNet< Architecture_t, Layer_t > > &nets, TString layerString, TString delim)
Pases the layer string and creates the appropriate reshape layer.
TString fTrainingStrategyString
The string defining the training strategy.
typename ArchitectureImpl_t::HostBuffer_t HostBufferImpl_t
void SetBatchDepth(size_t batchDepth)
KeyValueVector_t ParseKeyValueString(TString parseString, TString blockDelim, TString tokenDelim)
Function for parsing the training settings, provided as a string in a key-value form.
void SetBatchWidth(size_t batchWidth)
std::vector< Double_t > PredictDeepNet(Long64_t firstEvt, Long64_t lastEvt, size_t batchSize, Bool_t logProgress)
perform prediction of the deep neural network using batches (called by GetMvaValues)
void ReadWeightsFromStream(std::istream &) override
DNN::EInitialization GetWeightInitialization() const
void SetBatchSize(size_t batchSize)
TString GetLayoutString() const
size_t fBatchDepth
The depth of the batch used to train the deep net.
void ProcessOptions() override
TMVA::DNN::TDeepNet< ArchitectureImpl_t > DeepNetImpl_t
void Init() override
default initializations
size_t GetBatchWidth() const
typename ArchitectureImpl_t::Matrix_t MatrixImpl_t
const std::vector< Float_t > & GetMulticlassValues() override
virtual ~MethodDL()
Virtual Destructor.
void ParseInputLayout()
Parse the input layout.
void FillInputTensor()
Get the input event tensor for evaluation Internal function to fill the fXInput tensor with the corre...
bool fBuildNet
Flag to control whether to build fNet, the stored network used for the evaluation.
const Ranking * CreateRanking() override
void SetInputHeight(int inputHeight)
void CreateDeepNet(DNN::TDeepNet< Architecture_t, Layer_t > &deepNet, std::vector< DNN::TDeepNet< Architecture_t, Layer_t > > &nets)
After calling the ProcesOptions(), all of the options are parsed, so using the parsed options,...
TString fErrorStrategy
The string defining the error strategy for training.
TString fInputLayoutString
The string defining the layout of the input.
EMsgType GetMinType() const
Ranking for variables in method (implementation)
Timing information for training and evaluation of MVA methods.
void AddValue(TString Property, Int_t stage, Double_t value)
Singleton class for Global types used by TMVA.
void Print(Option_t *option="") const override
Dump this marker with its attributes.
void Print(Option_t *option="") const override
Print TNamed name and title.
Collectable string class.
const TString & GetString() const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
void ToUpper()
Change string to upper case.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
XMLNodePointer_t GetChild(XMLNodePointer_t xmlnode, Bool_t realnode=kTRUE)
returns first child of xmlnode
const char * GetNodeName(XMLNodePointer_t xmlnode)
returns name of xmlnode
EOptimizer
Enum representing the optimizer used for training.
EOutputFunction
Enum that represents output functions.
double weightDecay(double error, ItWeight itWeight, ItWeight itWeightEnd, double factorWeightDecay, EnumRegularization eRegularization)
compute the weight decay for regularization (L1 or L2)
auto regularization(const typename Architecture_t::Matrix_t &A, ERegularization R) -> decltype(Architecture_t::L1Regularization(A))
Evaluate the regularization functional for a given weight matrix.
ERegularization
Enum representing the regularization type applied for a given layer.
EActivationFunction
Enum that represents layer activation functions.
ELossFunction
Enum that represents objective functions for the net, i.e.
std::tuple< const std::vector< Event * > &, const DataSetInfo & > TMVAInput_t
create variable transformations
TString fetchValueTmp(const std::map< TString, TString > &keyValueMap, TString key)
MsgLogger & Endl(MsgLogger &ml)
Double_t Log(Double_t x)
Returns the natural logarithm of x.
All of the options that can be specified in the training string.