Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add return_array argument to CoxPHSurvivalAnalysis().predict_survival_function #268

Closed
rv-apuri opened this issue May 14, 2022 · 2 comments · Fixed by #289
Closed

Add return_array argument to CoxPHSurvivalAnalysis().predict_survival_function #268

rv-apuri opened this issue May 14, 2022 · 2 comments · Fixed by #289

Comments

@rv-apuri
Copy link

Is your feature request related to a problem? Please describe.
It is mildly frustrating that the predict_survival_function for CoxPHSurvivalAnalysis() does not take in the return_array argument in the same way as RandomSurvivalForest().predict_survival_function does

Describe the solution you'd like

estimator = CoxPHSurvivalAnalysis().fit(X, y)
survs = estimator.predict_survival_function(X.iloc[:5], return_array=True)

survs should be an ndarray containing the values from the step function

Describe alternatives you've considered
A quick workaround to get the array is below:

estimator = CoxPHSurvivalAnalysis().fit(X, y)
funcs = estimator.predict_survival_function(X.iloc[:5])
survs = np.array([f(f.x) for f in funcs])

References and existing implementations
If you want to propose a new algorithm for inclusion, please include the original reference to the publication that first proposed the algorithm. If you are aware of any existing implementations, e.g. for R, please include a link too.

@sebp
Copy link
Owner

sebp commented May 27, 2022

I agree that this would be quite useful.

sebp added a commit that referenced this issue Aug 15, 2022
Modifies predict_survival_function and predict_cumulative_hazard_function

Fixes #268
sebp added a commit that referenced this issue Aug 15, 2022
Modifies predict_survival_function and predict_cumulative_hazard_function

Fixes #268
@sebp sebp closed this as completed in #289 Aug 15, 2022
@rv-apuri
Copy link
Author

Thank you so much!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants