From a1346e1943ebd622da368e93e067dbffb2cefeb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Monta=C3=B1ana=20G=C3=B3mez?= Date: Mon, 24 Jun 2024 10:55:26 +0200 Subject: [PATCH] Fix Error in percentile method --- BinDisc.cpp | 2 +- Discretizer.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BinDisc.cpp b/BinDisc.cpp index 626b908..551192c 100644 --- a/BinDisc.cpp +++ b/BinDisc.cpp @@ -58,7 +58,7 @@ namespace mdlp { results.reserve(percentiles.size()); for (auto percentile : percentiles) { const size_t i = static_cast(std::floor(static_cast(data.size() - 1) * percentile / 100.)); - const auto indexLower = clip(i, 0, data.size() - 1); + const auto indexLower = clip(i, 0, data.size() - 2); const double percentI = static_cast(indexLower) / static_cast(data.size() - 1); const double fraction = (percentile / 100.0 - percentI) / diff --git a/Discretizer.h b/Discretizer.h index 2a8593c..9749af8 100644 --- a/Discretizer.h +++ b/Discretizer.h @@ -18,7 +18,7 @@ namespace mdlp { void fit_t(torch::Tensor& X_, torch::Tensor& y_); torch::Tensor transform_t(torch::Tensor& X_); torch::Tensor fit_transform_t(torch::Tensor& X_, torch::Tensor& y_); - static inline std::string version() { return "1.2.1"; }; + static inline std::string version() { return "1.2.2"; }; protected: labels_t discretizedData = labels_t(); cutPoints_t cutPoints;