18#ifndef TMVA_DNN_FUNCTIONS
19#define TMVA_DNN_FUNCTIONS
95template<
typename Architecture_t>
96inline void evaluate(
typename Architecture_t::Matrix_t &
A,
121template<
typename Architecture_t>
124 const typename Architecture_t::Matrix_t &
A)
152template<
typename Architecture_t>
153inline void evaluate(
typename Architecture_t::Matrix_t &
A,
155 const typename Architecture_t::Matrix_t &X)
175template <
typename Architecture_t>
177 const typename Architecture_t::Matrix_t &
output,
const typename Architecture_t::Matrix_t &weights)
178 ->
decltype(Architecture_t::CrossEntropy(Y,
output, weights))
192template <
typename Architecture_t>
194 const typename Architecture_t::Matrix_t &Y,
195 const typename Architecture_t::Matrix_t &
output,
196 const typename Architecture_t::Matrix_t &weights)
203 Architecture_t::SoftmaxCrossEntropyGradients(dY, Y,
output, weights);
215template<
typename Architecture_t>
218->
decltype(Architecture_t::L1Regularization(
A))
225 return Architecture_t::L1Regularization(
A);
227 return Architecture_t::L2Regularization(
A);
235template<
typename Architecture_t>
237 const typename Architecture_t::Matrix_t &W,
246 Architecture_t::AddL1RegularizationGradients(
A, W,
weightDecay);
249 Architecture_t::AddL2RegularizationGradients(
A, W,
weightDecay);
259template<
typename Architecture_t>
#define R(a, b, c, d, e, f, g, h, i)
void Copy(void *source, void *dest)
std::shared_ptr< std::function< double(double)> > Tanh
EOptimizer
Enum representing the optimizer used for training.
void addRegularizationGradients(typename Architecture_t::Matrix_t &A, const typename Architecture_t::Matrix_t &W, typename Architecture_t::Scalar_t weightDecay, ERegularization R)
Add the regularization gradient corresponding to weight matrix W, to the matrix A.
EOutputFunction
Enum that represents output functions.
double weightDecay(double error, ItWeight itWeight, ItWeight itWeightEnd, double factorWeightDecay, EnumRegularization eRegularization)
compute the weight decay for regularization (L1 or L2)
void evaluate(typename Architecture_t::Matrix_t &A, EActivationFunction f)
Apply the given activation function to each value in the given matrix A.
auto regularization(const typename Architecture_t::Matrix_t &A, ERegularization R) -> decltype(Architecture_t::L1Regularization(A))
Evaluate the regularization functional for a given weight matrix.
ERegularization
Enum representing the regularization type applied for a given layer.
EActivationFunction
Enum that represents layer activation functions.
ELossFunction
Enum that represents objective functions for the net, i.e.
std::shared_ptr< std::function< double(double)> > Gauss
std::shared_ptr< std::function< double(double)> > Sigmoid
void evaluateGradients(typename Architecture_t::Matrix_t &dY, ELossFunction f, const typename Architecture_t::Matrix_t &Y, const typename Architecture_t::Matrix_t &output, const typename Architecture_t::Matrix_t &weights)
Compute the gradient of the given output function f for given activations output of the output layer ...
void evaluateDerivative(typename Architecture_t::Matrix_t &B, EActivationFunction f, const typename Architecture_t::Matrix_t &A)
Compute the first partial derivative of the activation function for the values given in matrix A and ...
std::shared_ptr< std::function< double(double)> > SoftSign
void initialize(typename Architecture_t::Matrix_t &A, EInitialization m)
create variable transformations
static void output(int code)