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 Categorical #25

Open ismailsenoz opened 3 months ago

bvdmitri commented 3 months ago

@ismailsenoz @Nimrais the manifold for Categorical distributions has been released https://github.com/ReactiveBayes/ExponentialFamilyManifolds.jl/releases/tag/v1.3.0

ismailsenoz commented 3 months ago

I will add MLE tests and check if the tests are passing. Then, we can merge perhaps.

bvdmitri commented 3 months ago

https://github.com/JuliaDiff/ForwardDiff.jl/issues/706

bvdmitri commented 3 months ago

After hot-fix ~(yet to be released)~ one MLE test case for categorical (p=[0.25, 0.5, 0.25]) fails with

The divergences was `[0.0002046197156185031, 0.004019109970678, 0.000911229524105512, 0.001783671588390913, 0.00013545566267994264, 0.00034343135792216234, 0.012114986925930868, 0.007249024876919009, 0.010513851757073901, 0.043878362221472914, 0.012727900047229554, 0.015748158685156985, 0.007325088753744394, 0.016417306079205843, 0.0011968461499580335, 0.0065473235279399356, 0.0032759534502948794, 0.15676903402135056, 0.005948420266813347]`.
└ @ Main.var"##244" ~/.julia/dev/ExponentialFamilyProjection.jl/test/projection/projected_to_setuptests.jl:255

Imo its actually fine and it converged (yet fluctuating), but the default heuristic failed in this particular case. Probs fine to change the p or the hyperparameters of the heuristic. Other tests are passing.

ismailsenoz commented 3 months ago

I thinking changing the probability vector is fine. It is the problem of test heuristic not the method imo. Though, the test for product of two categoricals is broken.