pymc-bart icon indicating copy to clipboard operation
pymc-bart copied to clipboard

Getting a frequentist model from BART model

Open ggmirandac opened this issue 11 months ago • 3 comments

Short Description

Hi, I have been wordering if there is a way to connect the bart regression model with some other tree based model, like XGboost or sklearn's trees. This in order to use the bart model to estimate some of the parameters of these models and then use the other tree models to generate SHAP values. This is based on the following blog in towardsdatascience.com: Bayesian inference.

This will generate a more thorough analysis of the black box model generated from the BART model.

Code Example or link

This can be seen in examples from : this blog post

And the shap value package is: shap

Relevant documentation or public examples

ggmirandac avatar Mar 04 '24 03:03 ggmirandac

Hi,

Thanks for sharing

What do you mean by "frequentist model"?

From a quick look at that notebook, what you need is to make predictions from a model and then pass those predictions to the shape package. That's something you can do with any PyMC model including BART models. You can compute predictions using pm.sample_posterior_predictive, no need to rewrite the model as in the notebook you shared. The author builds a SimpleModel class, which seems unnecessary to me.

I think we can add an example of this to the docs.

aloctavodia avatar Mar 04 '24 15:03 aloctavodia

Ohh, now I understand, the shap package is expecting an object with a prediction method. I guess that is what you mean by getting a "frequentist model". Still, the approach in that notebook is not very "pymc-onic". I guess the best approach will be to provide a utility function to simplify the user experience.

aloctavodia avatar Mar 04 '24 15:03 aloctavodia

Yeah,

Thanks for the consideration :D

Bests

ggmirandac avatar Mar 04 '24 19:03 ggmirandac