From e8d2c9fc0b847b2d0992e14dfd740286d1a6986c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Monta=C3=B1ana=20G=C3=B3mez?= Date: Fri, 17 Nov 2023 10:26:25 +0100 Subject: [PATCH] Set intolerant convergence --- src/BayesNet/BoostAODE.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/BayesNet/BoostAODE.cc b/src/BayesNet/BoostAODE.cc index aed067d..78b7a0d 100644 --- a/src/BayesNet/BoostAODE.cc +++ b/src/BayesNet/BoostAODE.cc @@ -108,8 +108,10 @@ namespace bayesnet { void BoostAODE::trainModel(const torch::Tensor& weights) { std::unordered_set featuresUsed; + int tolerance = 5; // number of times the accuracy can be lower than the threshold if (selectFeatures) { featuresUsed = initializeModels(); + tolerance = 0; // Remove tolerance if features are selected } if (maxModels == 0) maxModels = .1 * n > 10 ? .1 * n : n; @@ -119,7 +121,6 @@ namespace bayesnet { double priorAccuracy = 0.0; double delta = 1.0; double threshold = 1e-4; - int tolerance = 5; // number of times the accuracy can be lower than the threshold int count = 0; // number of times the accuracy is lower than the threshold fitted = true; // to enable predict // Step 0: Set the finish condition