-
Notifications
You must be signed in to change notification settings - Fork 331
Fix errors from pymc 5.26 release #2011
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
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2011 +/- ##
==========================================
- Coverage 93.89% 93.89% -0.01%
==========================================
Files 67 67
Lines 9221 9220 -1
==========================================
- Hits 8658 8657 -1
Misses 563 563 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| # Select rows for this nest's alternatives | ||
| nest_alt_indices = nest_indices[level][nest] | ||
| if n_alts_in_nest == 1: | ||
| # For single alternative nests, explicitly maintain 2D shape |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use expand dims instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant instead of the slice indexing thing. You can index the same but expand_dims after the case where it goes 1d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmm something like ad6c5e9 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't know how this is related to the new PyTensor though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmm I still do not know either, this is me trying to make broadcasting work again 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the error?
|
Looks like the notebooks all ran successfully too? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any major issues with the code changes, but i can take a look at running the models tomorrow and making sure the results look right. Just want to understand what issue it was?
| y_nest = U[:, nest_indices[level][nest]] | ||
| nest_idx = nest_indices[level][nest] | ||
| y_nest = U[:, nest_idx] | ||
| n_alts_in_nest = len(nest_idx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine. Just renaming
| I_nest = pm.Deterministic( | ||
| f"I_{nest}", pm.math.logsumexp((y_nest - max_y_nest) / lambda_, axis=-1) | ||
| ) | ||
| W_nest = w_nest + pt.expand_dims(I_nest * lambda_, axis=-1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was it this part that was failing?
|
@juanitorduz what test/nb failed with the nested logit and with what error? |
This one #2010 (comment) (a test) |
|
Confirmed @juanitorduz 's code changes will run on nutpie and vanilla pymc. But identifiability of the fixed parameters seems effected. Formulas with fixed parameters e.g. income
Formulas without fixed parameters i.e. just alternative specific parameters.
It's also very annoying that the progress bar doesn't seem to work anymore for nutpie, sampling still seems to work though. However with numpyro the sampling itself seems broken due to progress bar incompatibility. I will need to spend more time debugging properly. I'll try tonight. |
|
Sure! Take your time! Feel free to push to this branch I create a new PR :) |
| import numpy.typing as npt | ||
| import pymc as pm | ||
| import pytensor.tensor as pt | ||
| from numpy.core.multiarray import normalize_axis_index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would this be conditional import? Are we supporting both versions?
|
Opened a fresh pull request here: #2015 Was easier for me to work through the difference from main. Requested a review, but i think we can close this one. |



Vibe coded some components.
📚 Documentation preview 📚: https://pymc-marketing--2011.org.readthedocs.build/en/2011/