AssertionError during c-index computation
- Dominant language
- Python
- Stars
- 995
- Forks
- 203
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I ran into the following assertion error when computing the c-index for the discrete MTLR method.
`assert durations.shape[0] == surv.shape[1] == surv_idx.shape[0] == events.shape[0]`
I suppose the error is due to the fact that the maximum of test durations is 1628***, while the function gets in input a number between 0 and 490. This range (0, 490) is the result of applying the following:
```
num_durations = 50
scheme = 'quantiles'
labtrans = MTLR.label_transform(num_durations, scheme)
```
and
`surv = model.interpolate(10).predict_surv_df(x_test)`
As the parameter of the function `interpolate` increases, the number of grid points also increases and viceversa. It is a multiplication between `num_durations` and the parameter of the function `interpolate`.
In the example I followed step by step, it was also pointed out that in the plot "the time scale is correct because we have set model.duration_index to be the grid points".
Thanks in advance,
Luca
*** EDIT: I hadn't read the error carefully and now I understood what I was wrong (I partially saved the df deriving from `surv` and then applied the c-index on the entire test set). Unfortunately, I still haven't figured out how to fix the time scale problem in discrete models.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with MTLR.label_transform, model.interpolate(10), predict_surv_df(x_test), and the c-index assertion described in the report. Trace how discrete-model duration grids are produced and used, then verify that the plotted and evaluated time scales match the original durations without triggering the shape mismatch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100