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

New plot function #4

Closed
pbiecek opened this issue Nov 25, 2018 · 5 comments
Closed

New plot function #4

pbiecek opened this issue Nov 25, 2018 · 5 comments

Comments

@pbiecek
Copy link
Member

pbiecek commented Nov 25, 2018

Consider something like this

screen shot 2018-11-25 at 5 04 52 pm

x <- ive

x$`_vname_` <- reorder(x$`_vname_`, x$`_attribution_`, function(z) -sum(abs(z)))
levels(x$`_vname_`) <- paste(sapply(1:6, substr, x="        ", start=1), levels(x$`_vname_`))

ggplot(x, aes(x=`_vname_`, xend=`_vname_`, 
              yend = `_yhat_mean_`, y = `_yhat_mean_` + `_attribution_`, 
              color=`_sign_`)) +
  geom_segment(arrow = arrow(length=unit(0.30,"cm"), ends="first", type = "closed")) + 
  geom_text(aes(label = round(`_attribution_`, 2)), nudge_x = 0.45) +
  geom_segment(aes(x = "_predicted_",xend = "_predicted_",
                   y = `_yhat_`, yend = `_yhat_mean_`), size = 2, color="black",
               arrow = arrow(length=unit(0.30,"cm"), ends="first", type = "closed")) + 
  geom_text(aes(x = "_predicted_", 
                y = `_yhat_`, label = round(`_yhat_`, 2)), nudge_x = 0.45, color="black") +
  geom_hline(aes(yintercept = `_yhat_mean_`)) + 
  facet_grid(`_ylevel_`~`_label_`) +
  scale_color_manual(values =  c(`-` = "#d8b365", `0` = "#f5f5f5", `+` = "#5ab4ac", 
                                X = "darkgrey")) +
  coord_flip() + theme_minimal() + theme(legend.position="none") + xlab("") + ylab("")

agosiewska added a commit that referenced this issue Nov 25, 2018
@agosiewska
Copy link
Member

Thank You!
I've replaced an old plot with this new one.

@pbiecek
Copy link
Member Author

pbiecek commented Nov 25, 2018

It still requires some work. One is to add values for variables (hour = ...) second is to handle more then one observation (different ids)

@pbiecek
Copy link
Member Author

pbiecek commented Nov 25, 2018

And the way how _predicted_ is created if far from perfect.
It shall be an additional row not additional column in the output from SHAP.

@agosiewska
Copy link
Member

Since we have new plots, can we close this?

@pbiecek
Copy link
Member Author

pbiecek commented Apr 2, 2019

Great, thanks!

@pbiecek pbiecek closed this as completed Apr 2, 2019
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