From 8332c9aa98f2cdb2f454b744189ec666b04813f4 Mon Sep 17 00:00:00 2001 From: AMBUJ MISHRA Date: Mon, 6 Jan 2025 10:35:02 +0530 Subject: [PATCH] correcting zero devision error (#50) --- src/profiles-pycorelib/attribution_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/profiles-pycorelib/attribution_model.py b/src/profiles-pycorelib/attribution_model.py index dff2020..ce26331 100755 --- a/src/profiles-pycorelib/attribution_model.py +++ b/src/profiles-pycorelib/attribution_model.py @@ -151,7 +151,7 @@ def _converge(self, transition_matrix, max_iters=40, verbose=False): def _get_removal_affects(self, transition_probs, labels, ignore_labels=["Start", "Dropoff","Converted"], default_conversion=1.): removal_affect = {} for n, label in enumerate(labels): - if n % (len(labels)//10) == 0: + if n % max((len(labels)//10), 1) == 0: self.logger.info(f"Computing removal affects: {n/len(labels)*100:.2f}%") if label in ignore_labels: continue