Skip to content

Commit b4394b0

Browse files
committed
📝 change ceil to int in uplift_at_k
1 parent 08e029d commit b4394b0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

sklift/metrics/metrics.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from math import ceil
21
import warnings
32
import numpy as np
43
from sklearn.utils.extmath import stable_cumsum
@@ -256,7 +255,7 @@ def uplift_at_k(y_true, uplift, strategy, treatment, k=0.3):
256255

257256
if strategy == 'overall':
258257
if k_type == 'f':
259-
n_size = ceil(n_samples * k)
258+
n_size = int(n_samples * k)
260259
else:
261260
n_size = k
262261

@@ -266,8 +265,8 @@ def uplift_at_k(y_true, uplift, strategy, treatment, k=0.3):
266265

267266
else: # strategy == 'by_group':
268267
if k_type == 'f':
269-
n_ctrl = ceil((treatment == 0).sum() * k)
270-
n_trmnt = ceil((treatment == 1).sum() * k)
268+
n_ctrl = int((treatment == 0).sum() * k)
269+
n_trmnt = int((treatment == 1).sum() * k)
271270

272271
else:
273272
n_ctrl = k

0 commit comments

Comments
 (0)