-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
BUG: Issue with Ordered Transform in Ordered Logistic API docs example #6610
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
Comments
Can you share the whole traceback? |
`--------------------------------------------------------------------------- File ~/mambaforge/envs/pymc_examples_new/lib/python3.11/site-packages/pymc/distributions/distribution.py:312, in Distribution.new(cls, name, rng, dims, initval, observed, total_size, transform, *args, **kwargs) File ~/mambaforge/envs/pymc_examples_new/lib/python3.11/site-packages/pymc/model.py:1328, in Model.register_rv(self, rv_var, name, observed, total_size, dims, transform, initval) File ~/mambaforge/envs/pymc_examples_new/lib/python3.11/site-packages/pymc/model.py:1521, in Model.create_value_var(self, rv_var, transform, value_var) File ~/mambaforge/envs/pymc_examples_new/lib/python3.11/site-packages/pymc/distributions/transforms.py:95, in Ordered.forward(self, value, *inputs) AttributeError: 'RandomGeneratorSharedVariable' object has no attribute 'shape'` |
Ah maybe Ordered is not an initialized transform? Try to use I think the docstring example uses the latter (small |
The warning might be a bug we fixed just now in pymc 5.1.2 Not sure what the plot tells you? Good or bad? |
Ah you said it looks right. Shall we close the issue? Maybe we can update the docs to use This way reduces the chance of typos, and it's actually the right one going forward. |
I think the plot looks good. Yes, i'll open a PR now to change the docstring |
Closed via #6611 |
Describe the issue:
The API docs for the ordered logistic class recommends using the transform ordered to provide cutpoints for the ordinal regression. But the provided example breaks with an error reporting that the random variable for the cutpoints lacks a shape.
On the latest version:

Reproduceable code example:
Error message:
PyMC version information:
Last updated: Fri Mar 17 2023
Python implementation: CPython
Python version : 3.11.0
IPython version : 8.11.0
pytensor: 2.10.1
numpy : 1.24.2
arviz : 0.15.1
matplotlib: 3.7.1
pandas : 1.5.3
pymc : 5.1.1
pytensor : 2.10.1
Watermark: 2.3.1
Context for the issue:
I was going to try and write up docs on the technique of ordinal regression, but i think failure of the ordered transform makes the entire class of models less straightforward to implement. I'm pretty sure it's related to this line:
pymc/pymc/distributions/transforms.py
Line 89 in c7279b5
But i don't know enough about the random variable implementation to know why the shape attribute is not available now.
The text was updated successfully, but these errors were encountered: