From 610c2a6a4a1e480c7ceb597892f93fa06842cd76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Monta=C3=B1ana=20G=C3=B3mez?= Date: Thu, 27 Feb 2025 11:37:30 +0100 Subject: [PATCH] Continue refactoring --- src/experimental_clfs/ExpClf.h | 1 - src/experimental_clfs/Xaode.hpp | 8 +------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/experimental_clfs/ExpClf.h b/src/experimental_clfs/ExpClf.h index 5d28991..82098ba 100644 --- a/src/experimental_clfs/ExpClf.h +++ b/src/experimental_clfs/ExpClf.h @@ -46,7 +46,6 @@ namespace platform { bool debug = false; Xaode aode_; torch::Tensor weights_; - bool fitted = false; const std::string CLASSIFIER_NOT_FITTED = "Classifier has not been fitted"; inline void normalize_weights(int num_instances) { diff --git a/src/experimental_clfs/Xaode.hpp b/src/experimental_clfs/Xaode.hpp index cb021e0..7ff6270 100644 --- a/src/experimental_clfs/Xaode.hpp +++ b/src/experimental_clfs/Xaode.hpp @@ -182,7 +182,6 @@ namespace platform { } } } - // ------------------------------------------------------- // computeProbabilities // ------------------------------------------------------- @@ -257,7 +256,6 @@ namespace platform { } matrixState_ = MatrixState::PROBS; } - // ------------------------------------------------------- // predict_proba_spode // ------------------------------------------------------- @@ -372,10 +370,7 @@ namespace platform { } void normalize(std::vector& probs) const { - double sum = 0; - for (double d : probs) { - sum += d; - } + double sum = std::accumulate(probs.begin(), probs.end(), 0.0); if (std::isnan(sum)) { throw std::runtime_error("Can't normalize array. Sum is NaN."); } @@ -420,7 +415,6 @@ namespace platform { active_parents.pop_back(); } - private: // ----------- // MEMBER DATA