24#ifndef TMVA_NEURAL_NET
25#define TMVA_NEURAL_NET
57 class IPythonInteractive;
92 inline void add(
T value,
double weight = 1.0)
107 double R =
Q*weight/tmpWeight;
114 template <
typename ITERATOR>
115 inline void add (ITERATOR itBegin, ITERATOR itEnd)
117 for (ITERATOR it = itBegin; it != itEnd; ++it)
210 template <
typename T>
213 return (
int)(value & flag) != 0;
238 Batch (
typename std::vector<Pattern>::const_iterator itBegin,
typename std::vector<Pattern>::const_iterator itEnd)
258 template <
typename ItSource,
typename ItWeight,
typename ItTarget>
259 void applyWeights (ItSource itSourceBegin, ItSource itSourceEnd, ItWeight itWeight, ItTarget itTargetBegin, ItTarget itTargetEnd);
263 template <
typename ItSource,
typename ItWeight,
typename ItPrev>
264 void applyWeightsBackwards (ItSource itCurrBegin, ItSource itCurrEnd, ItWeight itWeight, ItPrev itPrevBegin, ItPrev itPrevEnd);
270 template <
typename ItValue,
typename ItFunction>
271 void applyFunctions (ItValue itValue, ItValue itValueEnd, ItFunction itFunction);
274 template <
typename ItValue,
typename ItFunction,
typename ItInverseFunction,
typename ItGradient>
275 void applyFunctions (ItValue itValue, ItValue itValueEnd, ItFunction itFunction, ItInverseFunction itInverseFunction, ItGradient itGradient);
279 template <
typename ItSource,
typename ItDelta,
typename ItTargetGradient,
typename ItGradient>
280 void update (ItSource itSource, ItSource itSourceEnd,
281 ItDelta itTargetDeltaBegin, ItDelta itTargetDeltaEnd,
282 ItTargetGradient itTargetGradientBegin,
283 ItGradient itGradient);
287 template <EnumRegularization Regularization,
typename ItSource,
typename ItDelta,
typename ItTargetGradient,
typename ItGradient,
typename ItWeight>
288 void update (ItSource itSource, ItSource itSourceEnd,
289 ItDelta itTargetDeltaBegin, ItDelta itTargetDeltaEnd,
290 ItTargetGradient itTargetGradientBegin,
291 ItGradient itGradient,
348 double momentum = 0.5,
349 size_t repetitions = 10)
366 template <
typename Function,
typename Weights,
typename PassThrough>
367 double operator() (
Function& fitnessFunction, Weights& weights, PassThrough& passThrough);
395 template <
typename ItOutput,
typename ItTruth,
typename ItDelta,
typename ItInvActFnc>
396 double sumOfSquares (ItOutput itOutputBegin, ItOutput itOutputEnd, ItTruth itTruthBegin, ItTruth itTruthEnd, ItDelta itDelta, ItDelta itDeltaEnd, ItInvActFnc itInvActFnc,
double patternWeight);
400 template <
typename ItProbability,
typename ItTruth,
typename ItDelta,
typename ItInvActFnc>
401 double crossEntropy (ItProbability itProbabilityBegin, ItProbability itProbabilityEnd, ItTruth itTruthBegin, ItTruth itTruthEnd, ItDelta itDelta, ItDelta itDeltaEnd, ItInvActFnc itInvActFnc,
double patternWeight);
406 template <
typename ItOutput,
typename ItTruth,
typename ItDelta,
typename ItInvActFnc>
407 double softMaxCrossEntropy (ItOutput itProbabilityBegin, ItOutput itProbabilityEnd, ItTruth itTruthBegin, ItTruth itTruthEnd, ItDelta itDelta, ItDelta itDeltaEnd, ItInvActFnc itInvActFnc,
double patternWeight);
413 template <
typename ItWeight>
615 template <
typename Iterator>
717 template <
typename LAYERDATA>
718 void forward (
const LAYERDATA& prevLayerData, LAYERDATA& currLayerData);
721 template <
typename LAYERDATA>
722 void backward (LAYERDATA& prevLayerData, LAYERDATA& currLayerData);
725 template <
typename LAYERDATA>
743 size_t _convergenceSteps = 15,
size_t _batchSize = 10,
size_t _testRepetitions = 7,
746 double _learningRate = 1
e-5,
double _momentum = 0.3,
747 int _repetitions = 3,
748 bool _multithreading =
true);
763 template <
typename Iterator>
786 virtual void testSample (
double ,
double ,
double ,
double ) {}
812 virtual void drawSample (
const std::vector<double>& ,
const std::vector<double>& ,
const std::vector<double>& ,
double ) {}
825 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); }
907 size_t _convergenceSteps = 15,
size_t _batchSize = 10,
size_t _testRepetitions = 7,
910 double _learningRate = 1
e-5,
double _momentum = 0.3,
int _repetitions = 3,
911 bool _useMultithreading =
true)
912 :
Settings (
name, _convergenceSteps, _batchSize, _testRepetitions, _factorWeightDecay,
913 _regularization, _eMinimizerType, _learningRate, _momentum, _repetitions, _useMultithreading)
991 void testSample (
double error,
double output,
double target,
double weight);
997 void setWeightSums (
double sumOfSigWeights,
double sumOfBkgWeights);
998 void setResultComputation (std::string _fileNameNetConfig, std::string _fileNameResult, std::vector<Pattern>* _resultPatternContainer);
1110 template <
typename WeightsType,
typename DropProbabilities>
1112 const DropProbabilities& drops,
1113 bool inverse =
false);
1123 template <
typename Minimizer>
1124 double train (std::vector<double>& weights,
1125 std::vector<Pattern>& trainPattern,
1126 const std::vector<Pattern>& testPattern,
1134 template <
typename Minimizer>
1136 std::vector<Pattern>& trainPattern,
1137 const std::vector<Pattern>& testPattern,
1150 template <
typename Iterator,
typename Minimizer>
1152 Iterator itPatternBegin, Iterator itPatternEnd,
1156 size_t numWeights (
size_t trainingStartLayer = 0)
const;
1157 size_t numNodes (
size_t trainingStartLayer = 0)
const;
1159 template <
typename Weights>
1160 std::vector<double>
compute (
const std::vector<double>& input,
const Weights& weights)
const;
1162 template <
typename Weights,
typename PassThrough>
1163 double operator() (PassThrough& settingsAndBatch,
const Weights& weights)
const;
1165 template <
typename Weights,
typename PassThrough,
typename OutContainer>
1166 double operator() (PassThrough& settingsAndBatch,
const Weights& weights,
ModeOutput eFetch, OutContainer& outputContainer)
const;
1168 template <
typename Weights,
typename Gradients,
typename PassThrough>
1169 double operator() (PassThrough& settingsAndBatch, Weights& weights, Gradients& gradients)
const;
1171 template <
typename Weights,
typename Gradients,
typename PassThrough,
typename OutContainer>
1172 double operator() (PassThrough& settingsAndBatch, Weights& weights, Gradients& gradients,
ModeOutput eFetch, OutContainer& outputContainer)
const;
1175 template <
typename LayerContainer,
typename DropContainer,
typename ItWeight,
typename ItGradient>
1179 ItWeight itWeightBegin,
1180 ItWeight itWeightEnd,
1181 ItGradient itGradientBegin,
1182 ItGradient itGradientEnd,
1183 size_t& totalNumWeights)
const;
1185 template <
typename LayerContainer>
1187 std::vector<LayerData>& layerData)
const;
1190 template <
typename LayerContainer,
typename LayerPatternContainer>
1192 LayerPatternContainer& layerPatternData,
1193 std::vector<double>& valuesMean,
1194 std::vector<double>& valuesStdDev,
1195 size_t trainFromLayer)
const;
1197 template <
typename OutputContainer>
1200 template <
typename OutputContainer>
1201 void fetchOutput (
const std::vector<LayerData>& layerPatternData, OutputContainer& outputContainer)
const;
1204 template <
typename ItWeight>
1206 std::vector<LayerData>& lastLayerData,
1208 ItWeight itWeightBegin,
1209 ItWeight itWeightEnd)
const;
1211 template <
typename Settings>
1212 void backPropagate (std::vector<std::vector<LayerData>>& layerPatternData,
1214 size_t trainFromLayer,
1215 size_t totalNumWeights)
const;
1223 template <
typename LayerContainer,
typename PassThrough,
typename ItWeight,
typename ItGradient,
typename OutContainer>
1225 ItWeight itWeightBegin, ItWeight itWeightEnd,
1226 ItGradient itGradientBegin, ItGradient itGradientEnd,
1227 size_t trainFromLayer,
1228 OutContainer& outputContainer,
bool fetchOutput)
const;
1240 template <
typename Container,
typename ItWeight>
1244 ItWeight itWeightEnd,
1245 double patternWeight,
1246 double factorWeightDecay,
1263 template <
typename OutIterator>
1265 OutIterator itWeight);
#define R(a, b, c, d, e, f, g, h, i)
Double_t(* Function)(Double_t)
The Batch class encapsulates one mini-batch.
const_iterator m_itEnd
iterator denoting the end of the batch
const_iterator begin() const
const_iterator end() const
Batch(typename std::vector< Pattern >::const_iterator itBegin, typename std::vector< Pattern >::const_iterator itEnd)
std::vector< Pattern >::const_iterator const_iterator
const_iterator m_itBegin
iterator denoting the beginning of the batch
Settings for classificationused to distinguish between different function signatures.
void startTrainCycle()
action to be done when the training cycle is started (e.g.
void testIteration()
callback for monitoring and loggging
void endTrainCycle(double)
action to be done when the training cycle is ended (e.g.
virtual void endTestCycle()
action to be done when the training cycle is ended (e.g.
std::vector< Pattern > * m_pResultPatternContainer
void setResultComputation(std::string _fileNameNetConfig, std::string _fileNameResult, std::vector< Pattern > *_resultPatternContainer)
preparation for monitoring output
std::string m_fileNameResult
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
std::vector< double > m_input
std::vector< double > m_significances
std::vector< double > m_weights
std::string m_fileNameNetConfig
virtual ~ClassificationSettings()
d'tor
std::vector< double > m_targets
void testSample(double error, double output, double target, double weight)
action to be done after the computation of a test sample (e.g.
size_t m_scaleToNumEvents
virtual void startTestCycle()
action to be done when the test cycle is started (e.g.
void setWeightSums(double sumOfSigWeights, double sumOfBkgWeights)
set the weight sums to be scaled to (preparations for monitoring output)
std::vector< double > m_ams
std::vector< double > m_output
LayerData holds the data of one layer.
const_iterator_type m_itInputBegin
iterator to the first of the nodes in the input node vector
const_iterator_type deltasBegin() const
returns const iterator to the begin of the deltas (back-propagation)
iterator_type valuesBegin()
returns iterator to the begin of the (node) values
const_iterator_type valuesEnd() const
returns iterator to the end of the (node) values
bool m_hasGradients
does this layer have gradients (only if in training mode)
std::vector< double > m_deltas
stores the deltas for the DNN training
container_type::iterator iterator_type
LayerData(const_iterator_type itInputBegin, const_iterator_type itInputEnd, ModeOutputValues eModeOutput=ModeOutputValues::DIRECT)
c'tor of LayerData
void setDropOut(Iterator itDrop)
set the drop-out info for this layer
void setInput(const_iterator_type itInputBegin, const_iterator_type itInputEnd)
change the input iterators
std::vector< std::function< double(double)> > function_container_type
iterator_type valuesEnd()
returns iterator to the end of the (node) values
const_dropout_iterator m_itDropOut
iterator to a container indicating if the corresponding node is to be dropped
iterator_type valueGradientsBegin()
returns iterator to the begin of the gradients of the node values
iterator_type gradientsBegin()
returns iterator to the begin of the gradients
iterator_type deltasBegin()
returns iterator to the begin of the deltas (back-propagation)
bool m_hasWeights
does this layer have weights (it does not if it is the input layer)
const_dropout_iterator dropOut() const
return the begin of the drop-out information
LayerData(LayerData &&other)
move c'tor of LayerData
std::vector< double > container_type
size_t size() const
return the size of the layer
const_iterator_type weightsBegin() const
returns const iterator to the begin of the weights for this layer
function_container_type::const_iterator const_function_iterator_type
LayerData(const LayerData &other)
copy c'tor of LayerData
function_container_type::iterator function_iterator_type
std::vector< double > m_values
stores the values of the nodes in this layer
const_iterator_type m_itInputEnd
iterator to the end of the nodes in the input node vector
container_type::const_iterator const_iterator_type
ModeOutputValues outputMode() const
returns the output mode
iterator_type m_itGradientBegin
iterator to the first gradient of this layer in the gradient vector
const_iterator_type gradientsBegin() const
returns const iterator to the begin of the gradients
std::shared_ptr< std::function< double(double)> > inverseActivationFunction() const
iterator_type deltasEnd()
returns iterator to the end of the deltas (back-propagation)
std::vector< double > m_valueGradients
stores the gradients of the values (nodes)
const_iterator_type m_itConstWeightBegin
const iterator to the first weight of this layer in the weight vector
iterator_type valueGradientsEnd()
returns iterator to the end of the gradients of the node values
void clear()
clear the values and the deltas
std::shared_ptr< std::function< double(double)> > activationFunction() const
container_type computeProbabilities() const
compute the probabilities from the node values
const_iterator_type deltasEnd() const
returns const iterator to the end of the deltas (back-propagation)
bool m_hasDropOut
dropOut is turned on?
bool m_isInputLayer
is this layer an input layer
bool hasDropOut() const
has this layer drop-out turned on?
const_iterator_type valueGradientsBegin() const
returns const iterator to the begin of the gradients
const_iterator_type valueGradientsEnd() const
returns const iterator to the end of the gradients
container_type probabilities() const
computes the probabilities from the current node values and returns them
void clearDropOut()
clear the drop-out-data for this layer
ModeOutputValues m_eModeOutput
stores the output mode (DIRECT, SIGMOID, SOFTMAX)
std::shared_ptr< std::function< double(double)> > m_inverseActivationFunction
inverse activation function for this layer
DropContainer::const_iterator const_dropout_iterator
const_iterator_type valuesBegin() const
returns const iterator to the begin of the (node) values
std::shared_ptr< std::function< double(double)> > m_activationFunction
activation function for this layer
Layer defines the layout of a layer.
void modeOutputValues(ModeOutputValues eModeOutputValues)
set the mode-output-value
std::shared_ptr< std::function< double(double)> > m_activationFunction
stores the activation function
std::shared_ptr< std::function< double(double)> > activationFunction() const
fetch the activation function for this layer
std::shared_ptr< std::function< double(double)> > m_inverseActivationFunction
stores the inverse activation function
size_t numNodes() const
return the number of nodes of this layer
ModeOutputValues m_eModeOutputValues
do the output values of this layer have to be transformed somehow (e.g. to probabilities) or returned...
size_t numWeights(size_t numInputNodes) const
return the number of weights for this layer (fully connected)
std::shared_ptr< std::function< double(double)> > inverseActivationFunction() const
fetch the inverse activation function for this layer
EnumFunction m_activationFunctionType
Layer(size_t numNodes, EnumFunction activationFunction, ModeOutputValues eModeOutputValues=ModeOutputValues::DIRECT)
c'tor for defining a Layer
EnumFunction activationFunctionType() const
get the activation function type for this layer
ModeOutputValues modeOutputValues() const
get the mode-output-value (direct, probabilities)
void add(T value, double weight=1.0)
double stdDev_corr() const
void add(ITERATOR itBegin, ITERATOR itEnd)
void setInputSize(size_t sizeInput)
set the input size of the DNN
std::vector< Layer > & layers()
returns the layers (structure)
void forwardBatch(const LayerContainer &_layers, LayerPatternContainer &layerPatternData, std::vector< double > &valuesMean, std::vector< double > &valuesStdDev, size_t trainFromLayer) const
Net(const Net &other)
d'tor
std::vector< Layer > m_layers
layer-structure-data
void SetIpythonInteractive(IPythonInteractive *fI, bool *fE, UInt_t *M, UInt_t *C)
std::vector< double > compute(const std::vector< double > &input, const Weights &weights) const
compute the net with the given input and the given weights
std::vector< double > container_type
container_type::iterator iterator_type
void preTrain(std::vector< double > &weights, std::vector< Pattern > &trainPattern, const std::vector< Pattern > &testPattern, Minimizer &minimizer, Settings &settings)
pre-training for future use
void fetchOutput(const LayerData &lastLayerData, OutputContainer &outputContainer) const
size_t inputSize() const
input size of the DNN
std::pair< iterator_type, iterator_type > begin_end_type
ModeErrorFunction m_eErrorFunction
denotes the error function
void addLayer(Layer &&layer)
size_t numNodes(size_t trainingStartLayer=0) const
returns the number of nodes in this net
double train(std::vector< double > &weights, std::vector< Pattern > &trainPattern, const std::vector< Pattern > &testPattern, Minimizer &minimizer, Settings &settings)
start the training
const std::vector< Layer > & layers() const
returns the layers (structure)
std::vector< std::vector< LayerData > > prepareLayerData(LayerContainer &layers, Batch &batch, const DropContainer &dropContainer, ItWeight itWeightBegin, ItWeight itWeightEnd, ItGradient itGradientBegin, ItGradient itGradientEnd, size_t &totalNumWeights) const
void setErrorFunction(ModeErrorFunction eErrorFunction)
which error function is to be used
void initializeWeights(WeightInitializationStrategy eInitStrategy, OutIterator itWeight)
initialize the weights with the given strategy
size_t outputSize() const
output size of the DNN
double errorFunction(LayerData &layerData, Container truth, ItWeight itWeight, ItWeight itWeightEnd, double patternWeight, double factorWeightDecay, EnumRegularization eRegularization) const
computes the error of the DNN
double forward_backward(LayerContainer &layers, PassThrough &settingsAndBatch, ItWeight itWeightBegin, ItWeight itWeightEnd, ItGradient itGradientBegin, ItGradient itGradientEnd, size_t trainFromLayer, OutContainer &outputContainer, bool fetchOutput) const
main NN computation function
void removeLayer()
remove one layer
size_t m_sizeOutput
outut size of this DNN
size_t m_sizeInput
input size of this DNN
double trainCycle(Minimizer &minimizer, std::vector< double > &weights, Iterator itPatternBegin, Iterator itPatternEnd, Settings &settings, DropContainer &dropContainer)
executes one training cycle
double operator()(PassThrough &settingsAndBatch, const Weights &weights) const
execute computation of the DNN for one mini-batch (used by the minimizer); no computation of gradient...
void dropOutWeightFactor(WeightsType &weights, const DropProbabilities &drops, bool inverse=false)
set the drop out configuration
void fillDropContainer(DropContainer &dropContainer, double dropFraction, size_t numNodes) const
prepare the drop-out-container (select the nodes which are to be dropped out)
void addLayer(Layer &layer)
add a layer (layout)
size_t numWeights(size_t trainingStartLayer=0) const
returns the number of weights in this net
IPythonInteractive * fInteractive
std::tuple< double, double > computeError(const Settings &settings, std::vector< LayerData > &lastLayerData, Batch &batch, ItWeight itWeightBegin, ItWeight itWeightEnd) const
void setOutputSize(size_t sizeOutput)
set the output size of the DNN
void forwardPattern(const LayerContainer &_layers, std::vector< LayerData > &layerData) const
void backPropagate(std::vector< std::vector< LayerData > > &layerPatternData, const Settings &settings, size_t trainFromLayer, size_t totalNumWeights) const
Settings for the training of the neural net.
size_t m_batchSize
mini-batch size
void setDropOut(Iterator begin, Iterator end, size_t _dropRepetitions)
set the drop-out configuration (layer-wise)
void create(std::string histoName, int bins, double min, double max, int bins2, double min2, double max2)
for monitoring
bool useMultithreading() const
is multithreading turned on?
EnumRegularization regularization() const
some regularization of the DNN is turned on?
size_t convergenceCount() const
returns the current convergence count
double momentum() const
get the momentum (e.g. for SGD)
Timer m_timer
timer for monitoring
size_t testRepetitions() const
how often is the test data tested
void clear(std::string histoName)
for monitoring
virtual void endTestCycle()
callback for monitoring and loggging
MinimizerType fMinimizerType
void addPoint(std::string histoName, double x, double y)
for monitoring
void setMonitoring(std::shared_ptr< Monitoring > ptrMonitoring)
prepared for monitoring
virtual void testIteration()
callback for monitoring and loggging
size_t m_convergenceSteps
number of steps without improvement to consider the DNN to have converged
virtual bool hasConverged(double testError)
has this training converged already?
MinimizerType minimizerType() const
which minimizer shall be used (e.g. SGD)
std::vector< double > m_dropOut
double m_minProgress
current limits for the progress bar
virtual void cycle(double progress, TString text)
Settings(TString name, size_t _convergenceSteps=15, size_t _batchSize=10, size_t _testRepetitions=7, double _factorWeightDecay=1e-5, TMVA::DNN::EnumRegularization _regularization=TMVA::DNN::EnumRegularization::NONE, MinimizerType _eMinimizerType=MinimizerType::fSteepest, double _learningRate=1e-5, double _momentum=0.3, int _repetitions=3, bool _multithreading=true)
c'tor
virtual void setProgressLimits(double minProgress=0, double maxProgress=100)
double m_maxProgress
current limits for the progress bar
virtual void endTrainCycle(double)
callback for monitoring and logging
virtual void drawSample(const std::vector< double > &, const std::vector< double > &, const std::vector< double > &, double)
callback for monitoring and loggging
double learningRate() const
get the learning rate
const std::vector< double > & dropFractions() const
void addPoint(std::string histoName, double x)
for monitoring
size_t m_convergenceCount
EnumRegularization m_regularization
int repetitions() const
how many steps have to be gone until the batch is changed
virtual void testSample(double, double, double, double)
virtual function to be used for monitoring (callback)
void plot(std::string histoName, std::string options, int pad, EColor color)
for monitoring
virtual void startTrainCycle()
size_t convergenceSteps() const
how many steps until training is deemed to have converged
double m_factorWeightDecay
double factorWeightDecay() const
get the weight-decay factor
bool exists(std::string histoName)
for monitoring
size_t maxConvergenceCount() const
returns the max convergence count so far
void pads(int numPads)
preparation for monitoring
size_t batchSize() const
mini-batch size
virtual void computeResult(const Net &, std::vector< double > &)
callback for monitoring and loggging
std::shared_ptr< Monitoring > fMonitoring
size_t dropRepetitions() const
void create(std::string histoName, int bins, double min, double max)
for monitoring
size_t minError() const
returns the smallest error so far
virtual void startTraining()
size_t m_maxConvergenceCount
virtual void startTestCycle()
callback for monitoring and loggging
Steepest Gradient Descent algorithm (SGD)
double m_beta
internal parameter (momentum)
std::vector< double > m_localGradients
local gradients for reuse in thread.
std::vector< double > m_prevGradients
vector remembers the gradients of the previous step
double m_alpha
internal parameter (learningRate)
std::vector< double > m_localWeights
local weights for reuse in thread.
double operator()(Function &fitnessFunction, Weights &weights, PassThrough &passThrough)
operator to call the steepest gradient descent algorithm
Steepest(double learningRate=1e-4, double momentum=0.5, size_t repetitions=10)
c'tor
This class is needed by JsMVA, and it's a helper class for tracking errors during the training in Jup...
Timing information for training and evaluation of MVA methods.
void DrawProgressBar(Int_t, const TString &comment="")
draws progress bar in color or B&W caution:
RooCmdArg Minimizer(const char *type, const char *alg=0)
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
double sumOfSquares(ItOutput itOutputBegin, ItOutput itOutputEnd, ItTruth itTruthBegin, ItTruth itTruthEnd, ItDelta itDelta, ItDelta itDeltaEnd, ItInvActFnc itInvActFnc, double patternWeight)
double uniformDouble(double minValue, double maxValue)
void forward(const LAYERDATA &prevLayerData, LAYERDATA &currLayerData)
apply the weights (and functions) in forward direction of the DNN
void applyFunctions(ItValue itValue, ItValue itValueEnd, ItFunction itFunction)
ModeOutputValues operator|(ModeOutputValues lhs, ModeOutputValues rhs)
double crossEntropy(ItProbability itProbabilityBegin, ItProbability itProbabilityEnd, ItTruth itTruthBegin, ItTruth itTruthEnd, ItDelta itDelta, ItDelta itDeltaEnd, ItInvActFnc itInvActFnc, double patternWeight)
cross entropy error function
void backward(LAYERDATA &prevLayerData, LAYERDATA &currLayerData)
backward application of the weights (back-propagation of the error)
double weightDecay(double error, ItWeight itWeight, ItWeight itWeightEnd, double factorWeightDecay, EnumRegularization eRegularization)
compute the weight decay for regularization (L1 or L2)
ModeOutputValues operator&=(ModeOutputValues &lhs, ModeOutputValues rhs)
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.
ModeErrorFunction
error functions to be chosen from
@ CROSSENTROPY_MUTUALEXCLUSIVE
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)
WeightInitializationStrategy
weight initialization strategies to be chosen from
ModeOutputValues operator|=(ModeOutputValues &lhs, ModeOutputValues rhs)
MinimizerType
< list all the minimizer types
double gaussDouble(double mean, double sigma)
ModeOutputValues operator&(ModeOutputValues lhs, ModeOutputValues rhs)
void applyWeights(ItSource itSourceBegin, ItSource itSourceEnd, ItWeight itWeight, ItTarget itTargetBegin, ItTarget itTargetEnd)
std::tuple< Settings &, Batch &, DropContainer & > pass_through_type
bool isFlagSet(T flag, T value)
int randomInt(int maxValue)
void update(ItSource itSource, ItSource itSourceEnd, ItDelta itTargetDeltaBegin, ItDelta itTargetDeltaEnd, ItTargetGradient itTargetGradientBegin, ItGradient itGradient)
update the gradients
std::vector< char > DropContainer
void applyWeightsBackwards(ItSource itCurrBegin, ItSource itCurrEnd, ItWeight itWeight, ItPrev itPrevBegin, ItPrev itPrevEnd)
create variable transformations
static void output(int code)