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

Refactor Multivariate RandomWalk distributions #6131

Merged
merged 6 commits into from
Oct 10, 2022

Conversation

ricardoV94
Copy link
Member

@ricardoV94 ricardoV94 commented Sep 15, 2022

Related to #4642

Checklist

Major / Breaking Changes

  • ...

Bugfixes / New features

  • Extend RandomWalk to multivariate cases

Docs / Maintenance

  • Refactor MvGaussianRandomWalk and MvStudentTRandomWalk for V4

@codecov
Copy link

codecov bot commented Oct 8, 2022

Codecov Report

Merging #6131 (b134701) into main (a574ed5) will increase coverage by 11.96%.
The diff coverage is 96.92%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #6131       +/-   ##
===========================================
+ Coverage   81.62%   93.58%   +11.96%     
===========================================
  Files         101      101               
  Lines       22093    22151       +58     
===========================================
+ Hits        18034    20731     +2697     
+ Misses       4059     1420     -2639     
Impacted Files Coverage Δ
pymc/tests/distributions/test_distribution.py 97.92% <ø> (ø)
pymc/tests/distributions/test_multivariate.py 99.44% <ø> (ø)
pymc/distributions/shape_utils.py 97.85% <90.90%> (+13.85%) ⬆️
pymc/distributions/timeseries.py 91.44% <95.45%> (+8.87%) ⬆️
pymc/tests/distributions/test_timeseries.py 96.95% <98.56%> (+1.49%) ⬆️
pymc/distributions/distribution.py 95.00% <100.00%> (+1.81%) ⬆️
pymc/distributions/multivariate.py 92.25% <100.00%> (+0.11%) ⬆️
pymc/tests/distributions/test_shape_utils.py 99.76% <100.00%> (+99.76%) ⬆️
... and 29 more

@ricardoV94 ricardoV94 marked this pull request as ready for review October 8, 2022 22:33
@ricardoV94 ricardoV94 added the v4 label Oct 8, 2022
@ricardoV94 ricardoV94 force-pushed the refactor_mv_dists branch 2 times, most recently from 5d52bd2 to bf2cdcc Compare October 9, 2022 11:00
pymc/distributions/shape_utils.py Outdated Show resolved Hide resolved
pymc/distributions/shape_utils.py Show resolved Hide resolved
pymc/distributions/timeseries.py Show resolved Hide resolved
@ricardoV94 ricardoV94 changed the title Refactor MVRandomWalk distributions Refactor Multivariate RandomWalk distributions Oct 9, 2022
Copy link
Member

@larryshamalama larryshamalama left a comment

Choose a reason for hiding this comment

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

Great PR @ricardoV94, as always!

It seems like get_dists does a lot of the hard work for the dist method, but why couldn't it be a part of RandomWalk? I am guessing that the answer is inherent to metaclasses but I just can't pinpoint it right now.

):
raise TypeError("init_dist must be a univariate distribution variable")
raise TypeError("init_dist must be a distribution variable")
check_dist_not_registered(init_dist)

if not (
Copy link
Member

Choose a reason for hiding this comment

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

Can this check be a helper function? I feel like we often check these conditions

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I always think about it. It's on the edge of being so short that it doesn't make complete sense. Have to think about it

@classmethod
@abc.abstractmethod
def get_dists(cls, *args, **kwargs):
pass
Copy link
Member

Choose a reason for hiding this comment

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

raise NotImplementedError here maybe?

Copy link
Member Author

Choose a reason for hiding this comment

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

abc.abstractmethod does that ;)

Copy link
Member

Choose a reason for hiding this comment

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

ooo

@ricardoV94 ricardoV94 force-pushed the refactor_mv_dists branch 3 times, most recently from 2787c57 to e3a919c Compare October 9, 2022 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants