Skip to content
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

GP do not fail when xdims cannot be constant folded #7111

Merged
merged 2 commits into from Feb 6, 2024

Conversation

bwengals
Copy link
Contributor

@bwengals bwengals commented Jan 23, 2024

Description

Closes #7000. Going with @ricardoV94's suggestion of try/except, from the comments in that issue.

Related Issue

Checklist

  • Checked that the pre-commit linting/style checks pass
  • Included tests that prove the fix is effective or that the new feature works
  • Added necessary documentation (docstrings and/or example notebooks)
  • If you are a pro: each commit corresponds to a [relevant logical change]

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

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

@bwengals bwengals added the bug label Jan 23, 2024
Copy link

codecov bot commented Jan 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (f49b923) 90.20% compared to head (440079b) 85.66%.
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7111      +/-   ##
==========================================
- Coverage   90.20%   85.66%   -4.54%     
==========================================
  Files         101      101              
  Lines       16961    16961              
==========================================
- Hits        15299    14530     -769     
- Misses       1662     2431     +769     
Files Coverage Δ
pymc/gp/cov.py 98.66% <100.00%> (ø)
pymc/gp/hsgp_approx.py 95.62% <ø> (ø)

... and 8 files with indirect coverage changes

pymc/gp/cov.py Outdated
)
try:
# For the HSGP.prior_linearized use case, it's OK if X is not constant.
[xdims] = constant_fold([xdims], raise_not_constant=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can change to raise_not_constant=False, no point in having a try except

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok, done

pymc/gp/cov.py Outdated Show resolved Hide resolved
@ricardoV94 ricardoV94 force-pushed the hsgp-linearized-fix branch 2 times, most recently from 02f190d to 9c5cd15 Compare February 6, 2024 10:54
@ricardoV94 ricardoV94 changed the title HSGP.prior_linearized fix HSGP.prior_linearized: do not fail when xdims cannot be constant folded Feb 6, 2024
@ricardoV94 ricardoV94 changed the title HSGP.prior_linearized: do not fail when xdims cannot be constant folded GP do not fail when xdims cannot be constant folded Feb 6, 2024
@ricardoV94
Copy link
Member

@bwengals I rebased the PR and split the two logical commits.

@ricardoV94 ricardoV94 merged commit 4991b6a into pymc-devs:main Feb 6, 2024
20 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug docs GP Gaussian Process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: HSGP.prior_linearized example raises error
2 participants