81 : MethodBase(
jobName, Types::kDNN, methodTitle,
theData,
theOption), fWeightInitialization(), fOutputFunction(),
82 fLayoutString(), fErrorStrategy(), fTrainingStrategyString(), fWeightInitializationString(),
83 fArchitectureString(), fTrainingSettings(), fResume(
false), fSettings()
93 fWeightInitialization(), fOutputFunction(), fLayoutString(), fErrorStrategy(),
94 fTrainingStrategyString(), fWeightInitializationString(), fArchitectureString(),
95 fTrainingSettings(), fResume(
false), fSettings()
97 fWeightInitialization = DNN::EInitialization::kGauss;
98 fOutputFunction = DNN::EOutputFunction::kSigmoid;
130 <<
"MethodDNN is deprecated and it will be removed in future ROOT version. "
131 "Please use MethodDL ( TMVA::kDL)"
152 DeclareOptionRef(fLayoutString=
"SOFTSIGN|(N+100)*2,LINEAR",
154 "Layout of the network.");
156 DeclareOptionRef(fValidationSize =
"20%",
"ValidationSize",
157 "Part of the training data to use for "
158 "validation. Specify as 0.2 or 20% to use a "
159 "fifth of the data set as validation set. "
160 "Specify as 100 to use exactly 100 events. "
163 DeclareOptionRef(fErrorStrategy=
"CROSSENTROPY",
165 "Loss function: Mean squared error (regression)"
166 " or cross entropy (binary classification).");
167 AddPreDefVal(
TString(
"CROSSENTROPY"));
168 AddPreDefVal(
TString(
"SUMOFSQUARES"));
169 AddPreDefVal(
TString(
"MUTUALEXCLUSIVE"));
171 DeclareOptionRef(fWeightInitializationString=
"XAVIER",
172 "WeightInitialization",
173 "Weight initialization strategy");
174 AddPreDefVal(
TString(
"XAVIER"));
175 AddPreDefVal(
TString(
"XAVIERUNIFORM"));
177 DeclareOptionRef(fArchitectureString =
"CPU",
"Architecture",
"Which architecture to perform the training on.");
178 AddPreDefVal(
TString(
"STANDARD"));
181 AddPreDefVal(
TString(
"OPENCL"));
184 fTrainingStrategyString =
"LearningRate=1e-1,"
187 "ConvergenceSteps=50,"
193 "DropRepetitions=5|LearningRate=1e-4,"
196 "ConvergenceSteps=50,"
201 "DropConfig=0.0+0.5+0.5,"
203 "Multithreading=True",
205 "Defines the training strategies.");
219 const size_t inputSize = GetNvar();
227 EActivationFunction activationFunction = EActivationFunction::kTanh;
263 numNodes =
fml.Eval (inputSize);
269 layout.push_back(std::make_pair(numNodes, activationFunction));
323 std::map<TString, TString>::const_iterator it =
keyValueMap.find (key);
348 return value.Atoi ();
355 TString key,
double defaultValue)
361 return value.Atof ();
381 TString key,
bool defaultValue)
399 std::vector<double> defaultValue)
406 std::vector<double> values;
413 std::stringstream
sstr;
426 if (IgnoreEventsWithNegWeightsInTraining()) {
428 <<
"Will ignore negative events in training!"
432 if (fArchitectureString ==
"STANDARD") {
433 Log() << kERROR <<
"The STANDARD architecture has been deprecated. "
434 "Please use Architecture=CPU or Architecture=CPU."
435 "See the TMVA Users' Guide for instructions if you "
436 "encounter problems."
438 Log() << kFATAL <<
"The STANDARD architecture has been deprecated. "
439 "Please use Architecture=CPU or Architecture=CPU."
440 "See the TMVA Users' Guide for instructions if you "
441 "encounter problems."
445 if (fArchitectureString ==
"OPENCL") {
446 Log() << kERROR <<
"The OPENCL architecture has not been implemented yet. "
447 "Please use Architecture=CPU or Architecture=CPU for the "
448 "time being. See the TMVA Users' Guide for instructions "
449 "if you encounter problems."
451 Log() << kFATAL <<
"The OPENCL architecture has not been implemented yet. "
452 "Please use Architecture=CPU or Architecture=CPU for the "
453 "time being. See the TMVA Users' Guide for instructions "
454 "if you encounter problems."
458 if (fArchitectureString ==
"GPU") {
460 Log() << kERROR <<
"CUDA backend not enabled. Please make sure "
461 "you have CUDA installed and it was successfully "
464 Log() << kFATAL <<
"CUDA backend not enabled. Please make sure "
465 "you have CUDA installed and it was successfully "
471 if (fArchitectureString ==
"CPU") {
473 Log() << kERROR <<
"Multi-core CPU backend not enabled. Please make sure "
474 "you have a BLAS implementation and it was successfully "
475 "detected by CMake as well that the imt CMake flag is set."
477 Log() << kFATAL <<
"Multi-core CPU backend not enabled. Please make sure "
478 "you have a BLAS implementation and it was successfully "
479 "detected by CMake as well that the imt CMake flag is set."
489 size_t inputSize = GetNVariables ();
490 size_t outputSize = 1;
492 outputSize = GetNTargets();
494 outputSize = DataInfo().GetNClasses();
497 fNet.SetBatchSize(1);
498 fNet.SetInputWidth(inputSize);
500 auto itLayout = std::begin (fLayout);
503 fNet.AddLayer((*itLayout).first, (*itLayout).second);
505 fNet.AddLayer(outputSize, EActivationFunction::kIdentity);
511 fOutputFunction = EOutputFunction::kSigmoid;
514 if (fErrorStrategy ==
"SUMOFSQUARES") {
515 fNet.SetLossFunction(ELossFunction::kMeanSquaredError);
517 if (fErrorStrategy ==
"CROSSENTROPY") {
518 fNet.SetLossFunction(ELossFunction::kCrossEntropy);
520 fOutputFunction = EOutputFunction::kSigmoid;
522 if (fErrorStrategy !=
"SUMOFSQUARES") {
523 Log () << kWARNING <<
"For regression only SUMOFSQUARES is a valid "
524 <<
" neural net error function. Setting error function to "
525 <<
" SUMOFSQUARES now." <<
Endl;
527 fNet.SetLossFunction(ELossFunction::kMeanSquaredError);
528 fOutputFunction = EOutputFunction::kIdentity;
530 if (fErrorStrategy ==
"SUMOFSQUARES") {
531 fNet.SetLossFunction(ELossFunction::kMeanSquaredError);
533 if (fErrorStrategy ==
"CROSSENTROPY") {
534 fNet.SetLossFunction(ELossFunction::kCrossEntropy);
536 if (fErrorStrategy ==
"MUTUALEXCLUSIVE") {
537 fNet.SetLossFunction(ELossFunction::kSoftmaxCrossEntropy);
539 fOutputFunction = EOutputFunction::kSoftmax;
546 if (fWeightInitializationString ==
"XAVIER") {
549 else if (fWeightInitializationString ==
"XAVIERUNIFORM") {
561 GetNumValidationSamples();
567 std::cout <<
"Parsed Training DNN string " << fTrainingStrategyString << std::endl;
579 std::vector<Double_t>());
599 fTrainingSettings.push_back(
settings);
619 if (fValidationSize.EndsWith(
"%")) {
627 Log() << kFATAL <<
"Cannot parse number \"" << fValidationSize
628 <<
"\". Expected string like \"20%\" or \"20.0%\"." <<
Endl;
630 }
else if (fValidationSize.IsFloat()) {
641 Log() <<
kFATAL <<
"Cannot parse number \"" << fValidationSize <<
"\". Expected string like \"0.2\" or \"100\"."
648 Log() <<
kFATAL <<
"Validation size \"" << fValidationSize <<
"\" is negative." <<
Endl;
652 Log() <<
kFATAL <<
"Validation size \"" << fValidationSize <<
"\" is zero." <<
Endl;
656 Log() <<
kFATAL <<
"Validation size \"" << fValidationSize
657 <<
"\" is larger than or equal in size to training set (size=\"" <<
trainingSetSize <<
"\")." <<
Endl;
675 Log() << kFATAL <<
"Number of samples in the datasets are train: "
678 <<
"One of these is smaller than the batch size of "
679 <<
settings.batchSize <<
". Please increase the batch"
680 <<
" size to be at least the same size as the smallest"
681 <<
" of these values." <<
Endl;
685 if (fArchitectureString ==
"GPU") {
688 }
else if (fArchitectureString ==
"OpenCL") {
689 Log() << kFATAL <<
"OpenCL backend not yet supported." <<
Endl;
691 }
else if (fArchitectureString ==
"CPU") {
696 Log() << kINFO <<
"Using Standard Implementation.";
704 const std::vector<TMVA::Event *> &allData = GetEventCollection(
Types::kTraining);
709 const std::vector<Float_t>& values =
event->GetValues();
711 double outputValue =
event->GetClass () == 0 ? 0.9 : 0.1;
715 event->GetWeight()));
718 std::vector<Float_t>
oneHot(DataInfo().GetNClasses(), 0.0);
719 oneHot[
event->GetClass()] = 1.0;
722 event->GetWeight()));
725 const std::vector<Float_t>&
targets =
event->GetTargets ();
730 event->GetWeight ()));
736 const std::vector<Float_t>& values =
event->GetValues();
738 double outputValue =
event->GetClass () == 0 ? 0.9 : 0.1;
742 event->GetWeight()));
745 std::vector<Float_t>
oneHot(DataInfo().GetNClasses(), 0.0);
746 oneHot[
event->GetClass()] = 1.0;
749 event->GetWeight()));
752 const std::vector<Float_t>&
targets =
event->GetTargets ();
757 event->GetWeight ()));
763 std::vector<double> weights;
765 net.setInputSize(fNet.GetInputWidth() + 1);
766 net.setOutputSize(fNet.GetOutputWidth() + 1);
768 for (
size_t i = 0; i < fNet.GetDepth(); i++) {
772 case EActivationFunction::kIdentity:
g = EnumFunction::LINEAR;
break;
773 case EActivationFunction::kRelu:
g = EnumFunction::RELU;
break;
774 case EActivationFunction::kSigmoid:
g = EnumFunction::SIGMOID;
break;
775 case EActivationFunction::kTanh:
g = EnumFunction::TANH;
break;
776 case EActivationFunction::kFastTanh:
g = EnumFunction::TANH;
break;
777 case EActivationFunction::kSymmRelu:
g = EnumFunction::SYMMRELU;
break;
778 case EActivationFunction::kSoftSign:
g = EnumFunction::SOFTSIGN;
break;
779 case EActivationFunction::kGauss:
g = EnumFunction::GAUSS;
break;
781 if (i < fNet.GetDepth() - 1) {
782 net.addLayer(
Layer(fNet.GetLayer(i).GetWidth(),
g));
785 switch(fOutputFunction) {
786 case EOutputFunction::kIdentity:
h = ModeOutputValues::DIRECT;
break;
787 case EOutputFunction::kSigmoid:
h = ModeOutputValues::SIGMOID;
break;
788 case EOutputFunction::kSoftmax:
h = ModeOutputValues::SOFTMAX;
break;
790 net.addLayer(
Layer(fNet.GetLayer(i).GetWidth(),
g,
h));
794 switch(fNet.GetLossFunction()) {
795 case ELossFunction::kMeanSquaredError:
796 net.setErrorFunction(ModeErrorFunction::SUMOFSQUARES);
798 case ELossFunction::kCrossEntropy:
799 net.setErrorFunction(ModeErrorFunction::CROSSENTROPY);
801 case ELossFunction::kSoftmaxCrossEntropy:
802 net.setErrorFunction(ModeErrorFunction::CROSSENTROPY_MUTUALEXCLUSIVE);
806 switch(fWeightInitialization) {
807 case EInitialization::kGauss:
808 net.initializeWeights(WeightInitializationStrategy::XAVIER,
809 std::back_inserter(weights));
811 case EInitialization::kUniform:
812 net.initializeWeights(WeightInitializationStrategy::XAVIERUNIFORM,
813 std::back_inserter(weights));
816 net.initializeWeights(WeightInitializationStrategy::XAVIER,
817 std::back_inserter(weights));
822 for (
auto s : fTrainingSettings) {
825 switch(s.regularization) {
826 case ERegularization::kNone:
r = EnumRegularization::NONE;
break;
827 case ERegularization::kL1:
r = EnumRegularization::L1;
break;
828 case ERegularization::kL2:
r = EnumRegularization::L2;
break;
832 s.testInterval, s.weightDecay,
r,
833 MinimizerType::fSteepest, s.learningRate,
834 s.momentum, 1, s.multithreading);
838 <<
"Training with learning rate = " <<
ptrSettings->learningRate ()
840 <<
", repetitions = " <<
ptrSettings->repetitions ()
848 Log () << kINFO <<
"Drop configuration" <<
Endl
849 <<
" drop repetitions = " <<
ptrSettings->dropRepetitions()
855 Log () << kINFO <<
" Layer " << idx <<
" = " <<
f <<
Endl;
858 Log () << kINFO <<
Endl;
865 Log () << kINFO <<
Endl;
869 for (
size_t l = 0;
l < fNet.GetDepth();
l++) {
897 Log() << kINFO <<
"Start of neural network training on GPU." <<
Endl <<
Endl;
904 Log() << kDEBUG <<
"Using " <<
nTestSamples <<
" training samples." <<
Endl;
907 fNet.Initialize(fWeightInitialization);
922 net.InitializeGradients();
925 Log() << kINFO <<
"Training phase " <<
trainingPhase <<
" of "
926 << fTrainingSettings.size() <<
":" <<
Endl;
939 Log() << kFATAL <<
"Inconsistent training sample size" <<
Endl;
942 Log() << kFATAL <<
"Inconsistent test sample size" <<
Endl;
949 net.GetBatchSize(),
net.GetInputWidth(),
952 net.GetInputWidth(),
net.GetOutputWidth(),
958 std::vector<TNet<TCuda<>>>
nets{};
959 std::vector<TBatch<TCuda<>>>
batches{};
961 for (
size_t i = 0; i <
nThreads; i++) {
963 for (
size_t j = 0;
j <
net.GetDepth();
j++)
978 std::chrono::time_point<std::chrono::system_clock> start, end;
979 start = std::chrono::system_clock::now();
981 Log() << std::setw(10) <<
"Epoch" <<
" | "
982 << std::setw(12) <<
"Train Err."
983 << std::setw(12) <<
"Test Err."
984 << std::setw(12) <<
"GFLOP/s"
985 << std::setw(12) <<
"Conv. Steps" <<
Endl;
986 std::string separator(62,
'-');
987 Log() << separator <<
Endl;
1013 auto inputMatrix =
batch.GetInput();
1014 auto outputMatrix =
batch.GetOutput();
1022 end = std::chrono::system_clock::now();
1027 auto inputMatrix =
batch.GetInput();
1028 auto outputMatrix =
batch.GetOutput();
1042 start = std::chrono::system_clock::now();
1044 Log() << std::setw(10) <<
stepCount <<
" | "
1054 for (
size_t l = 0;
l <
net.GetDepth();
l++) {
1062 Log() << kFATAL <<
"CUDA backend not enabled. Please make sure "
1063 "you have CUDA installed and it was successfully "
1064 "detected by CMAKE." <<
Endl;
1074 Log() << kINFO <<
"Start of neural network training on CPU." <<
Endl <<
Endl;
1081 Log() << kDEBUG <<
"Using " <<
nTestSamples <<
" training samples." <<
Endl;
1083 fNet.Initialize(fWeightInitialization);
1089 << fTrainingSettings.size() <<
":" <<
Endl;
1102 net.InitializeGradients();
1108 const std::vector<Event *> &allData = GetEventCollection(
Types::kTraining);
1115 Log() << kFATAL <<
"Inconsistent training sample size" <<
Endl;
1118 Log() << kFATAL <<
"Inconsistent test sample size" <<
Endl;
1125 net.GetBatchSize(),
net.GetInputWidth(),
1128 net.GetInputWidth(),
net.GetOutputWidth(),
1134 std::vector<TNet<TCpu<>>>
nets{};
1135 std::vector<TBatch<TCpu<>>>
batches{};
1137 for (
size_t i = 0; i <
nThreads; i++) {
1139 for (
size_t j = 0;
j <
net.GetDepth();
j++)
1154 std::chrono::time_point<std::chrono::system_clock> start, end;
1155 start = std::chrono::system_clock::now();
1157 Log() << std::setw(10) <<
"Epoch" <<
" | "
1158 << std::setw(12) <<
"Train Err."
1159 << std::setw(12) <<
"Test Err."
1160 << std::setw(12) <<
"GFLOP/s"
1161 << std::setw(12) <<
"Conv. Steps" <<
Endl;
1162 std::string separator(62,
'-');
1163 Log() << separator <<
Endl;
1188 auto inputMatrix =
batch.GetInput();
1189 auto outputMatrix =
batch.GetOutput();
1190 auto weightMatrix =
batch.GetWeights();
1198 end = std::chrono::system_clock::now();
1203 auto inputMatrix =
batch.GetInput();
1204 auto outputMatrix =
batch.GetOutput();
1205 auto weightMatrix =
batch.GetWeights();
1220 start = std::chrono::system_clock::now();
1222 Log() << std::setw(10) <<
stepCount <<
" | "
1234 for (
size_t l = 0;
l <
net.GetDepth();
l++) {
1235 auto &
layer = fNet.GetLayer(
l);
1242 Log() << kFATAL <<
"Multi-core CPU backend not enabled. Please make sure "
1243 "you have a BLAS implementation and it was successfully "
1244 "detected by CMake as well that the imt CMake flag is set." <<
Endl;
1252 size_t nVariables = GetEvent()->GetNVariables();
1256 const std::vector<Float_t>&
inputValues = GetEvent()->GetValues();
1261 fNet.Prediction(
YHat,
X, fOutputFunction);
1269 size_t nVariables = GetEvent()->GetNVariables();
1278 size_t nTargets = std::max(1u,
ev->GetNTargets());
1280 std::vector<Float_t> output(
nTargets);
1281 auto net = fNet.CreateClone(1);
1282 net.Prediction(
YHat,
X, fOutputFunction);
1284 for (
size_t i = 0; i <
nTargets; i++)
1285 output[i] =
YHat(0, i);
1287 if (fRegressionReturnVal ==
NULL) {
1288 fRegressionReturnVal =
new std::vector<Float_t>();
1290 fRegressionReturnVal->clear();
1293 for (
size_t i = 0; i <
nTargets; ++i) {
1294 evT->SetTarget(i, output[i]);
1297 const Event*
evT2 = GetTransformationHandler().InverseTransform(
evT);
1298 for (
size_t i = 0; i <
nTargets; ++i) {
1299 fRegressionReturnVal->push_back(
evT2->GetTarget(i));
1302 return *fRegressionReturnVal;
1307 size_t nVariables = GetEvent()->GetNVariables();
1310 if (fMulticlassReturnVal ==
NULL) {
1311 fMulticlassReturnVal =
new std::vector<Float_t>(DataInfo().GetNClasses());
1314 const std::vector<Float_t>&
inputValues = GetEvent()->GetValues();
1319 fNet.Prediction(
YHat,
X, fOutputFunction);
1320 for (
size_t i = 0; i < (size_t)
YHat.GetNcols(); i++) {
1321 (*fMulticlassReturnVal)[i] =
YHat(0, i);
1323 return *fMulticlassReturnVal;
1331 Int_t inputWidth = fNet.GetInputWidth();
1333 char lossFunction =
static_cast<char>(fNet.GetLossFunction());
1335 gTools().StringFromInt(inputWidth));
1339 TString(
static_cast<char>(fOutputFunction)));
1342 const auto&
layer = fNet.GetLayer(i);
1344 int activationFunction =
static_cast<int>(
layer.GetActivationFunction());
1362 fNet.SetBatchSize(1);
1364 size_t inputWidth,
depth;
1372 fNet.SetInputWidth(inputWidth);
1378 for (
size_t i = 0; i <
depth; i++) {
1394 ReadMatrixXML(
layerXML,
"Weights", weights);
1396 fNet.GetLayer(i).GetWeights() = weights;
1397 fNet.GetLayer(i).GetBiases() =
biases;
1414 fRanking =
new Ranking( GetName(),
"Importance" );
1416 fRanking->AddRank(
Rank( GetInputLabel(
ivar), 1.0));
1440 Log() << col <<
"--- Short description:" <<
colres <<
Endl;
1442 Log() <<
"The DNN neural network is a feedforward" <<
Endl;
1443 Log() <<
"multilayer perceptron implementation. The DNN has a user-" <<
Endl;
1444 Log() <<
"defined hidden layer architecture, where the number of input (output)" <<
Endl;
1445 Log() <<
"nodes is determined by the input variables (output classes, i.e., " <<
Endl;
1446 Log() <<
"signal and one background, regression or multiclass). " <<
Endl;
1448 Log() << col <<
"--- Performance optimisation:" <<
colres <<
Endl;
1451 const char*
txt =
"The DNN supports various options to improve performance in terms of training speed and \n \
1452reduction of overfitting: \n \
1454 - different training settings can be stacked. Such that the initial training \n\
1455 is done with a large learning rate and a large drop out fraction whilst \n \
1456 in a later stage learning rate and drop out can be reduced. \n \
1459 initial training stage: 0.0 for the first layer, 0.5 for later layers. \n \
1460 later training stage: 0.1 or 0.0 for all layers \n \
1461 final training stage: 0.0] \n \
1462 Drop out is a technique where a at each training cycle a fraction of arbitrary \n \
1463 nodes is disabled. This reduces co-adaptation of weights and thus reduces overfitting. \n \
1464 - L1 and L2 regularization are available \n \
1466 [recommended 10 - 150] \n \
1467 Arbitrary mini-batch sizes can be chosen. \n \
1468 - Multithreading \n \
1469 [recommended: True] \n \
1470 Multithreading can be turned on. The minibatches are distributed to the available \n \
1471 cores. The algorithm is lock-free (\"Hogwild!\"-style) for each cycle. \n \
1475 - example: \"TANH|(N+30)*2,TANH|(N+30),LINEAR\" \n \
1477 . two hidden layers (separated by \",\") \n \
1478 . the activation function is TANH (other options: RELU, SOFTSIGN, LINEAR) \n \
1479 . the activation function for the output layer is LINEAR \n \
1480 . the first hidden layer has (N+30)*2 nodes where N is the number of input neurons \n \
1481 . the second hidden layer has N+30 nodes, where N is the number of input neurons \n \
1482 . the number of nodes in the output layer is determined by the number of output nodes \n \
1483 and can therefore not be chosen freely. \n \
1485 \"ErrorStrategy\": \n \
1487 The error of the neural net is determined by a sum-of-squares error function \n \
1488 For regression, this is the only possible choice. \n \
1490 The error of the neural net is determined by a cross entropy function. The \n \
1491 output values are automatically (internally) transformed into probabilities \n \
1492 using a sigmoid function. \n \
1493 For signal/background classification this is the default choice. \n \
1494 For multiclass using cross entropy more than one or no output classes \n \
1495 can be equally true or false (e.g. Event 0: A and B are true, Event 1: \n \
1496 A and C is true, Event 2: C is true, ...) \n \
1497 - MUTUALEXCLUSIVE \n \
1498 In multiclass settings, exactly one of the output classes can be true (e.g. either A or B or C) \n \
1500 \"WeightInitialization\" \n \
1503 \"Xavier Glorot & Yoshua Bengio\"-style of initializing the weights. The weights are chosen randomly \n \
1504 such that the variance of the values of the nodes is preserved for each layer. \n \
1505 - XAVIERUNIFORM \n \
1506 The same as XAVIER, but with uniformly distributed weights instead of gaussian weights \n \
1508 Random values scaled by the layer size \n \
1510 \"TrainingStrategy\" \n \
1511 - example: \"LearningRate=1e-1,Momentum=0.3,ConvergenceSteps=50,BatchSize=30,TestRepetitions=7,WeightDecay=0.0,Renormalize=L2,DropConfig=0.0,DropRepetitions=5|LearningRate=1e-4,Momentum=0.3,ConvergenceSteps=50,BatchSize=20,TestRepetitions=7,WeightDecay=0.001,Renormalize=L2,DropFraction=0.0,DropRepetitions=5\" \n \
1512 - explanation: two stacked training settings separated by \"|\" \n \
1513 . first training setting: \"LearningRate=1e-1,Momentum=0.3,ConvergenceSteps=50,BatchSize=30,TestRepetitions=7,WeightDecay=0.0,Renormalize=L2,DropConfig=0.0,DropRepetitions=5\" \n \
1514 . second training setting : \"LearningRate=1e-4,Momentum=0.3,ConvergenceSteps=50,BatchSize=20,TestRepetitions=7,WeightDecay=0.001,Renormalize=L2,DropFractions=0.0,DropRepetitions=5\" \n \
1515 . LearningRate : \n \
1516 - recommended for classification: 0.1 initially, 1e-4 later \n \
1517 - recommended for regression: 1e-4 and less \n \
1519 preserve a fraction of the momentum for the next training batch [fraction = 0.0 - 1.0] \n \
1520 . Repetitions : \n \
1521 train \"Repetitions\" repetitions with the same minibatch before switching to the next one \n \
1522 . ConvergenceSteps : \n \
1523 Assume that convergence is reached after \"ConvergenceSteps\" cycles where no improvement \n \
1524 of the error on the test samples has been found. (Mind that only at each \"TestRepetitions\" \n \
1525 cycle the test samples are evaluated and thus the convergence is checked) \n \
1527 Size of the mini-batches. \n \
1528 . TestRepetitions \n \
1529 Perform testing the neural net on the test samples each \"TestRepetitions\" cycle \n \
1531 If \"Renormalize\" is set to L1 or L2, \"WeightDecay\" provides the renormalization factor \n \
1533 NONE, L1 (|w|) or L2 (w^2) \n \
1535 Drop a fraction of arbitrary nodes of each of the layers according to the values given \n \
1536 in the DropConfig. \n \
1537 [example: DropConfig=0.0+0.5+0.3 \n \
1538 meaning: drop no nodes in layer 0 (input layer), half of the nodes in layer 1 and 30% of the nodes \n \
1540 recommended: leave all the nodes turned on for the input layer (layer 0) \n \
1541 turn off half of the nodes in later layers for the initial training; leave all nodes \n \
1542 turned on (0.0) in later training stages] \n \
1543 . DropRepetitions \n \
1544 Each \"DropRepetitions\" cycle the configuration of which nodes are dropped is changed \n \
1545 [recommended : 1] \n \
1546 . Multithreading \n \
1547 turn on multithreading [recommended: True] \n \
#define REGISTER_METHOD(CLASS)
for example
bool Bool_t
Boolean (0=false, 1=true) (bool)
int Int_t
Signed integer 4 bytes (int)
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
double Double_t
Double 8 bytes.
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
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 r
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
const_iterator begin() const
const_iterator end() const
Bool_t WriteOptionsReference() const
Layer defines the layout of a layer.
Settings for the training of the neural net.
Steepest Gradient Descent algorithm (SGD)
static void Copy(Matrix_t &B, const Matrix_t &A)
static void Copy(Matrix_t &B, const Matrix_t &A)
bool HasConverged()
Increases the minimization step counter by the test error evaluation period and uses the current inte...
void Step(Net_t &net, Matrix_t &input, const Matrix_t &output, const Matrix_t &weights)
Perform a single optimization step on a given batch.
size_t GetTestInterval() const
void StepMomentum(Net_t &master, std::vector< Net_t > &nets, std::vector< TBatch< Architecture_t > > &batches, Scalar_t momentum)
Same as the Step(...) method for multiple batches but uses momentum.
size_t GetConvergenceCount() const
void AddWeightsXMLTo(void *parent) const override
void ProcessOptions() override
UInt_t GetNumValidationSamples()
typename Architecture_t::Matrix_t Matrix_t
Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets) override
void MakeClassSpecific(std::ostream &, const TString &) const override
LayoutVector_t ParseLayoutString(TString layerSpec)
MethodDNN(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption)
const Ranking * CreateRanking() override
const std::vector< Float_t > & GetMulticlassValues() override
std::vector< std::map< TString, TString > > KeyValueVector_t
void DeclareOptions() override
DNN::EInitialization fWeightInitialization
void GetHelpMessage() const override
const std::vector< Float_t > & GetRegressionValues() override
void ReadWeightsFromStream(std::istream &i) override
KeyValueVector_t ParseKeyValueString(TString parseString, TString blockDelim, TString tokenDelim)
DNN::EOutputFunction fOutputFunction
Double_t GetMvaValue(Double_t *err=nullptr, Double_t *errUpper=nullptr) override
void ReadWeightsFromXML(void *wghtnode) override
Ranking for variables in method (implementation)
Collectable string class.
const TString & GetString() const
Int_t Atoi() const
Return integer value of string.
void ToUpper()
Change string to upper case.
static TString Itoa(Int_t value, Int_t base)
Converts an Int_t to a TString with respect to the base specified (2-36).
XMLNodePointer_t NewChild(XMLNodePointer_t parent, XMLNsPointer_t ns, const char *name, const char *content=nullptr)
create new child element for parent node
XMLNodePointer_t GetChild(XMLNodePointer_t xmlnode, Bool_t realnode=kTRUE)
returns first child of xmlnode
XMLAttrPointer_t NewAttr(XMLNodePointer_t xmlnode, XMLNsPointer_t, const char *name, const char *value)
creates new attribute for xmlnode, namespaces are not supported for attributes
EOutputFunction
Enum that represents output functions.
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.
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 fetchValue(const std::map< TString, TString > &keyValueMap, TString key)
MsgLogger & Endl(MsgLogger &ml)
Double_t Log(Double_t x)
Returns the natural logarithm of x.