diff --git a/CHANGELOG.md b/CHANGELOG.md
index be54df2..e258e89 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Sample app now is a separate target in the Makefile and shows how to use the library with a sample dataset
+- The worse model count in BoostAODE is reset to 0 every time a new model produces better accuracy, so the tolerance of the model is meant to be the number of **consecutive** models that produce worse accuracy.
## [1.0.4] 2024-03-06
diff --git a/README.md b/README.md
index 8fa88e8..e227b0b 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# BayesNet
-
-[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
+![C++](https://img.shields.io/badge/c++-%2300599C.svg?style=flat&logo=c%2B%2B&logoColor=white)
+[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)]()
![Gitea Release](https://img.shields.io/gitea/v/release/rmontanana/bayesnet?gitea_url=https://gitea.rmontanana.es:3000)
![Gitea Last Commit](https://img.shields.io/gitea/last-commit/rmontanana/bayesnet?gitea_url=https://gitea.rmontanana.es:3000&logo=gitea)
diff --git a/bayesnet/ensembles/BoostAODE.cc b/bayesnet/ensembles/BoostAODE.cc
index 1d16f1c..400169d 100644
--- a/bayesnet/ensembles/BoostAODE.cc
+++ b/bayesnet/ensembles/BoostAODE.cc
@@ -216,7 +216,7 @@ namespace bayesnet {
double priorAccuracy = 0.0;
double delta = 1.0;
double convergence_threshold = 1e-4;
- int count = 0; // number of times the accuracy is lower than the convergence_threshold
+ int worse_model_count = 0; // number of times the accuracy is lower than the convergence_threshold
// Step 0: Set the finish condition
// if not repeatSparent a finish condition is run out of features
// n_models == maxModels
@@ -274,11 +274,13 @@ namespace bayesnet {
delta = accuracy - priorAccuracy;
}
if (delta < convergence_threshold) {
- count++;
+ worse_model_count++;
+ } else {
+ worse_model_count = 0; // Reset the counter if the model performs better
}
priorAccuracy = accuracy;
}
- exitCondition = n_models >= maxModels && repeatSparent || count > tolerance;
+ exitCondition = n_models >= maxModels && repeatSparent || worse_model_count > tolerance;
}
if (featuresUsed.size() != features.size()) {
notes.push_back("Used features in train: " + std::to_string(featuresUsed.size()) + " of " + std::to_string(features.size()));