Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jpansnap committed Nov 15, 2023
1 parent 9ce214c commit 5232d8d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions causalml/metrics/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,17 @@ def get_cumlift(
sorted_df["cumsum_tr"] = sorted_df[treatment_col].cumsum()
sorted_df["cumsum_ct"] = sorted_df.index.values - sorted_df["cumsum_tr"]
sorted_df["cumsum_y_tr"] = (
sorted_df[outcome_col] * sorted_df[treatment_col]
).fillna(0).cumsum(skipna=True).astype(float)
(sorted_df[outcome_col] * sorted_df[treatment_col])
.fillna(0)
.cumsum(skipna=True)
.astype(float)
)
sorted_df["cumsum_y_ct"] = (
sorted_df[outcome_col] * (1 - sorted_df[treatment_col])
).fillna(0).cumsum(skipna=True).astype(float)
(sorted_df[outcome_col] * (1 - sorted_df[treatment_col]))
.fillna(0)
.cumsum(skipna=True)
.astype(float)
)

lift.append(
sorted_df["cumsum_y_tr"] / sorted_df["cumsum_tr"]
Expand Down

0 comments on commit 5232d8d

Please sign in to comment.