bambinos / bambi

BAyesian Model-Building Interface (Bambi) in Python.
https://bambinos.github.io/bambi/
MIT License
1.08k stars 124 forks source link

Progress bar for model.predict #818

Open kddubey opened 5 months ago

kddubey commented 5 months ago

Hello,

Thank you for this excellent package!

model.predict takes up to 30 minutes for my model. Is there a way to add a progress bar?

GStechschulte commented 5 months ago

Thanks for raising the issue. A progress bar should be enabled by default. What version of Bambi do you have installed? Additionally, are you running your code in Juypter Notebooks or Python scripts?

kddubey commented 5 months ago

I have 0.13.0 installed. It doesn't appear if I run it in a script or in a Jupyter Notebook. I do always see a progress bar for model.fit

GStechschulte commented 5 months ago

Ahh, apologies for the misinterpretation of the issue from my side. If you wanted to add a progress bar, it would go in the .predict method somewhere.

Although, this method also calls other methods such as compute_likelihood_params where we iterate over the components of the Bambi model and make predictions for each. Additional functions are called if you want posterior predictive samples. At first glance, it seems that putting the progress bar in compute_likelihood_params would provide the most informative progress bar since we know the elements we are iterating over, etc.

For model.fit, Bambi "inherits" the progress bar from PyMC (which I think uses the tqdm progress bar? Or was this changed to the fastprogress bar?) If you want to attempt add this and put up a PR, I would be more than happy to review it 😄

@tomicapretto any thoughts on adding a progress bar here?

tomicapretto commented 5 months ago

Hi!

We need to make a new release soon and it should probably help on many fronts.

Still, I think we don't have a progress bar for the Model.predict() method. It would be definitely nice to have one. I'm still not sure which parts of the code we need to modify, but I'll look into it. For now, adding a 'feature request' label here.