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

From Keras3 to package pdp in R #134

Open
Oakwilde opened this issue Oct 8, 2024 · 10 comments
Open

From Keras3 to package pdp in R #134

Oakwilde opened this issue Oct 8, 2024 · 10 comments

Comments

@Oakwilde
Copy link

Oakwilde commented Oct 8, 2024

Might pdp be extended to work directly with output from Keras3? Also, variable importance plots would be a nice addition. There are number of related ideas in Molnar’s nice survey book “Interpretable Machine Learning…” 2022. Some are already in R for other ML procedures (e.g., for gbm).

@brandongreenwell-8451
Copy link

Hi @Oakwilde, pdp can already work with ANY predictive model, provided you include a suitable prediction wrapper via the pred.fun argument. Similar for package vip which already implements many of the ideas in Molnar's book. If you have a brief reprex, I'd be happy to help pull together working examples?

@brandongreenwell-8451
Copy link

An example is given in the Classification problems section of this vignette.

@Oakwilde
Copy link
Author

Oakwilde commented Oct 8, 2024 via email

@brandongreenwell-8451
Copy link

@Oakwilde I completely sympathize with your callouts! These are precisely why I initially wrote these packages. I've tried to maintain a balance between explicit support for various package, but ultimately, users will find the best experience in understanding how the optional prediction wrapper in each package works, as this will allow you to work across different packages, data types (e.g., arrays, data frames, or whatever the specific model package requires). My only real regret was developing these packages too far apart (i.e., pdp, vip, and fastshap) that the naming convention is not terribly consistent between them.

They plotting utilities in these libraries are also good, but like you said, users often have specific requirements and it's helpful to override the plotting. For instance, in pdp, you can simply set plot = FALSE (can't remember the default) to return a data frame that can be plotted in whichever library is most convenient. Our book, which we're revising here at some point, offers some additional examples of supporting other models via custom prediction wrappers.

Each of these were published in the R Journal, so you can also find mroe extensive details and examples in those articles.

In any case, feel free to provide some examples when you get a chance and I'd be more than happy to help integrate them with these packages.

@Oakwilde
Copy link
Author

Oakwilde commented Oct 9, 2024 via email

@Oakwilde
Copy link
Author

Oakwilde commented Oct 9, 2024 via email

@brandongreenwell-8451
Copy link

Great, so you're able to produce the plot you need? I'll admit that understanding the underlying modeling package's predict function behavior can be out right frustrating with all the inconsistencies from base R. Did you open a ticket on the keras3 repo to see if they can help with understanding the behavior?

@Oakwilde
Copy link
Author

Oakwilde commented Oct 9, 2024 via email

@brandongreenwell-8451
Copy link

Awesome! I'll keep this thread open for now in case there's an opportunity to make it easier for keras3 users.

@Oakwilde
Copy link
Author

Oakwilde commented Oct 9, 2024 via email

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