Skip to content

Vonmises moments #5232

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

Merged
merged 3 commits into from
Dec 1, 2021
Merged

Vonmises moments #5232

merged 3 commits into from
Dec 1, 2021

Conversation

Domenico89
Copy link
Contributor

Add moments and tests for the below distributions as part of #5078:
-pymc.distributions.continuous.VonMises

@Domenico89
Copy link
Contributor Author

Domenico89 commented Dec 1, 2021

The curren tests should work fine, but if I use np.arange(5) as mu in line 446 ,f or example, I get as a result array([ 0., 1., 2., 3., -2.28318531]), which is not what I would expect. I couldn't figure out where -2.2831853 is coming from. Other strange numbers appear when I run the test for np.arange(k) with k>4.

@ricardoV94
Copy link
Member

ricardoV94 commented Dec 1, 2021

The curren tests should work fine, but if I use np.arange(5) as mu in line 446 ,f or example, I get as a result array([ 0., 1., 2., 3., -2.28318531]), which is not what I would expect. I couldn't figure out where -2.2831853 is coming from. Other strange numbers appear when I run the test for np.arange(k) with k>4.

Seems like it is just mirroring around +-np.pi? Are you testing the moment with a transformed distribution?

@ricardoV94 ricardoV94 mentioned this pull request Dec 1, 2021
51 tasks
@codecov
Copy link

codecov bot commented Dec 1, 2021

Codecov Report

Merging #5232 (1d337ca) into main (a16ec4a) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5232      +/-   ##
==========================================
- Coverage   78.95%   78.94%   -0.01%     
==========================================
  Files          88       88              
  Lines       14232    14237       +5     
==========================================
+ Hits        11237    11240       +3     
- Misses       2995     2997       +2     
Impacted Files Coverage Δ
pymc/distributions/continuous.py 96.72% <100.00%> (+0.12%) ⬆️
pymc/parallel_sampling.py 86.33% <0.00%> (-1.00%) ⬇️

@ricardoV94
Copy link
Member

/pre-commit-run

@ricardoV94
Copy link
Member

All tests are passing except for a pre-commit issue. I added a commit fix it with the bot, so make sure to merge from here if you want to do anything with this branch.

I guess you were seeing the effects of the CircularTransform?

with pm.Model() as m:
  x = pm.Vonmises("x", np.arange(4))  
  y = pm.Vonmises("y", np.arange(4), transform=None)

The moment of x will by default be on the Circular scale, whereas that of y will not. We are testing with the second case, when we call this line:

return_transformed=False,

@ricardoV94 ricardoV94 merged commit 95bd5e5 into pymc-devs:main Dec 1, 2021
@ricardoV94
Copy link
Member

Thanks @Domenico89, everything seemed to be working in our tests here.

Let me know if you find issues that need to be fixed or if my hunch above was correct.

@Domenico89
Copy link
Contributor Author

Thanks @Domenico89, everything seemed to be working in our tests here.

Let me know if you find issues that need to be fixed or if my hunch above was correct.

ah, ok. Sorry if took this long, I am new with the base code. Thanks for the hunch!

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