@@ -317,8 +317,8 @@ def _total_uplift_expected_power_with_standard_error(
317
317
df_ , test_cols = test_cols , bin_cols_with_df_name = bin_cols_with_df_name
318
318
)
319
319
320
- # with pl.Config(tbl_cols=-1):
321
- # print(df_cov)
320
+ with pl .Config (tbl_cols = - 1 ):
321
+ print (df_cov )
322
322
323
323
# In current version of code, covarariances are either set to 0 or set to
324
324
# product of variances
@@ -368,8 +368,8 @@ def _total_uplift_expected_power_with_standard_error(
368
368
bin_cols_without_df_name = bin_cols_without_df_name ,
369
369
)
370
370
371
- # with pl.Config(tbl_cols=-1):
372
- # print(df_bin)
371
+ with pl .Config (tbl_cols = - 1 ):
372
+ print (df_bin )
373
373
374
374
# Join the covariance dataframe to df_bin
375
375
df_bin = df_bin .join (df_cov , on = bin_cols_with_df_name , how = "left" )
@@ -463,9 +463,21 @@ def _total_uplift_expected_power_with_standard_error(
463
463
# pow_farm_var
464
464
df_sub = df_sub .pivot (
465
465
on = "df_name" ,
466
- index = bin_cols_without_df_name + ["weight" ],
466
+ index = bin_cols_without_df_name , # + ["weight"],
467
467
)
468
468
469
+ # Assign the weight column to be the mean of weight_[uplift_pair[0]]
470
+ # and weight_[uplift_pair[1]]
471
+ df_sub = df_sub .with_columns (
472
+ weight = (pl .col (f"weight_{ uplift_pair [0 ]} " ) + pl .col (f"weight_{ uplift_pair [1 ]} " )) / 2
473
+ )
474
+
475
+ # Remove the weight_pair columns
476
+ df_sub = df_sub .drop ([f"weight_{ uplift_pair [0 ]} " , f"weight_{ uplift_pair [1 ]} " ])
477
+
478
+ with pl .Config (tbl_cols = - 1 ):
479
+ print (df_sub )
480
+
469
481
# Compute the expected power ratio per bin
470
482
df_sub = df_sub .with_columns (
471
483
expected_power_ratio = pl .col (f"pow_farm_{ uplift_pair [1 ]} " )
0 commit comments