18 #ifndef TMVA_DNN_FUNCTIONS 19 #define TMVA_DNN_FUNCTIONS 84 template<
typename Architecture_t>
85 inline void evaluate(
typename Architecture_t::Matrix_t &
A,
110 template<
typename Architecture_t>
113 const typename Architecture_t::Matrix_t &
A)
141 template<
typename Architecture_t>
142 inline void evaluate(
typename Architecture_t::Matrix_t &
A,
144 const typename Architecture_t::Matrix_t &
X)
164 template<
typename Architecture_t>
166 const typename Architecture_t::Matrix_t &
Y,
167 const typename Architecture_t::Matrix_t &
output)
168 -> decltype(Architecture_t::CrossEntropy(
Y,
output))
173 return Architecture_t::CrossEntropy(
Y,
output);
175 return Architecture_t::MeanSquaredError(
Y,
output);
177 return Architecture_t::SoftmaxCrossEntropy(
Y,
output);
185 template<
typename Architecture_t>
188 const typename Architecture_t::Matrix_t &
Y,
189 const typename Architecture_t::Matrix_t &
output)
194 Architecture_t::CrossEntropyGradients(dY, Y, output);
197 Architecture_t::MeanSquaredErrorGradients(dY, Y, output);
200 Architecture_t::SoftmaxCrossEntropyGradients(dY, Y, output);
212 template<
typename Architecture_t>
215 -> decltype(Architecture_t::L1Regularization(
A))
222 return Architecture_t::L1Regularization(
A);
224 return Architecture_t::L2Regularization(
A);
232 template<
typename Architecture_t>
234 const typename Architecture_t::Matrix_t &W,
243 Architecture_t::AddL1RegularizationGradients(A, W, weightDecay);
246 Architecture_t::AddL2RegularizationGradients(A, W, weightDecay);
256 template<
typename Architecture_t>
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 ...
static std::shared_ptr< std::function< double(double)> > Tanh
void evaluate(typename Architecture_t::Matrix_t &A, EActivationFunction f)
Apply the given activation function to each value in the given matrix A.
static 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)
Compute the gradient of the given output function f for given activations output of the output layer ...
double weightDecay(double error, ItWeight itWeight, ItWeight itWeightEnd, double factorWeightDecay, EnumRegularization eRegularization)
compute the weight decay for regularization (L1 or L2)
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.
static std::shared_ptr< std::function< double(double)> > SoftSign
void Copy(void *source, void *dest)
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.
ELossFunction
Enum that represents objective functions for the net, i.e.
static std::shared_ptr< std::function< double(double)> > Gauss
Abstract ClassifierFactory template that handles arbitrary types.
ERegularization
Enum representing the regularization type applied for a given layer.
EActivationFunction
Enum that represents layer activation functions.
void initialize(typename Architecture_t::Matrix_t &A, EInitialization m)