-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
Pass kwargs to nutpie + create env.yml file #855
Conversation
@AlexAndorra I think this is already handled? I have not looked deeply into the details, but have a look at this example: https://bambinos.github.io/bambi/notebooks/alternative_samplers.html#blackjax |
Yeah I saw that @tomicapretto , but it doesn't seem to work: data = bmb.load_data("sleepstudy")
model = bmb.Model('Reaction ~ Days', data)
kwargs = {
"draws": 40,
"chains": 2,
"cores": 3,
}
results = model.fit(inference_method="nutpie", **kwargs)
results.posterior will still give you 8 chains and 1000 draws |
Interestingly, the blackjax nuts example from the NB errors out: ValueError: not enough values to unpack (expected 2, got 1) |
There is currently a problem with the dependencies. I just pinned them in a separate PR because it was being problematic. I think we need a new release of bayeux. Unforunately, I'm not familiar enough with it to work on it. These are the dependencies I've pinned Lines 41 to 46 in 7a18fb9
|
Interesting, I'll double check what's happening |
Ooooh, I definitely need to do that on my branch then! Shouldn't we merge that into
I think this is ignored silently by Bayeux because not passed explicitely. The changes I've done in this PR solve it, but may not cover all the cases. They will though, once I add Colin's suggestion from above |
This comment was marked as resolved.
This comment was marked as resolved.
I think so @tomicapretto , because then Bambi has to pass them explicitely to |
This comment was marked as resolved.
This comment was marked as resolved.
I resolved my previous two comments because I realized they were not correct. The reason for Line 261 in 7a18fb9
not containing |
I see the following alternatives
|
I am late to the party @tomicapretto. Regarding nutpie, the kwargs returned is not "pretty" bmb.inference_methods.get_kwargs("nutpie")
It is a nested dictionary, where keys are objects. A nested dictionary isn't a problem per say, e.g passing nested args to Blackjax NUTS. kwargs = {
"adapt.run": {"num_steps": 500},
"num_chains": 4,
"num_draws": 250,
"num_adapt_draws": 250
} |
Not sure what you mean with "it works". If it is passing arguments to BlackJAX, it's always worked. If it is the tests, yes, now it works after pinning deps. |
@GStechschulte I think that is not the problem (see #855 (comment) and my resolved comments) |
I meant passing arguments to Blackjax, because it currently errors out as I
showed above. This is solved by pinning Bayeux, IIUC.
For nutpie, I think we can merge these changes (once I add those other
cases), but of course I'll let you decide
El El sáb, 9 nov 2024 a la(s) 12:36, Tomás Capretto <
***@***.***> escribió:
… @GStechschulte <https://github.com/GStechschulte> I think that is not the
problem (see #855 (comment)
<#855 (comment)> and
my resolved comments)
—
Reply to this email directly, view it on GitHub
<#855 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHIJMTDAY4OFFGW7TPIQ4PTZ7ZBYTAVCNFSM6AAAAABRLZBTUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINRWGMYDQMJUGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@AlexAndorra I'm going to incorporate your changes, just modified things a bit. The environment goes under a Could you install from your branch and try to run nutpie passing those kwargs? If tests are OK, and what you run works, then I'll merge. |
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
It's all working now @tomicapretto 🥳 |
Looks like we just need to run |
Ah indeed, thanks @GStechschulte ! Will do that locally, and see if I can run the tests locally too before I push |
I actually caught an issue with nutpie when cores and chains were None. I fixed it, and now the tests, as well as black and pylint work locally. I think we can merge once this turns green here 🥳 |
thanks for sticking with the long breakage i caused 😅 -- i ran the tests, but will wait for tomas to merge! |
Very glad to see all green guys! Thanks for all the work. I've just added a comment regarding which version of |
I'm going to work on this |
I just pushed the changes @tomicapretto ! Should be good to merge now |
Self reminder to add a test for this (im thinking about nutpie, I think it would be good to test against it as it's a good backend and people seem to like it, I do). |
Will merge after CI passes |
Currently, some kwargs are not passed to Bayeux when fitting the model. This PR makes sure it does.
The only change is on line 270 of
bambi/backend/pymc.py
-- the rest is only formatting.Also added an env file for creation with mamba. Ready for review!