Skip to content

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

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

Closed
wants to merge 1 commit into from

Conversation

enessinanparildi
Copy link

@enessinanparildi enessinanparildi commented May 30, 2023

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
Copy link

welcome bot commented May 30, 2023

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
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
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