question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IndexError during compute_residuals

See original GitHub issue

Hi Cam,

I successfully fitted a survival regression (CoxPHFitter) on my data. However, I cannot compute the shoenfeld (_compute_schoenfeld called by residuals = self.compute_residuals(training_df, kind="scaled_schoenfeld")) and get the following error:

df = pd.DataFrame(schoenfeld_residuals[E, :], columns=self.hazards_.columns, index=index[E])
IndexError: boolean index did not match indexed array along dimension 0; dimension is 3654 but corresponding boolean dimension is 3743

The error come from schoenfeld_residuals[E, :] with schoenfeld_residuals of shape (3654, 6) and E (3743,).

I guess E correspond to the event and this a censorship issue?

This seems related to this issue.

By the way, thank you very much for lifelines–I didn’t know much on survival analysis and was ready in no time thank to the clear api and docs.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
CamDavidsonPiloncommented, Jan 24, 2019

AFAIK, this is fixed

0reactions
romainmartinezcommented, Jan 25, 2019

Everything is working fine with the fix, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

IndexError: index 1 is out of bounds for axis 0 with size 1. and ...
Cb has length 1 on shape[0], therefore that causes an index out of bound exception when i reached value 1.
Read more >
OpenMDAO/group.py at master - GitHub
Object used to allocate MPI processes to subsystems. _proc_info : dict of subsys_name: (min_procs, max_procs, weight, proc_group). Information used to determine ...
Read more >
Python indexerror: list index out of range Solution
In this tutorial, we're going to talk about the “indexerror: list index out of range” error. We'll discuss how it works and walk...
Read more >
Source code for pint.residuals
Source code for pint.residuals. """Objects for comparing models to data. These objects can be constructed directly, as ``Residuals(toas, model)``, ...
Read more >
COMP1730/COMP6730: Programming for Scientists
Indexing is done by writing the index in square brackets after the sequence value, like so: ... IndexError: list index out of bounds...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found