How to interpret output of .predict from fitted scikit-survival model in python?
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
In scikit-survival, .predict() usually does not mean "predicted survival time" and it often does not mean a direct survival probability either. For many fitted models, .predict() returns a risk score or linear predictor that is meaningful mainly for ranking samples relative to one another.
Start with the Model Type
The meaning of .predict() depends on the estimator. A common example is CoxPHSurvivalAnalysis, where .predict() returns the linear risk score.
A small example:
These numbers are not survival probabilities between 0 and 1. They are risk scores. Higher scores generally indicate higher hazard and therefore worse expected survival, relative to lower scores.
What a Risk Score Means
For Cox-style models, the prediction is fundamentally about ordering, not about a direct event time estimate. If patient A has a higher score than patient B, patient A is interpreted as higher risk under the fitted model.
That means .predict() is useful for:
- ranking individuals by relative risk
- comparing one sample against another
- evaluation metrics such as concordance
It is not, by itself, the answer to questions like:
- what is the survival probability at 2 years
- what is the median survival time
- will the event definitely happen before time
t
Those require other prediction methods or further interpretation.
Use predict_survival_function for Survival Curves
If you want an estimated survival probability as a function of time, ask for the survival function explicitly.
Each returned function represents estimated survival over time. Here:
- '
fn.xcontains time points' - '
fn.ycontains survival probabilities at those times'
This is the right output when you need to say something like "the model estimates an 80 percent survival probability at a certain time point".
Use predict_cumulative_hazard_function for Hazard Accumulation
Another useful output is cumulative hazard.
Cumulative hazard is not the same as survival probability, but it is closely related and often used in survival-analysis workflows.
The key interpretation difference is:
- survival function decreases from near
1downward - cumulative hazard increases over time
If you are seeing increasing curves, you may be looking at cumulative hazard rather than survival.
Do Not Confuse Relative Risk with Absolute Probability
This is the most common mistake. A risk score from .predict() might be negative, positive, larger than 1, or smaller than 0. That does not mean the prediction is broken. It means the output is not a probability scale.
For example, these are all possible and still valid as relative risk scores:
The ordering matters more than the raw magnitude unless the model documentation gives a stronger interpretation.
Check the Estimator Documentation and API
Different scikit-survival estimators expose different prediction semantics. Before interpreting .predict(), verify whether the model returns:
- linear predictor
- risk score
- cumulative hazard score
- something estimator-specific
The safest workflow is:
- identify the estimator class
- inspect what
.predict()is documented to return - use
predict_survival_functionwhen you need time-dependent survival probabilities
That prevents a lot of misinterpretation.
Common Pitfalls
- Treating
.predict()output as a direct survival probability. - Assuming the result is a survival time estimate.
- Comparing raw scores across unrelated models as if they were on the same calibrated scale.
- Ignoring
predict_survival_functionwhen the actual question is about survival probability over time. - Forgetting that higher risk scores usually mean worse survival, not better survival.
Summary
- In scikit-survival,
.predict()often returns a relative risk score rather than a probability or time. - For Cox-type models, higher scores usually indicate higher hazard.
- Use
.predict()mainly for ranking and relative comparison. - Use
predict_survival_functionwhen you need survival probabilities across time. - Always interpret the prediction in the context of the specific estimator class.
Related reading
- How to invert a permutation array in numpy
- How to invoke the super constructor in Python?
- how to issue a show dbs from pymongo
- How to iterate over a list in chunks
- How to iterate over columns of a pandas dataframe
- How to iterate through Dictionary and change values?
- how to iterate through dictionary in a dictionary in django template?
- How to join two generators or other iterables in Python?
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.