pymc-devs / pymc-devs/pymc

Debug message for scalar values fails

Open
#7,429 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
9.8k
Forks
2.3k
Avg merge
21h 39m
Merged PRs (30d)
5

Description

https://github.com/pymc-devs/pymc/blob/e988bc5416d8df6d32e4e984173d0f91c9644823/pymc/model/core.py#L1966

raises an error when variable is scalar

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Cell In[23], line 1
----> 1 model.debug(fn="dlogp")

File [/dev/pymc/pymc/model/core.py#line=1965), in Model.debug(self, point, fn, verbose)
   1962 print_(
   1963     f"Some of the{observed}values of variable {rv} are associated with a non-finite {fn}:"
   1964 )
   1965 mask = ~np.isfinite(rv_fn_eval)
-> 1966 for value, fn_eval in zip(values[mask], rv_fn_eval[mask]):
   1967     print_(f" value = {value} -> {fn} = {fn_eval}")
   1968 print_()

IndexError: too many indices for array: array is 0-dimensional, but 1 were indexed

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pymc/model/core.py around line 1966 and reproduce Model.debug(fn="dlogp") with a scalar variable. Inspect the reported indexing failure and verify that debugging scalar values completes without IndexError while still printing non-finite values.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.