Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Addvectorize_over_posterior topymc.sampling.forward#7841

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
lucianopaz merged 1 commit intopymc-devs:mainfromlucianopaz:vectorize_post
Jul 4, 2025

Conversation

@lucianopaz
Copy link
Member

@lucianopazlucianopaz commentedJul 3, 2025
edited by github-actionsbot
Loading

This PR adds the functionpymc.sampling.forward.vectorize_over_posterior.

This function basically vectorizes the computation of a list of output variables over possible values of random variables or deterministics that are stored in anxarray.Dataset. Any extra random variable remaining in the graph will be vectorized as well, either by changing its size explicitly to match the batch ofchain * draw dimensions, or implicitly given its inputs.

Type of change

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

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

Copy link
Member

@ricardoV94ricardoV94 left a comment
edited
Loading

Choose a reason for hiding this comment

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

Looks good, some minor suggestions and complaints. This PR reminds me that I don't think we havevectorize_node implemented for SymbolicRandomVariables. Shoud be easy to implement, at least for those we have a signature (it's how we know how to resize them automatically)

@_change_dist_size.register(SymbolicRandomVariable)
defchange_symbolic_rv_size(op:SymbolicRandomVariable,rv,new_size,expand)->TensorVariable:
extended_signature=op.extended_signature
ifextended_signatureisNone:
raiseNotImplementedError(
f"SymbolicRandomVariable{op} without signature requires custom `_change_dist_size` implementation."
)
size=op.size_param(rv.owner)
ifsizeisNone:
raiseNotImplementedError(
f"SymbolicRandomVariable{op} without [size] in extended_signature requires custom `_change_dist_size` implementation."
)
params=op.dist_params(rv.owner)
ifexpandandnotrv_size_is_none(size):
new_size=tuple(new_size)+tuple(size)
returnop.rebuild_rv(*params,size=new_size)

lucianopaz reacted with thumbs up emoji
@ricardoV94
Copy link
Member

ricardoV94 commentedJul 3, 2025
edited
Loading

Looks good, some minor suggestions and complaints. This PR reminds me that I don't think we havevectorize_node implemented for SymbolicRandomVariables. Shoud be easy to implement, at least for those we have a signature (it's how we know how to resize them automatically)

I'm not suggesting we should do it in this PR, just reminded me

@codecov
Copy link

codecovbot commentedJul 3, 2025
edited
Loading

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.92%. Comparing base(3ae5095) to head(b2af12f).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@##             main    #7841      +/-   ##==========================================+ Coverage   92.91%   92.92%   +0.01%==========================================  Files         107      107                Lines       18286    18313      +27     ==========================================+ Hits        16991    17018      +27  Misses       1295     1295
Files with missing linesCoverage Δ
pymc/sampling/forward.py96.73% <100.00%> (+0.35%)⬆️
🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lucianopazlucianopazforce-pushed thevectorize_post branch 3 times, most recently from20972c9 tob2af12fCompareJuly 4, 2025 04:40
@ricardoV94
Copy link
Member

Looks great, failing test is unrelated I've seen it fail sporadically

lucianopaz reacted with thumbs up emoji

@lucianopazlucianopaz merged commit794b5b8 intopymc-devs:mainJul 4, 2025
21 of 23 checks passed
@lucianopazlucianopaz deleted the vectorize_post branchJuly 4, 2025 14:12
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@ricardoV94ricardoV94ricardoV94 approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@lucianopaz@ricardoV94

[8]ページ先頭

©2009-2025 Movatter.jp