From 1b93b7503e25c836f692668b97f0385290153fb0 Mon Sep 17 00:00:00 2001 From: LIU SHAOFAN <35169698+Fanshaoliu@users.noreply.github.com> Date: Thu, 28 Dec 2023 17:03:32 +0800 Subject: [PATCH] Update eval.py, fix a minor bug Dividing by an additional N does not affect the trend of the curve, but it makes the Adjusted Qini and Cgain curves very similar on data where the control and treatment groups are relatively evenly distributed (after sorted by uplift value), making the two curves difficult to distinguish and prone to misunderstanding. --- pylift/eval.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylift/eval.py b/pylift/eval.py index a44d36a..7bdd09b 100644 --- a/pylift/eval.py +++ b/pylift/eval.py @@ -602,7 +602,7 @@ def cumulative_subset_func(i): y_calculating_functions = { 'qini': lambda nt1o1, nt0o1, nt1, nt0: nt1o1/self.N_treat - nt0o1/self.N_contr, 'aqini': lambda nt1o1, nt0o1, nt1, nt0: nt1o1/self.N_treat - nt0o1*nt1/(nt0*self.N_treat + EPS), - 'cgains': lambda nt1o1, nt0o1, nt1, nt0: (nt1o1/(nt1+EPS)- nt0o1/(nt0+EPS))*(nt1+nt0)/self.N, + 'cgains': lambda nt1o1, nt0o1, nt1, nt0: (nt1o1/(nt1+EPS)- nt0o1/(nt0+EPS))*(nt1+nt0), 'cuplift': lambda nt1o1, nt0o1, nt1, nt0: nt1o1/(nt1+EPS) - nt0o1/(nt0+EPS), 'uplift': lambda nt1o1, nt0o1, nt1, nt0: nt1o1/(nt1+EPS) - nt0o1/(nt0+EPS), 'balance': lambda nt1o1, nt0o1, nt1, nt0: nt1/(nt0+nt1+EPS)