ReactiveBayes / ExponentialFamilyProjection.jl

A library to project an arbitrary function to an exponential family member distribution with the manifold optimization
MIT License
9 stars 0 forks source link

Add projection tests for Binomial #21

Closed ismailsenoz closed 3 months ago

ismailsenoz commented 4 months ago

This PR adds projection tests for Binomial distribution. Simple projection and projection from Poisson to Binomial seems to work. ~However, projection from Bernoulli to Binomial with conditioner 2 is throwing NaN errors. That is why I put broken tests for that~

Nimrais commented 4 months ago

The projection for Bernoulli to Binomial is defined only for Binomial with number of trials 1.

julia> d = Binomial(2, 0.5)
Binomial{Float64}(n=2, p=0.5)

julia> rand(d, 2)
2-element Vector{Int64}:
 2
 1

julia> logpdf(Bernoulli(0.5), 2)
-Inf
ismailsenoz commented 4 months ago

Good catch! I pushed tests with conditioner equal to 1. They indeed pass.

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.06%. Comparing base (b46db83) to head (d932d7a). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #21 +/- ## ======================================= Coverage 99.06% 99.06% ======================================= Files 5 5 Lines 215 215 ======================================= Hits 213 213 Misses 2 2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.