CoxPHFitter attributes durations and event_observed reorder input indices
Shortly before presenting my model, I noticed that the CoxPHFitter() object has a nasty habit. When you use the attributes event_observed and durations (which one expects would be a regular occurrence, in order to pass durations into the predict_survival_function method), they return a random ordering of index, rather than that of the input data passed in.
I doubt that this is expected behaviour, but if it is, it's extremely annoying, because without doing much wrong it can completely randomise and invalidate your results, without the code erroring. I'm not sure why this happens but worth changing the methods to output in the same order as the input!
Quite right - this would be surprising for users. I'll rethink why we do this, likely it will change in the next release. Thanks @sam-lupton!
Thanks @CamDavidsonPilon and cheers for the library - it's a lifesaver in an underdeveloped area 👏