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

Expose most important reason codes in Py/R & MOJO #7708

Closed
exalate-issue-sync bot opened this issue May 11, 2023 · 2 comments
Closed

Expose most important reason codes in Py/R & MOJO #7708

exalate-issue-sync bot opened this issue May 11, 2023 · 2 comments
Assignees

Comments

@exalate-issue-sync
Copy link

A lot of user like shapley so they can see the top n (+bottom n) reason codes and the actual value of that column - eg.: age increased prediction by x amount and their age was 40 [~accountid:557058:f0137791-c6cb-47bd-bcce-fc81ad4cfefa]

This should be available in Py/R, input frame output frame* and also in MOJO on a per-row basis.

*See screenshot for proposed output structure.

@exalate-issue-sync
Copy link
Author

Adam Valenta commented: I adjusted current interface

{code:python}model.predict_contributions(data){code}

to accept top_n, top_bottom_n and abs_val (compare as absolute values). R and MOJOs are similar. Old behaviour (top_n=0, top_bottom_n=0 and abs_val=False) is untouched.

{code:python}:param top_n: Return only #top_n highest contributions + bias.
:param top_bottom_n: Return only #top_bottom_n lowest contributions + bias
If top_n and top_bottom_n are defined together then return array of #top_n + #top_bottom_n + bias
:param abs_val: True to compare absolute values of contributions{code}


{noformat}pros_gbm.predict_contributions(prostate,top_n=2){noformat}

||top_feature_1||top_value_1||top_feature_2||top_value_2||BiasTerm||
|VOL|0.176247|RACE|0.0313198|-0.625094|


{noformat}pros_gbm.predict_contributions(prostate,top_bottom_n=2){noformat}

||bottom_top_feature_1||bottom_top_value_1||bottom_top_feature_2||bottom_top_value_2||BiasTerm||
|PSA|-0.664325|GLEASON|-0.438402|-0.625094|


{code:python}pros_gbm.predict_contributions(prostate,top_n=2, top_bottom_n=2){code}

||top_feature_1||top_value_1||top_feature_2||top_value_2||bottom_top_feature_1||bottom_top_value_1||bottom_top_feature_2||bottom_top_value_2||BiasTerm||
|VOL|0.176247|RACE|0.0313198|PSA|-0.664325|GLEASON|-0.438402|-0.625094|


For all values user can use setup top_n=-1 or top_bottom_n=-1.

{noformat}pros_gbm.predict_contributions(prostate,top_n=-1){noformat}

||top_feature_1||top_value_1||top_feature_2||top_value_2||top_feature_3||top_value_3||top_feature_4||top_value_4||top_feature_5||top_value_5||top_feature_6||top_value_6||top_feature_7||top_value_7||BiasTerm||
|VOL|0.176247|RACE|0.0313198|DCAPS|-0.0169935|DPROS|-0.0204504|AGE|-0.370221|GLEASON|-0.438402|PSA|-0.664325|-0.625094|

@h2o-ops
Copy link
Collaborator

h2o-ops commented May 14, 2023

JIRA Issue Migration Info

Jira Issue: PUBDEV-7937
Assignee: Adam Valenta
Reporter: Michal Kurka
State: Resolved
Fix Version: 3.34.0.1
Attachments: Available (Count: 1)
Development PRs: Available

Linked PRs from JIRA

#5493
#5494
#5504
#5508
#5582
#5233

Attachments From Jira

Attachment Name: image (10).png
Attached By: Michal Kurka
File Link:https://h2o-3-jira-github-migration.s3.amazonaws.com/PUBDEV-7937/image (10).png

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

No branches or pull requests

2 participants