ITADN

Different numeric types for the GammaShapeLikelihood constructor?

#538Openabpolym 创建于 2025-10-26
good first issuequestion
A
abpolymcommented
In my [new branch](https://github.com/ReactiveBayes/ReactiveMP.jl/tree/improving-codecov) I am currently making some tests for the rules of the `GammaMixture` node, because there are none. I encountered the following error: ```julia MethodError: no method matching ReactiveMP.GammaShapeLikelihood(::Float32, ::Float64) Closest candidates are: ReactiveMP.GammaShapeLikelihood(::T, ::T) where T<:Real ``` Do we want GammaShapeLikelihood to be also defined for different float numeric types ? ```julia GammaShapeLikelihood(p::Real, γ::Real) = GammaShapeLikelihood(promote(p, γ)...) ``` We could also just enforce consistent floating type inside the rule but that sounds kind of sus: ```julia @rule GammaMixture((:a, k), Marginalisation) (q_out::Any, q_switch::Any, q_b::GammaDistributionsFamily) = begin p = Float64(probvec(q_switch)[k]) [...] ```
1 条评论