I put together a very minimalist notebook w/an example of BART in PyMC 3.10. I simulated some data, fit the model, and checked accuracy (using MSE). It seems like the n_eff for BART params is low, I don’t know if that’s by design, or an issue with my implementation.
Anyways I hope this is helpful to people, feel free to poke through it: https://github.com/adamlauretig/pymc_bart/blob/master/pymc_bart.ipynb
Thanks @adlauretig, and well done!
Pinging @aloctavodia, as he’s our in-house BART expert – we even started calling him Bart internally I’m guessing he’ll be interested
Hello! I was wondering why v126.96.36.199b doesn’t have pm.BART() anymore and if that’s a permanent change. I’ve been utilizing this demo notebook which works on PyMC3 v4.0.0b2: Bayesian Additive Regression Trees: Introduction — PyMC documentation but not on v4.0.0b6 (there’s no pm.BART)
BART is now part of pymc-experimental. Installation and imports is different but usage after that is not. Would you be interested in updating the example notebook @keck343 ?
Yes! I could do that. Would I just update it and create a pull request?
here is the github repository in case it helps: GitHub - pymc-devs/pymc-examples: Examples of PyMC models, including a library of Jupyter notebooks.. Do not hesitate to ask here or on github if you have any doubts
@keck343 if you prefer you can also attend office hours to ask questions on getting started contributing
@OriolAbril I’m sorry I couldn’t make it to the office hours. Something changed from the pm.BART to pmx.BART implementation that makes it so that
pmx.bart.predict(idata_coal, rng, size=2) throws an error
AttributeError: 'NoneType' object has no attribute 'shape'
that I haven’t been able to figure out. I’ll try to make it to the next office hours!
idata_coal is arviz.data.inference_data.InferenceData and I’ve tried downgrading arviz to the same one in the original notebook to no avail. The BART example notebook runs on version on PyMC3 v4.0.0b2 but this line fails on PyMC3 v4.0.0b6 and install pymc-experimental via pip:
pip install git+https://github.com/pymc-devs/pymc-experimental
Maybe @aloctavodia can help with that error?
Now that line should be
plt.step(x_data, np.exp(pmx.bart.predict(idata_coal, rng, x_data, size=2).T)); i.e. you need to pass your “X”.
also in the next cell, you will need to do:
plt.step(x_data[:, 0], [bart_trees[0, 0, i].item().predict(x) for x in x_data])
I am going to update the notebook ASAP.