From 6181354f29181ae34637b7a52e7ed59d620fdf2f Mon Sep 17 00:00:00 2001 From: kiraplenkin Date: Sat, 17 Sep 2022 10:14:04 +0300 Subject: [PATCH] Add brackets to fix woe calculation --- woe_scoring/core/binning/functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/woe_scoring/core/binning/functions.py b/woe_scoring/core/binning/functions.py index eee2f94..b8dec6a 100644 --- a/woe_scoring/core/binning/functions.py +++ b/woe_scoring/core/binning/functions.py @@ -138,7 +138,7 @@ def _calc_stats( bad_rate = bad / total if total != 0 else 0 good = total - bad woe = np.log((good / all_good) / (bad / all_bad)) if good != 0 and bad != 0 else np.log( - (good + 0.5 / all_good) / (bad + 0.5 / all_bad) + ((good + 0.5) / all_good) / ((bad + 0.5) / all_bad) ) iv = ((good / all_good) - (bad / all_bad)) * woe return {