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

Feature: add support for computing SurvSHAP using treeshap-algorithm #75

Closed
2 tasks done
kapsner opened this issue Apr 6, 2023 · 2 comments
Closed
2 tasks done

Comments

@kapsner
Copy link
Contributor

kapsner commented Apr 6, 2023

The purpose of this formal feature request is mainly for a documentation of ongoing works and to avoid duplicate efforts.

I've started to work on implementing support for computing SurvSHAP values using the treeshap algorithm in this fork of survex.

As of now, both, local and global computation of SurvSHAP values using the ranger algorithm work technically.

Statistical / mathematical correctness needs yet to be proven for:

  • computation of predictions of the survival probability at different time points using treeshap
    • see this issue
    • related code is located here
    • one possibly required enhancement includes to use the stepfunction logic from here in the treeshap-package to apply it to the predictions from ranger in order to address that currently, only the time-points that are computed internally by ranger are used for computing the survival probabilities (see here), which results in this code in survex and which is some kind of a workaround currently
  • calculation of aggregated "global" survshap values for each time-point and feature across multiple observations
kapsner added a commit to kapsner/treeshap that referenced this issue Apr 8, 2023
kapsner added a commit to kapsner/survex that referenced this issue Apr 8, 2023
@kapsner
Copy link
Contributor Author

kapsner commented Apr 8, 2023

Regarding the computation of the prediction of the survival probability at predefined time points using treeshap, the latest code adaptions seem to work well: the SurvSHAP-plot computed with treeshap produces very similar results compared to the one computed with kernelshap (but computation with treeshap was faster).

Plot with Treeshap (code-ref https://github.com/kapsner/survex/blob/d2c16a608792c6387b2e65890446521890d088e0/tests/testthat/test-predict_parts.R#L122):
surv_treeshap

Plot with Kernelshap (code-ref https://github.com/kapsner/survex/blob/d2c16a608792c6387b2e65890446521890d088e0/tests/testthat/test-predict_parts.R#L137):
surv_kernelshap

pbiecek pushed a commit to ModelOriented/treeshap that referenced this issue May 11, 2023
…ta with {ranger} (#26)

* feat: implementing shap for survival function

* fix: fixed ranger_surv_fun

* refactor: harmonized code for ranger_surv into one function with argument type

* docs: added ranger_surv.unify to description

* feat: added support for evaluation at pre-specified survival time points

addresses comment from ModelOriented/survex#75

* fix: changed list names to eval-times when providing time points to ranger_surv.unify(type=survival)

* chore: more informative error messages to stopifnot

* chore: replaced seq_len with seq_along
kapsner added a commit to kapsner/survex that referenced this issue Jul 24, 2023
- make model_survshap working with new data that was not use to build explainer
- documentation of model_survshap
- minor error handling enhancements
- added unit-tests for global survshap
- removed global survshap tests from test-predict-parts
addresses ModelOriented#75
kapsner added a commit to kapsner/survex that referenced this issue Jul 25, 2023
- removed data.table parts
- updated error handling
- added unit tests for treeshap (both, local and global shap)

addresses ModelOriented#75
@mikolajsp
Copy link
Collaborator

Completed in #87

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

No branches or pull requests

2 participants