24#ifndef TMVA_NEURAL_NET
25#define TMVA_NEURAL_NET
58 class IPythonInteractive;
93 inline void add(T value,
double weight = 1.0)
106 double Q = value -
m_mean;
108 double R = Q*weight/tmpWeight;
115 template <
typename ITERATOR>
116 inline void add (ITERATOR itBegin, ITERATOR itEnd)
118 for (ITERATOR it = itBegin; it != itEnd; ++it)
190 return (
ModeOutputValues)(
static_cast<std::underlying_type<ModeOutputValues>::type
>(lhs) |
static_cast<std::underlying_type<ModeOutputValues>::type
>(rhs));
195 lhs = (
ModeOutputValues)(
static_cast<std::underlying_type<ModeOutputValues>::type
>(lhs) |
static_cast<std::underlying_type<ModeOutputValues>::type
>(rhs));
201 return (
ModeOutputValues)(
static_cast<std::underlying_type<ModeOutputValues>::type
>(lhs) &
static_cast<std::underlying_type<ModeOutputValues>::type
>(rhs));
206 lhs = (
ModeOutputValues)(
static_cast<std::underlying_type<ModeOutputValues>::type
>(lhs) &
static_cast<std::underlying_type<ModeOutputValues>::type
>(rhs));
211 template <
typename T>
214 return (
int)(value & flag) != 0;
239 Batch (
typename std::vector<Pattern>::const_iterator itBegin,
typename std::vector<Pattern>::const_iterator itEnd)
259 template <
typename ItSource,
typename ItWeight,
typename ItTarget>
260 void applyWeights (ItSource itSourceBegin, ItSource itSourceEnd, ItWeight itWeight, ItTarget itTargetBegin, ItTarget itTargetEnd);
264 template <
typename ItSource,
typename ItWeight,
typename ItPrev>
265 void applyWeightsBackwards (ItSource itCurrBegin, ItSource itCurrEnd, ItWeight itWeight, ItPrev itPrevBegin, ItPrev itPrevEnd);
271 template <
typename ItValue,
typename ItFunction>
272 void applyFunctions (ItValue itValue, ItValue itValueEnd, ItFunction itFunction);
275 template <
typename ItValue,
typename ItFunction,
typename ItInverseFunction,
typename ItGradient>
276 void applyFunctions (ItValue itValue, ItValue itValueEnd, ItFunction itFunction, ItInverseFunction itInverseFunction, ItGradient itGradient);
280 template <
typename ItSource,
typename ItDelta,
typename ItTargetGradient,
typename ItGradient>
281 void update (ItSource itSource, ItSource itSourceEnd,
282 ItDelta itTargetDeltaBegin, ItDelta itTargetDeltaEnd,
283 ItTargetGradient itTargetGradientBegin,
284 ItGradient itGradient);
288 template <EnumRegularization Regularization,
typename ItSource,
typename ItDelta,
typename ItTargetGradient,
typename ItGradient,
typename ItWeight>
289 void update (ItSource itSource, ItSource itSourceEnd,
290 ItDelta itTargetDeltaBegin, ItDelta itTargetDeltaEnd,
291 ItTargetGradient itTargetGradientBegin,
292 ItGradient itGradient,
349 double momentum = 0.5,
350 size_t repetitions = 10)
367 template <
typename Function,
typename Weights,
typename PassThrough>
368 double operator() (
Function& fitnessFunction, Weights& weights, PassThrough& passThrough);
396 template <
typename ItOutput,
typename ItTruth,
typename ItDelta,
typename ItInvActFnc>
397 double sumOfSquares (ItOutput itOutputBegin, ItOutput itOutputEnd, ItTruth itTruthBegin, ItTruth itTruthEnd, ItDelta itDelta, ItDelta itDeltaEnd, ItInvActFnc itInvActFnc,
double patternWeight);
401 template <
typename ItProbability,
typename ItTruth,
typename ItDelta,
typename ItInvActFnc>
402 double crossEntropy (ItProbability itProbabilityBegin, ItProbability itProbabilityEnd, ItTruth itTruthBegin, ItTruth itTruthEnd, ItDelta itDelta, ItDelta itDeltaEnd, ItInvActFnc itInvActFnc,
double patternWeight);
407 template <
typename ItOutput,
typename ItTruth,
typename ItDelta,
typename ItInvActFnc>
408 double softMaxCrossEntropy (ItOutput itProbabilityBegin, ItOutput itProbabilityEnd, ItTruth itTruthBegin, ItTruth itTruthEnd, ItDelta itDelta, ItDelta itDeltaEnd, ItInvActFnc itInvActFnc,
double patternWeight);
414 template <
typename ItWeight>
613 template <
typename Iterator>
712 template <
typename LAYERDATA>
713 void forward (
const LAYERDATA& prevLayerData, LAYERDATA& currLayerData);
716 template <
typename LAYERDATA>
717 void backward (LAYERDATA& prevLayerData, LAYERDATA& currLayerData);
720 template <
typename LAYERDATA>
738 size_t _convergenceSteps = 15,
size_t _batchSize = 10,
size_t _testRepetitions = 7,
741 double _learningRate = 1
e-5,
double _momentum = 0.3,
742 int _repetitions = 3,
743 bool _multithreading =
true);
758 template <
typename Iterator>
781 virtual void testSample (
double ,
double ,
double ,
double ) {}
807 virtual void drawSample (
const std::vector<double>& ,
const std::vector<double>& ,
const std::vector<double>& ,
double ) {}
820 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); }
902 size_t _convergenceSteps = 15,
size_t _batchSize = 10,
size_t _testRepetitions = 7,
905 double _learningRate = 1
e-5,
double _momentum = 0.3,
int _repetitions = 3,
906 bool _useMultithreading =
true)
907 :
Settings (
name, _convergenceSteps, _batchSize, _testRepetitions, _factorWeightDecay,
908 _regularization, _eMinimizerType, _learningRate, _momentum, _repetitions, _useMultithreading)
986 void testSample (
double error,
double output,
double target,
double weight);
992 void setWeightSums (
double sumOfSigWeights,
double sumOfBkgWeights);
993 void setResultComputation (std::string _fileNameNetConfig, std::string _fileNameResult, std::vector<Pattern>* _resultPatternContainer);
1105 template <
typename WeightsType,
typename DropProbabilities>
1107 const DropProbabilities& drops,
1108 bool inverse =
false);
1118 template <
typename Minimizer>
1119 double train (std::vector<double>& weights,
1120 std::vector<Pattern>& trainPattern,
1121 const std::vector<Pattern>& testPattern,
1122 Minimizer& minimizer,
1129 template <
typename Minimizer>
1131 std::vector<Pattern>& trainPattern,
1132 const std::vector<Pattern>& testPattern,
1133 Minimizer& minimizer,
Settings& settings);
1145 template <
typename Iterator,
typename Minimizer>
1146 inline double trainCycle (Minimizer& minimizer, std::vector<double>& weights,
1147 Iterator itPatternBegin, Iterator itPatternEnd,
1151 size_t numWeights (
size_t trainingStartLayer = 0)
const;
1152 size_t numNodes (
size_t trainingStartLayer = 0)
const;
1154 template <
typename Weights>
1155 std::vector<double>
compute (
const std::vector<double>& input,
const Weights& weights)
const;
1157 template <
typename Weights,
typename PassThrough>
1158 double operator() (PassThrough& settingsAndBatch,
const Weights& weights)
const;
1160 template <
typename Weights,
typename PassThrough,
typename OutContainer>
1161 double operator() (PassThrough& settingsAndBatch,
const Weights& weights,
ModeOutput eFetch, OutContainer& outputContainer)
const;
1163 template <
typename Weights,
typename Gradients,
typename PassThrough>
1164 double operator() (PassThrough& settingsAndBatch, Weights& weights, Gradients& gradients)
const;
1166 template <
typename Weights,
typename Gradients,
typename PassThrough,
typename OutContainer>
1167 double operator() (PassThrough& settingsAndBatch, Weights& weights, Gradients& gradients,
ModeOutput eFetch, OutContainer& outputContainer)
const;
1170 template <
typename LayerContainer,
typename DropContainer,
typename ItWeight,
typename ItGradient>
1174 ItWeight itWeightBegin,
1175 ItWeight itWeightEnd,
1176 ItGradient itGradientBegin,
1177 ItGradient itGradientEnd,
1178 size_t& totalNumWeights)
const;
1180 template <
typename LayerContainer>
1182 std::vector<LayerData>& layerData)
const;
1185 template <
typename LayerContainer,
typename LayerPatternContainer>
1187 LayerPatternContainer& layerPatternData,
1188 std::vector<double>& valuesMean,
1189 std::vector<double>& valuesStdDev,
1190 size_t trainFromLayer)
const;
1192 template <
typename OutputContainer>
1195 template <
typename OutputContainer>
1196 void fetchOutput (
const std::vector<LayerData>& layerPatternData, OutputContainer& outputContainer)
const;
1199 template <
typename ItWeight>
1201 std::vector<LayerData>& lastLayerData,
1203 ItWeight itWeightBegin,
1204 ItWeight itWeightEnd)
const;
1206 template <
typename Settings>
1207 void backPropagate (std::vector<std::vector<LayerData>>& layerPatternData,
1209 size_t trainFromLayer,
1210 size_t totalNumWeights)
const;
1218 template <
typename LayerContainer,
typename PassThrough,
typename ItWeight,
typename ItGradient,
typename OutContainer>
1220 ItWeight itWeightBegin, ItWeight itWeightEnd,
1221 ItGradient itGradientBegin, ItGradient itGradientEnd,
1222 size_t trainFromLayer,
1223 OutContainer& outputContainer,
bool fetchOutput)
const;
1235 template <
typename Container,
typename ItWeight>
1239 ItWeight itWeightEnd,
1240 double patternWeight,
1241 double factorWeightDecay,
1258 template <
typename OutIterator>
1260 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
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
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)
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:
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)