From bbe334856b9d2d3e3c9106e173dbf7159f4aaf07 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 4 Feb 2023 00:58:48 +0100 Subject: [PATCH] Use the new MLPPReg::RegularizationType instead of a String in MLPPHiddenLayer. --- mlpp/hidden_layer/hidden_layer.cpp | 2 +- mlpp/hidden_layer/hidden_layer.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mlpp/hidden_layer/hidden_layer.cpp b/mlpp/hidden_layer/hidden_layer.cpp index e027c9b..483c07e 100644 --- a/mlpp/hidden_layer/hidden_layer.cpp +++ b/mlpp/hidden_layer/hidden_layer.cpp @@ -27,7 +27,7 @@ void MLPPHiddenLayer::test(const Ref &x) { a_test = avn.run_activation_norm_matrix(activation, z_test); } -MLPPHiddenLayer::MLPPHiddenLayer(int p_n_hidden, MLPPActivation::ActivationFunction p_activation, Ref p_input, MLPPUtilities::WeightDistributionType p_weight_init, String p_reg, real_t p_lambda, real_t p_alpha) { +MLPPHiddenLayer::MLPPHiddenLayer(int p_n_hidden, MLPPActivation::ActivationFunction p_activation, Ref p_input, MLPPUtilities::WeightDistributionType p_weight_init, MLPPReg::RegularizationType p_reg, real_t p_lambda, real_t p_alpha) { n_hidden = p_n_hidden; activation = p_activation; diff --git a/mlpp/hidden_layer/hidden_layer.h b/mlpp/hidden_layer/hidden_layer.h index edf5d15..e833dc0 100644 --- a/mlpp/hidden_layer/hidden_layer.h +++ b/mlpp/hidden_layer/hidden_layer.h @@ -16,6 +16,7 @@ #include "../activation/activation.h" #include "../utilities/utilities.h" +#include "../regularization/reg.h" #include "../lin_alg/mlpp_matrix.h" #include "../lin_alg/mlpp_vector.h" @@ -45,7 +46,7 @@ public: Ref delta; // Regularization Params - String reg; + MLPPReg::RegularizationType reg; real_t lambda; /* Regularization Parameter */ real_t alpha; /* This is the controlling param for Elastic Net*/ @@ -54,7 +55,7 @@ public: void forward_pass(); void test(const Ref &x); - MLPPHiddenLayer(int p_n_hidden, MLPPActivation::ActivationFunction p_activation, Ref p_input, MLPPUtilities::WeightDistributionType p_weight_init, String p_reg, real_t p_lambda, real_t p_alpha); + MLPPHiddenLayer(int p_n_hidden, MLPPActivation::ActivationFunction p_activation, Ref p_input, MLPPUtilities::WeightDistributionType p_weight_init, MLPPReg::RegularizationType p_reg, real_t p_lambda, real_t p_alpha); MLPPHiddenLayer(); ~MLPPHiddenLayer();