25template<
typename Real_t>
34 for (
size_t i = 0; i <
m; i++) {
35 for (
size_t j = 0; j <
n; j++) {
36 result += std::abs(W(i,j));
43template<
typename Real_t>
54 for (
size_t i = 0; i <
m; i++) {
55 for (
size_t j = 0; j <
n; j++) {
56 sign = (W(i,j) > 0.0) ? 1.0 : -1.0;
63template<
typename Real_t>
72 for (
size_t i = 0; i <
m; i++) {
73 for (
size_t j = 0; j <
n; j++) {
74 result += W(i,j) * W(i,j);
81template<
typename Real_t>
90 for (
size_t i = 0; i <
m; i++) {
91 for (
size_t j = 0; j <
n; j++) {
static void AddL1RegularizationGradients(TMatrixT< AReal > &A, const TMatrixT< AReal > &W, AReal weightDecay)
static AReal L2Regularization(const TMatrixT< AReal > &W)
static AReal L1Regularization(const TMatrixT< AReal > &W)
static void AddL2RegularizationGradients(TMatrixT< AReal > &A, const TMatrixT< AReal > &W, AReal weightDecay)
double weightDecay(double error, ItWeight itWeight, ItWeight itWeightEnd, double factorWeightDecay, EnumRegularization eRegularization)
compute the weight decay for regularization (L1 or L2)
create variable transformations