| 196 | return max_time, y |
| 197 | |
| 198 | def get_bins_time_value(df, n_bins, time_col_name, label_time_col_name='disc_label', censorship_col_name='censorship'): |
| 199 | # Retrieve the values of each bin from the dataset. |
| 200 | # Note that this was done on the uncensored cases. |
| 201 | uncensored_df = df[df[censorship_col_name]==0] |
| 202 | labels, q_bins = pd.qcut(uncensored_df[time_col_name], q=n_bins, retbins=True, labels=False) |
| 203 | q_bins[0] = 0 |
| 204 | q_bins[-1] = float('inf') |
| 205 | |
| 206 | # Current q_bins list length == n bins + 1. There is no need to return q_bins[0]==0. |
| 207 | return q_bins[1::] |
| 208 | |
| 209 | def compute_surv_metrics_eval( |
| 210 | bins_values, |