From e03efb5f63371d4db10dc6a8864cf85393c6cbe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Monta=C3=B1ana=20G=C3=B3mez?= Date: Tue, 14 Nov 2023 10:12:02 +0100 Subject: [PATCH] set tolerance=0 if feature selection in BoostAODE --- src/BayesNet/BoostAODE.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/BayesNet/BoostAODE.cc b/src/BayesNet/BoostAODE.cc index e88a4da..b46c568 100644 --- a/src/BayesNet/BoostAODE.cc +++ b/src/BayesNet/BoostAODE.cc @@ -108,8 +108,10 @@ namespace bayesnet { void BoostAODE::trainModel(const torch::Tensor& weights) { 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,7 @@ 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