24 #ifndef TMVA_NEURAL_NET    25 #define TMVA_NEURAL_NET    41 #include <type_traits>    59   class IPythonInteractive;
    94               inline void add(
T value, 
double weight = 1.0)
   109               double R = Q*weight/tmpWeight;
   116           template <
typename ITERATOR>
   117               inline void add (ITERATOR itBegin, ITERATOR itEnd)
   119               for (ITERATOR it = itBegin; it != itEnd; ++it)
   212       template <
typename T>
   215             return (
int)(value & flag) != 0;
   240          Batch (
typename std::vector<Pattern>::const_iterator itBegin, 
typename std::vector<Pattern>::const_iterator itEnd)
   241             : m_itBegin (itBegin)
   245          const_iterator 
begin ()
 const { 
return m_itBegin; }
   246          const_iterator 
end   ()
 const { 
return m_itEnd; }
   248          size_t size ()
 const { 
return std::distance (begin (), end ()); }
   260       template <
typename ItSource, 
typename ItWeight, 
typename ItTarget>
   261          void applyWeights (ItSource itSourceBegin, ItSource itSourceEnd, ItWeight itWeight, ItTarget itTargetBegin, ItTarget itTargetEnd);
   265       template <
typename ItSource, 
typename ItWeight, 
typename ItPrev>
   266          void applyWeightsBackwards (ItSource itCurrBegin, ItSource itCurrEnd, ItWeight itWeight, ItPrev itPrevBegin, ItPrev itPrevEnd);
   272       template <
typename ItValue, 
typename ItFunction>
   273          void applyFunctions (ItValue itValue, ItValue itValueEnd, ItFunction itFunction);
   276       template <
typename ItValue, 
typename ItFunction, 
typename ItInverseFunction, 
typename ItGradient>
   277          void applyFunctions (ItValue itValue, ItValue itValueEnd, ItFunction itFunction, ItInverseFunction itInverseFunction, ItGradient itGradient);
   281       template <
typename ItSource, 
typename ItDelta, 
typename ItTargetGradient, 
typename ItGradient>
   282          void update (ItSource itSource, ItSource itSourceEnd, 
   283                       ItDelta itTargetDeltaBegin, ItDelta itTargetDeltaEnd, 
   284                       ItTargetGradient itTargetGradientBegin, 
   285                       ItGradient itGradient);
   289       template <EnumRegularization Regularization, 
typename ItSource, 
typename ItDelta, 
typename ItTargetGradient, 
typename ItGradient, 
typename ItWeight>
   290          void update (ItSource itSource, ItSource itSourceEnd, 
   291                       ItDelta itTargetDeltaBegin, ItDelta itTargetDeltaEnd, 
   292                       ItTargetGradient itTargetGradientBegin, 
   293                       ItGradient itGradient, 
   350                    double momentum = 0.5, 
   351                    size_t repetitions = 10) 
   352             : m_repetitions (repetitions)
   353             , m_alpha (learningRate)
   368          template <
typename Function, 
typename Weights, 
typename PassThrough>
   397       template <
typename ItOutput, 
typename ItTruth, 
typename ItDelta, 
typename ItInvActFnc>
   398          double sumOfSquares (ItOutput itOutputBegin, ItOutput itOutputEnd, ItTruth itTruthBegin, ItTruth itTruthEnd, ItDelta itDelta, ItDelta itDeltaEnd, ItInvActFnc itInvActFnc, 
double patternWeight);
   402       template <
typename ItProbability, 
typename ItTruth, 
typename ItDelta, 
typename ItInvActFnc>
   403          double crossEntropy (ItProbability itProbabilityBegin, ItProbability itProbabilityEnd, ItTruth itTruthBegin, ItTruth itTruthEnd, ItDelta itDelta, ItDelta itDeltaEnd, ItInvActFnc itInvActFnc, 
double patternWeight);
   408       template <
typename ItOutput, 
typename ItTruth, 
typename ItDelta, 
typename ItInvActFnc>
   409          double softMaxCrossEntropy (ItOutput itProbabilityBegin, ItOutput itProbabilityEnd, ItTruth itTruthBegin, ItTruth itTruthEnd, ItDelta itDelta, ItDelta itDeltaEnd, ItInvActFnc itInvActFnc, 
double patternWeight);
   415       template <
typename ItWeight>
   492                     const_iterator_type itWeightBegin, 
   493                     iterator_type itGradientBegin, 
   494                     std::shared_ptr<
std::function<
double(
double)>> activationFunction, 
   495                     std::shared_ptr<
std::function<
double(
double)>> inverseActivationFunction,
   511          LayerData (
size_t size, const_iterator_type itWeightBegin, 
   512                     std::shared_ptr<
std::function<
double(
double)>> activationFunction, 
   520             : m_size (other.m_size)
   521             , m_itInputBegin (other.m_itInputBegin)
   522             , m_itInputEnd (other.m_itInputEnd)
   523             , m_deltas (other.m_deltas)
   524             , m_valueGradients (other.m_valueGradients)
   525             , m_values (other.m_values)
   526         , m_itDropOut (other.m_itDropOut)
   527         , m_hasDropOut (other.m_hasDropOut)
   528             , m_itConstWeightBegin   (other.m_itConstWeightBegin)
   529             , m_itGradientBegin (other.m_itGradientBegin)
   530             , m_activationFunction (other.m_activationFunction)
   531             , m_inverseActivationFunction (other.m_inverseActivationFunction)
   532             , m_isInputLayer (other.m_isInputLayer)
   533             , m_hasWeights (other.m_hasWeights)
   534             , m_hasGradients (other.m_hasGradients)
   535             , m_eModeOutput (other.m_eModeOutput) 
   543             : m_size (other.m_size)
   544             , m_itInputBegin (other.m_itInputBegin)
   545             , m_itInputEnd (other.m_itInputEnd)
   546         , m_deltas (
std::move(other.m_deltas))
   547         , m_valueGradients (
std::move(other.m_valueGradients))
   548         , m_values (
std::move(other.m_values))
   549         , m_itDropOut (other.m_itDropOut)
   550         , m_hasDropOut (other.m_hasDropOut)
   551             , m_itConstWeightBegin   (other.m_itConstWeightBegin)
   552             , m_itGradientBegin (other.m_itGradientBegin)
   553         , m_activationFunction (
std::move(other.m_activationFunction))
   554         , m_inverseActivationFunction (
std::move(other.m_inverseActivationFunction))
   555             , m_isInputLayer (other.m_isInputLayer)
   556             , m_hasWeights (other.m_hasWeights)
   557             , m_hasGradients (other.m_hasGradients)
   558             , m_eModeOutput (other.m_eModeOutput) 
   569          void setInput (const_iterator_type itInputBegin, const_iterator_type itInputEnd)
   571             m_isInputLayer = 
true;
   572             m_itInputBegin = itInputBegin;
   573             m_itInputEnd = itInputEnd;
   582             m_values.assign (m_values.size (), 0.0);
   583             m_deltas.assign (m_deltas.size (), 0.0);
   586          const_iterator_type 
valuesBegin ()
 const { 
return m_isInputLayer ? m_itInputBegin : begin (m_values); } 
   587          const_iterator_type 
valuesEnd   ()
 const { 
return m_isInputLayer ? m_itInputEnd   : end (m_values); } 
   589          iterator_type 
valuesBegin () { assert (!m_isInputLayer); 
return begin (m_values); }  
   590          iterator_type 
valuesEnd   () { assert (!m_isInputLayer); 
return end (m_values); } 
   598          const_iterator_type 
deltasBegin ()
 const { 
return begin (m_deltas); } 
   599          const_iterator_type 
deltasEnd   ()
 const { 
return end   (m_deltas); } 
   607          iterator_type 
gradientsBegin () { assert (m_hasGradients); 
return m_itGradientBegin; } 
   608          const_iterator_type 
gradientsBegin ()
 const { assert (m_hasGradients); 
return m_itGradientBegin; } 
   609          const_iterator_type 
weightsBegin   ()
 const { assert (m_hasWeights); 
return m_itConstWeightBegin; } 
   611          std::shared_ptr<std::function<double(double)>> 
activationFunction ()
 const { 
return m_activationFunction; }
   617          template <
typename Iterator>
   618             void setDropOut (Iterator itDrop) { m_itDropOut = itDrop; m_hasDropOut = 
true; }
   627     const_dropout_iterator 
dropOut ()
 const { assert (m_hasDropOut); 
return m_itDropOut; } 
   629          size_t size ()
 const { 
return m_size; } 
   637     container_type computeProbabilities () 
const;
   693          size_t numWeights (
size_t numInputNodes)
 const { 
return numInputNodes * numNodes (); } 
   695          std::shared_ptr<std::function<double(double)>> 
activationFunction  ()
 const { 
return m_activationFunction; } 
   719       template <
typename LAYERDATA>
   720          void forward (
const LAYERDATA& prevLayerData, LAYERDATA& currLayerData);
   723       template <
typename LAYERDATA>
   724          void backward (LAYERDATA& prevLayerData, LAYERDATA& currLayerData);
   727       template <
typename LAYERDATA>
   745                    size_t _convergenceSteps = 15, 
size_t _batchSize = 10, 
size_t _testRepetitions = 7, 
   748                    double _learningRate = 1
e-5, 
double _momentum = 0.3, 
   749                    int _repetitions = 3,
   750                    bool _multithreading = 
true);
   765          template <
typename Iterator>
   766             void setDropOut (Iterator begin, Iterator end, 
size_t _dropRepetitions) { m_dropOut.assign (begin, end); m_dropRepetitions = _dropRepetitions; }
   771          void setMonitoring (std::shared_ptr<Monitoring> ptrMonitoring) { fMonitoring = ptrMonitoring; } 
   788          virtual void testSample (
double , 
double , 
double , 
double ) {} 
   791             m_convergenceCount = 0;
   792             m_maxConvergenceCount= 0;
   799             m_minProgress = minProgress;
   800             m_maxProgress = maxProgress; 
   804             m_timer.DrawProgressBar (
Int_t(m_minProgress));
   808             m_timer.DrawProgressBar (
Int_t(m_minProgress+(m_maxProgress-m_minProgress)*(progress/100.0)), text);
   814          virtual void drawSample (
const std::vector<double>& , 
const std::vector<double>& , 
const std::vector<double>& , 
double ) {} 
   818          virtual bool hasConverged (
double testError); 
   825          void pads (
int numPads) { 
if (fMonitoring) fMonitoring->pads (numPads); } 
   826          void create (std::string histoName, 
int bins, 
double min, 
double max) { 
if (fMonitoring) fMonitoring->create (histoName, bins, min, max); } 
   827          void create (std::string histoName, 
int bins, 
double min, 
double max, 
int bins2, 
double min2, 
double max2) { 
if (fMonitoring) fMonitoring->create (histoName, bins, min, max, bins2, min2, max2); } 
   828          void addPoint (std::string histoName, 
double x) { 
if (fMonitoring) fMonitoring->addPoint (histoName, x); } 
   829          void addPoint (std::string histoName, 
double x, 
double y) {
if (fMonitoring) fMonitoring->addPoint (histoName, x, y); } 
   830          void plot (std::string histoName, std::string options, 
int pad, 
EColor color) { 
if (fMonitoring) fMonitoring->plot (histoName, options, pad, color); } 
   831          void clear (std::string histoName) { 
if (fMonitoring) fMonitoring->clear (histoName); } 
   832          bool exists (std::string histoName) { 
if (fMonitoring) 
return fMonitoring->exists (histoName); 
return false; } 
   909                                  size_t _convergenceSteps = 15, 
size_t _batchSize = 10, 
size_t _testRepetitions = 7, 
   912                                  double _learningRate = 1
e-5, 
double _momentum = 0.3, 
int _repetitions = 3,
   913                                  bool _useMultithreading = 
true)
   914             : 
Settings (name, _convergenceSteps, _batchSize, _testRepetitions, _factorWeightDecay, 
   915                         _regularization, _eMinimizerType, _learningRate, _momentum, _repetitions, _useMultithreading)
   917             , m_sumOfSigWeights (0)
   918             , m_sumOfBkgWeights (0)
   919             , m_scaleToNumEvents (_scaleToNumEvents)
   921             , m_pResultPatternContainer (NULL)
   922             , m_fileNameResult ()
   923             , m_fileNameNetConfig ()
   935          void startTrainCycle ();
   936          void endTrainCycle (
double );
   993          void testSample (
double error, 
double output, 
double target, 
double weight);
   995          virtual void startTestCycle ();
   996          virtual void endTestCycle ();
   999          void setWeightSums (
double sumOfSigWeights, 
double sumOfBkgWeights);
  1000          void setResultComputation (std::string _fileNameNetConfig, std::string _fileNameResult, std::vector<Pattern>* _resultPatternContainer);
  1093             : m_eErrorFunction (other.m_eErrorFunction)
  1094             , m_sizeInput (other.m_sizeInput)
  1095             , m_layers (other.m_layers)
  1112          template <
typename WeightsType, 
typename DropProbabilities>
  1113             void dropOutWeightFactor (WeightsType& 
weights,
  1114                                       const DropProbabilities& drops, 
  1115                                       bool inverse = 
false);
  1125          template <
typename Minimizer>
  1126             double train (std::vector<double>& weights, 
  1127                           std::vector<Pattern>& trainPattern, 
  1128                           const std::vector<Pattern>& testPattern, 
  1136          template <
typename Minimizer>
  1137             void preTrain (std::vector<double>& weights,
  1138                            std::vector<Pattern>& trainPattern,
  1139                            const std::vector<Pattern>& testPattern,
  1152          template <
typename Iterator, 
typename Minimizer>
  1153             inline double trainCycle (
Minimizer& minimizer, std::vector<double>& weights, 
  1154                Iterator itPatternBegin, Iterator itPatternEnd,
  1156                               DropContainer& dropContainer);
  1158          size_t numWeights (
size_t trainingStartLayer = 0) 
const; 
  1159     size_t numNodes   (
size_t trainingStartLayer = 0) 
const; 
  1161          template <
typename Weights>
  1162             std::vector<double> compute (
const std::vector<double>& input, 
const Weights& weights) 
const; 
  1164          template <
typename Weights, 
typename PassThrough>
  1165             double operator() (PassThrough& settingsAndBatch, 
const Weights& weights) 
const; 
  1167          template <
typename Weights, 
typename PassThrough, 
typename OutContainer>
  1168             double operator() (PassThrough& settingsAndBatch, 
const Weights& weights, 
ModeOutput eFetch, OutContainer& outputContainer) 
const; 
  1170          template <
typename Weights, 
typename Gradients, 
typename PassThrough>
  1171         double operator() (PassThrough& settingsAndBatch, Weights& weights, Gradients& gradients) 
const;  
  1173          template <
typename Weights, 
typename Gradients, 
typename PassThrough, 
typename OutContainer>
  1174         double operator() (PassThrough& settingsAndBatch, Weights& weights, Gradients& gradients, 
ModeOutput eFetch, OutContainer& outputContainer) 
const;
  1177     template <
typename LayerContainer, 
typename DropContainer, 
typename ItWeight, 
typename ItGradient>
  1178         std::vector<std::vector<LayerData>> prepareLayerData (LayerContainer& layers,
  1180                                                               const DropContainer& dropContainer,
  1181                                                               ItWeight itWeightBegin,
  1182                                                               ItWeight itWeightEnd, 
  1183                                                               ItGradient itGradientBegin,
  1184                                                               ItGradient itGradientEnd,
  1185                                                               size_t& totalNumWeights) 
const;
  1187     template <
typename LayerContainer>
  1188         void forwardPattern (
const LayerContainer& _layers,
  1189                              std::vector<LayerData>& layerData) 
const;
  1192     template <
typename LayerContainer, 
typename LayerPatternContainer>
  1193         void forwardBatch (
const LayerContainer& _layers,
  1194                            LayerPatternContainer& layerPatternData,
  1195                            std::vector<double>& valuesMean,
  1196                            std::vector<double>& valuesStdDev,
  1197                            size_t trainFromLayer) 
const;
  1199     template <
typename OutputContainer>
  1200         void fetchOutput (
const LayerData& lastLayerData, OutputContainer& outputContainer) 
const;
  1202     template <
typename OutputContainer>
  1203         void fetchOutput (
const std::vector<LayerData>& layerPatternData, OutputContainer& outputContainer) 
const;
  1206     template <
typename ItWeight>
  1207         std::tuple<double,
double> computeError (
const Settings& settings,
  1208                                                                           std::vector<LayerData>& lastLayerData,
  1210                                                                           ItWeight itWeightBegin,
  1211                                                                           ItWeight itWeightEnd) 
const;
  1213     template <
typename Settings>
  1214         void backPropagate (std::vector<std::vector<LayerData>>& layerPatternData,
  1216                             size_t trainFromLayer,
  1217                             size_t totalNumWeights) 
const;
  1225          template <
typename LayerContainer, 
typename PassThrough, 
typename ItWeight, 
typename ItGradient, 
typename OutContainer>
  1226             double forward_backward (LayerContainer& layers, PassThrough& settingsAndBatch, 
  1227               ItWeight itWeightBegin, ItWeight itWeightEnd, 
  1228                                      ItGradient itGradientBegin, ItGradient itGradientEnd, 
  1229                                      size_t trainFromLayer, 
  1230                                      OutContainer& outputContainer, 
bool fetchOutput) 
const;
  1242          template <
typename Container, 
typename ItWeight>
  1243             double errorFunction (
LayerData& layerData,
  1246                                   ItWeight itWeightEnd,
  1247                                   double patternWeight,
  1248                                   double factorWeightDecay,
  1252          const std::vector<Layer>& 
layers ()
 const { 
return m_layers; } 
  1253          std::vector<Layer>& 
layers ()  { 
return m_layers; } 
  1265          template <
typename OutIterator>
  1267                                     OutIterator itWeight); 
  1271          void fillDropContainer (DropContainer& dropContainer, 
double dropFraction, 
size_t numNodes) 
const; 
  1284          bool * fExitFromTraining = 
nullptr;
  1285          UInt_t *fIPyMaxIter = 
nullptr, *fIPyCurrentIter = 
nullptr;
  1292           fExitFromTraining = fE;
  1294           fIPyCurrentIter = 
C;
 void addPoint(std::string histoName, double x)
for monitoring 
void testIteration()
callback for monitoring and loggging 
std::shared_ptr< std::function< double(double)> > inverseActivationFunction() const
virtual void startTraining()
ModeErrorFunction m_eErrorFunction
denotes the error function 
const_iterator_type weightsBegin() const
returns const iterator to the begin of the weights for this layer 
void setInput(const_iterator_type itInputBegin, const_iterator_type itInputEnd)
change the input iterators 
void addLayer(Layer &&layer)
size_t convergenceCount() const
returns the current convergence count 
virtual ~ClassificationSettings()
d'tor 
virtual void cycle(double progress, TString text)
MinimizerType
< list all the minimizer types 
void add(ITERATOR itBegin, ITERATOR itEnd)
size_t m_sizeInput
input size of this DNN 
std::vector< Layer > & layers()
returns the layers (structure) 
void create(std::string histoName, int bins, double min, double max, int bins2, double min2, double max2)
for monitoring 
std::vector< char > DropContainer
void setDropOut(Iterator begin, Iterator end, size_t _dropRepetitions)
set the drop-out configuration (layer-wise) 
std::string m_fileNameNetConfig
std::shared_ptr< std::function< double(double)> > m_inverseActivationFunction
stores the inverse activation function 
iterator_type deltasBegin()
returns iterator to the begin of the deltas (back-propagation) 
bool isFlagSet(T flag, T value)
double m_maxProgress
current limits for the progress bar 
Steepest Gradient Descent algorithm (SGD) 
ModeOutputValues modeOutputValues() const
get the mode-output-value (direct, probabilities) 
size_t convergenceSteps() const
how many steps until training is deemed to have converged 
std::pair< iterator_type, iterator_type > begin_end_type
std::vector< std::function< double(double)> > function_container_type
void add(T value, double weight=1.0)
const std::vector< double > & dropFractions() const
void applyFunctions(ItValue itValue, ItValue itValueEnd, ItFunction itFunction)
void backward(LAYERDATA &prevLayerData, LAYERDATA &currLayerData)
backward application of the weights (back-propagation of the error) 
size_t inputSize() const
input size of the DNN 
void setErrorFunction(ModeErrorFunction eErrorFunction)
which error function is to be used 
iterator_type valueGradientsEnd()
returns iterator to the end of the gradients of the node values 
std::shared_ptr< Monitoring > fMonitoring
EnumRegularization regularization() const
some regularization of the DNN is turned on? 
bool useMultithreading() const
is multithreading turned on? 
function_container_type::iterator function_iterator_type
ModeOutputValues operator|(ModeOutputValues lhs, ModeOutputValues rhs)
void plot(std::string histoName, std::string options, int pad, EColor color)
for monitoring 
const_iterator_type gradientsBegin() const
returns const iterator to the begin of the gradients 
iterator_type m_itGradientBegin
iterator to the first gradient of this layer in the gradient vector 
bool m_hasGradients
does this layer have gradients (only if in training mode) 
void update(ItSource itSource, ItSource itSourceEnd, ItDelta itTargetDeltaBegin, ItDelta itTargetDeltaEnd, ItTargetGradient itTargetGradientBegin, ItGradient itGradient)
update the gradients 
ModeOutputValues operator &(ModeOutputValues lhs, ModeOutputValues rhs)
ModeOutputValues m_eModeOutput
stores the output mode (DIRECT, SIGMOID, SOFTMAX) 
size_t numWeights(size_t numInputNodes) const
return the number of weights for this layer (fully connected) 
void setOutputSize(size_t sizeOutput)
set the output size of the DNN 
virtual void testIteration()
callback for monitoring and loggging 
bool m_isInputLayer
is this layer an input layer 
double momentum() const
get the momentum (e.g. for SGD) 
TRObject operator()(const T1 &t1) const
EnumFunction m_activationFunctionType
void applyWeights(ItSource itSourceBegin, ItSource itSourceEnd, ItWeight itWeight, ItTarget itTargetBegin, ItTarget itTargetEnd)
iterator_type valuesEnd()
returns iterator to the end of the (node) values 
std::shared_ptr< std::function< double(double)> > activationFunction() const
fetch the activation function for this layer 
double learningRate() const
get the learning rate 
size_t m_sizeOutput
outut size of this DNN 
std::vector< double > m_valueGradients
stores the gradients of the values (nodes) 
std::vector< double > m_significances
virtual void startTestCycle()
callback for monitoring and loggging 
size_t m_convergenceSteps
number of steps without improvement to consider the DNN to have converged 
container_type::const_iterator const_iterator_type
MinimizerType fMinimizerType
double weightDecay(double error, ItWeight itWeight, ItWeight itWeightEnd, double factorWeightDecay, EnumRegularization eRegularization)
compute the weight decay for regularization (L1 or L2) 
std::vector< double > m_dropOut
const_iterator_type valueGradientsBegin() const
returns const iterator to the begin of the gradients 
std::vector< Layer > m_layers
layer-structure-data 
ModeOutputValues outputMode() const
returns the output mode 
void SetIpythonInteractive(IPythonInteractive *fI, bool *fE, UInt_t *M, UInt_t *C)
std::shared_ptr< std::function< double(double)> > activationFunction() const
size_t m_batchSize
mini-batch size 
const_iterator_type m_itConstWeightBegin
const iterator to the first weight of this layer in the weight vector 
function_container_type::const_iterator const_function_iterator_type
ModeOutputValues m_eModeOutputValues
do the output values of this layer have to be transformed somehow (e.g. to probabilities) or returned...
void removeLayer()
remove one layer 
bool hasDropOut() const
has this layer drop-out turned on? 
void setInputSize(size_t sizeInput)
set the input size of the DNN 
const_iterator_type m_itInputBegin
iterator to the first of the nodes in the input node vector 
bool m_hasDropOut
dropOut is turned on? 
ClassificationSettings(TString name, size_t _convergenceSteps=15, size_t _batchSize=10, size_t _testRepetitions=7, double _factorWeightDecay=1e-5, EnumRegularization _regularization=EnumRegularization::NONE, size_t _scaleToNumEvents=0, MinimizerType _eMinimizerType=MinimizerType::fSteepest, double _learningRate=1e-5, double _momentum=0.3, int _repetitions=3, bool _useMultithreading=true)
c'tor 
const_iterator_type valueGradientsEnd() const
returns const iterator to the end of the gradients 
const_iterator end() const
std::vector< double > m_prevGradients
vector remembers the gradients of the previous step 
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
double stdDev_corr() const
void create(std::string histoName, int bins, double min, double max)
for monitoring 
EnumFunction activationFunctionType() const
get the activation function type for this layer 
std::vector< double > m_output
size_t testRepetitions() const
how often is the test data tested 
iterator_type valuesBegin()
returns iterator to the begin of the (node) values 
void setMonitoring(std::shared_ptr< Monitoring > ptrMonitoring)
prepared for monitoring 
std::vector< Pattern > * m_pResultPatternContainer
std::vector< double > m_deltas
stores the deltas for the DNN training 
double m_minProgress
current limits for the progress bar 
iterator_type gradientsBegin()
returns iterator to the begin of the gradients 
size_t dropRepetitions() const
container_type probabilities() const
computes the probabilities from the current node values and returns them 
Double_t(* Function)(Double_t)
container_type::iterator iterator_type
const std::vector< Layer > & layers() const
returns the layers (structure) 
std::vector< Pattern >::const_iterator const_iterator
virtual void endTrainCycle(double)
callback for monitoring and logging 
double factorWeightDecay() const
get the weight-decay factor 
RooCmdArg Minimizer(const char *type, const char *alg=0)
ModeOutputValues operator &=(ModeOutputValues &lhs, ModeOutputValues rhs)
LayerData(LayerData &&other)
move c'tor of LayerData 
size_t m_convergenceCount
std::vector< double > container_type
double softMaxCrossEntropy(ItOutput itProbabilityBegin, ItOutput itProbabilityEnd, ItTruth itTruthBegin, ItTruth itTruthEnd, ItDelta itDelta, ItDelta itDeltaEnd, ItInvActFnc itInvActFnc, double patternWeight)
soft-max-cross-entropy error function (for mutual exclusive cross-entropy) 
Timer m_timer
timer for monitoring 
size_t minError() const
returns the smallest error so far 
size_t numNodes() const
return the number of nodes of this layer 
double m_factorWeightDecay
LayerData(const LayerData &other)
copy c'tor of LayerData 
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. 
void modeOutputValues(ModeOutputValues eModeOutputValues)
set the mode-output-value 
void pads(int numPads)
preparation for monitoring 
Settings for the training of the neural net. 
virtual void startTrainCycle()
virtual void drawSample(const std::vector< double > &, const std::vector< double > &, const std::vector< double > &, double)
callback for monitoring and loggging 
std::string m_fileNameResult
std::shared_ptr< std::function< double(double)> > inverseActivationFunction() const
fetch the inverse activation function for this layer 
WeightInitializationStrategy
weight initialization strategies to be chosen from 
ModeErrorFunction
error functions to be chosen from 
std::vector< double > m_localGradients
local gradients for reuse in thread. 
Layer defines the layout of a layer. 
void applyWeightsBackwards(ItSource itCurrBegin, ItSource itCurrEnd, ItWeight itWeight, ItPrev itPrevBegin, ItPrev itPrevEnd)
const_dropout_iterator m_itDropOut
iterator to a container indicating if the corresponding node is to be dropped 
Steepest(double learningRate=1e-4, double momentum=0.5, size_t repetitions=10)
c'tor 
bool m_hasWeights
does this layer have weights (it does not if it is the input layer) 
std::vector< double > m_ams
EnumRegularization m_regularization
const_iterator_type valuesEnd() const
returns iterator to the end of the (node) values 
void clearDropOut()
clear the drop-out-data for this layer 
double gaussDouble(double mean, double sigma)
MinimizerType minimizerType() const
which minimizer shall be used (e.g. SGD) 
The Batch class encapsulates one mini-batch. 
double m_beta
internal parameter (momentum) 
container_type::iterator iterator_type
size_t maxConvergenceCount() const
returns the max convergence count so far 
std::vector< double > m_targets
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
void forward(const LAYERDATA &prevLayerData, LAYERDATA &currLayerData)
apply the weights (and functions) in forward direction of the DNN 
double uniformDouble(double minValue, double maxValue)
std::vector< double > m_values
stores the values of the nodes in this layer 
std::vector< double > m_weights
const_iterator_type deltasEnd() const
returns const iterator to the end of the deltas (back-propagation) 
size_t m_maxConvergenceCount
iterator_type deltasEnd()
returns iterator to the end of the deltas (back-propagation) 
void addLayer(Layer &layer)
add a layer (layout) 
This class is needed by JsMVA, and it's a helper class for tracking errors during the training in Jup...
Abstract ClassifierFactory template that handles arbitrary types. 
size_t size() const
return the size of the layer 
const_iterator_type m_itInputEnd
iterator to the end of the nodes in the input node vector 
std::shared_ptr< std::function< double(double)> > m_activationFunction
activation function for this layer 
std::shared_ptr< std::function< double(double)> > m_inverseActivationFunction
inverse activation function for this layer 
virtual void setProgressLimits(double minProgress=0, double maxProgress=100)
size_t batchSize() const
mini-batch size 
size_t m_scaleToNumEvents
virtual void endTestCycle()
callback for monitoring and loggging 
std::vector< double > m_localWeights
local weights for reuse in thread. 
iterator_type valueGradientsBegin()
returns iterator to the begin of the gradients of the node values 
const_iterator m_itBegin
iterator denoting the beginning of the batch 
std::vector< double > container_type
void clear()
clear the values and the deltas 
Settings for classificationused to distinguish between different function signatures. 
const_dropout_iterator dropOut() const
return the begin of the drop-out information 
void clear(std::string histoName)
for monitoring 
virtual void computeResult(const Net &, std::vector< double > &)
callback for monitoring and loggging 
const_iterator_type deltasBegin() const
returns const iterator to the begin of the deltas (back-propagation) 
const_iterator begin() const
Batch(typename std::vector< Pattern >::const_iterator itBegin, typename std::vector< Pattern >::const_iterator itEnd)
DropContainer::const_iterator const_dropout_iterator
double m_alpha
internal parameter (learningRate) 
const_iterator_type valuesBegin() const
returns const iterator to the begin of the (node) values 
void setDropOut(Iterator itDrop)
set the drop-out info for this layer 
void addPoint(std::string histoName, double x, double y)
for monitoring 
size_t outputSize() const
output size of the DNN 
ModeOutputValues operator|=(ModeOutputValues &lhs, ModeOutputValues rhs)
double sumOfSquares(ItOutput itOutputBegin, ItOutput itOutputEnd, ItTruth itTruthBegin, ItTruth itTruthEnd, ItDelta itDelta, ItDelta itDeltaEnd, ItInvActFnc itInvActFnc, double patternWeight)
Timing information for training and evaluation of MVA methods. 
double crossEntropy(ItProbability itProbabilityBegin, ItProbability itProbabilityEnd, ItTruth itTruthBegin, ItTruth itTruthEnd, ItDelta itDelta, ItDelta itDeltaEnd, ItInvActFnc itInvActFnc, double patternWeight)
cross entropy error function 
bool exists(std::string histoName)
for monitoring 
LayerData holds the data of one layer. 
virtual void testSample(double, double, double, double)
virtual function to be used for monitoring (callback) 
Net(const Net &other)
d'tor 
std::tuple< Settings &, Batch &, DropContainer & > pass_through_type
int repetitions() const
how many steps have to be gone until the batch is changed 
const_iterator m_itEnd
iterator denoting the end of the batch 
int randomInt(int maxValue)
std::shared_ptr< std::function< double(double)> > m_activationFunction
stores the activation function 
std::vector< double > m_input