Skip to content

Wrap sigma parameter with as_tensor_variable() before get_tau_sigma() - #6745

Closed
enessinanparildi wants to merge 1 commit into
pymc-devs:mainfrom
enessinanparildi:main
Closed

Wrap sigma parameter with as_tensor_variable() before get_tau_sigma()#6745
enessinanparildi wants to merge 1 commit into
pymc-devs:mainfrom
enessinanparildi:main

Conversation

@enessinanparildi

@enessinanparildi enessinanparildi commented May 30, 2023

Copy link
Copy Markdown

For the cases where the sigma parameter is a vector of random variables instead of fixed values, in get_tau_sigma
if np.any(sigma_ <= 0) throws the following error: TypeError: Variables do not support boolean operations.
Sigma parameter normally is wrapped by as_tensor_variable() after get_tau_sigma. Moving the line sigma= pt.as_tensor_variable(sigma) before get_tau_sigma() resolves this issue. I ran some tests by supplying sigma argument with different types of values. They are all fine.

Bugfixes

  • For the cases where the sigma parameter is a vector of random variables instead of fixed values, in get_tau_sigma
    if np.any(sigma_ <= 0) throws the following error: TypeError: Variables do not support boolean operations.

📚 Documentation preview 📚: https://pymc--6745.org.readthedocs.build/en/6745/

For the cases where the sigma parameter is a vector of random variables instead of fixed values, 
in get_tau_sigma if np.any(sigma_ <= 0) throws the following error:
TypeError: Variables do not support boolean operations. Sigma parameter normally is wrapped by as_tensor_variable() after get_tau_sigma. Moving the line sigma= pt.as_tensor_variable(sigma)
before get_tau_sigma() resolves this issue.
@welcome

welcome Bot commented May 30, 2023

Copy link
Copy Markdown

Thank You Banner
💖 Thanks for opening this pull request! 💖 The PyMC community really appreciates your time and effort to contribute to the project. Please make sure you have read our Contributing Guidelines and filled in our pull request template to the best of your ability.

@ricardoV94

Copy link
Copy Markdown
Member

That will avoid the negative check every time. I think we can remove the check because I don't think users would ever pass non symbolic negative sigmas.

If they do, the new model.debug should quickly find the problem anyway.

@ricardoV94

Copy link
Copy Markdown
Member

Closing in favor of #6988

@ricardoV94 ricardoV94 closed this Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants