From 1e2078f428a2e24a861bc6a316619b397df7a7a3 Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 10 Feb 2023 14:15:49 +0100 Subject: [PATCH] Fixed warnings in SoftMaxReg. --- mlpp/softmax_reg/softmax_reg.cpp | 9 +++++---- mlpp/softmax_reg/softmax_reg.h | 3 --- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/mlpp/softmax_reg/softmax_reg.cpp b/mlpp/softmax_reg/softmax_reg.cpp index ea6becf..eb24edb 100644 --- a/mlpp/softmax_reg/softmax_reg.cpp +++ b/mlpp/softmax_reg/softmax_reg.cpp @@ -14,7 +14,6 @@ #include #include - MLPPSoftmaxReg::MLPPSoftmaxReg(std::vector> inputSet, std::vector> outputSet, std::string reg, real_t lambda, real_t alpha) : inputSet(inputSet), outputSet(outputSet), n(inputSet.size()), k(inputSet[0].size()), n_class(outputSet[0].size()), reg(reg), lambda(lambda), alpha(alpha) { y_hat.resize(n); @@ -120,7 +119,9 @@ void MLPPSoftmaxReg::MBGD(real_t learning_rate, int max_epoch, int mini_batch_si // Creating the mini-batches int n_mini_batch = n / mini_batch_size; - auto [inputMiniBatches, outputMiniBatches] = MLPPUtilities::createMiniBatches(inputSet, outputSet, n_mini_batch); + auto batches = MLPPUtilities::createMiniBatches(inputSet, outputSet, n_mini_batch); + auto inputMiniBatches = std::get<0>(batches); + auto outputMiniBatches = std::get<1>(batches); while (true) { for (int i = 0; i < n_mini_batch; i++) { @@ -154,12 +155,12 @@ void MLPPSoftmaxReg::MBGD(real_t learning_rate, int max_epoch, int mini_batch_si } real_t MLPPSoftmaxReg::score() { - MLPPUtilities util; + MLPPUtilities util; return util.performance(y_hat, outputSet); } void MLPPSoftmaxReg::save(std::string fileName) { - MLPPUtilities util; + MLPPUtilities util; util.saveParameters(fileName, weights, bias); } diff --git a/mlpp/softmax_reg/softmax_reg.h b/mlpp/softmax_reg/softmax_reg.h index 0d9747a..d477bde 100644 --- a/mlpp/softmax_reg/softmax_reg.h +++ b/mlpp/softmax_reg/softmax_reg.h @@ -13,8 +13,6 @@ #include #include - - class MLPPSoftmaxReg { public: MLPPSoftmaxReg(std::vector> inputSet, std::vector> outputSet, std::string reg = "None", real_t lambda = 0.5, real_t alpha = 0.5); @@ -49,5 +47,4 @@ private: real_t alpha; /* This is the controlling param for Elastic Net*/ }; - #endif /* SoftmaxReg_hpp */