-
Notifications
You must be signed in to change notification settings - Fork 418
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
Add support for univariate von Mises distribution #223
Conversation
The initial implementation supports standard moments, pdf, cdf, and drawing samples. To support large concentrations, the scaled bessel function implementation had to be used. This scaled version is currently not supported in Base, such that its support is currently added only for the von Mises distribution.
Added description of constructors to univariate distribution documentation. Also, renamed support to helper functions in vonmises.jl
end | ||
|
||
## Helper functions | ||
# Bessel function as in Base/math.jl, but with exponential scaling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this function would be more appropriate in Base.
Indeed, it should be in Base, but is not yet available. See JuliaLang/julia#6665 I have added it here temporarily, until it becomes available in Base. |
|
||
type AmosException <: Exception | ||
info::Int32 | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than redefining these, you can just import them from Base.Math
.
The support of the distribution was not defined, as AngularDistribution or CircularDistribution class does not exist, yet.
@jdrugo Would you please incorporate latest changes in the master? Latest refactoring has substantial changes to many files, which makes this unmergeable in this form. |
@lindahua I currently do not have access to my computer, but will update the files at the beginning of the next week. |
Conflicts: src/Distributions.jl
The code is now updated in the light of the recent refactoring of Distributions.jl. It defines Sampling from |
Yes, please add the sampler. My suggestion is
immutable VonMisesSampler <: Sampleable{Univariate,Continuous}
# cache some pre-computable quantities
...
function rand(s::VonMisesSampler)
# move the sampling code here
end and move the sampling code there.
sampler(d::VonMises) = VonMisesSampler( ... ) Other than that, it looks good to me. |
Introduced VonMisesSampler and VonMisesNormalApproxSampler. The latter cannot be replaced by a Normal sampler, as VonMisesNormalApproxSampler additionally ensures thatt he returned samples are within [0, 2pi].
I added both a |
Add support for univariate von Mises distribution
Thanks! |
Adding a univariate von Mises distribution makes sense on top of the already available multivariante von Mises-Fisher distribution, if only for more efficient sampling from this distribution.
I have not yet included test scripts for this distribution, as doing so would require the use of circular statistics, which are not yet available in standard packages. The same applies to distribution fitting.