From 35511b90c2770fa0f98d7d7747a291becd7f40d2 Mon Sep 17 00:00:00 2001 From: ST John Date: Wed, 15 Sep 2021 15:46:05 +0300 Subject: [PATCH 1/2] swap order of parametrization of GammaLikelihood to simplify dispatch on invlink type --- Project.toml | 2 +- src/likelihoods/gamma.jl | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index 7418d3e..068b35a 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "GPLikelihoods" uuid = "6031954c-0455-49d7-b3b9-3e1c99afaf40" authors = ["JuliaGaussianProcesses Team"] -version = "0.2.0" +version = "0.3.0" [deps] Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" diff --git a/src/likelihoods/gamma.jl b/src/likelihoods/gamma.jl index 2092ccc..59e1c2a 100644 --- a/src/likelihoods/gamma.jl +++ b/src/likelihoods/gamma.jl @@ -1,14 +1,14 @@ """ - GammaLikelihood(α::Real=1.0, l::AbstractLink=ExpLink()) + GammaLikelihood(α::Real=1.0, invlink::AbstractLink=ExpLink()) Gamma likelihood with fixed shape `α`. ```math p(y|f) = Gamma(y | α, l(f)) ``` -On calling, this would return a gamma distribution with shape `α` and scale `l(f)`. +On calling, this would return a Gamma distribution with shape `α` and scale `invlink(f)`. """ -struct GammaLikelihood{T<:Real,Tl<:AbstractLink} +struct GammaLikelihood{Tl<:AbstractLink,T<:Real} α::T # shape parameter invlink::Tl end From c675c623bff4bfb70e59e6f09c53c0afc2179a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Galy-Fajou?= Date: Thu, 14 Oct 2021 09:21:31 +0200 Subject: [PATCH 2/2] Fix gamma tests --- test/likelihoods/gamma.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/likelihoods/gamma.jl b/test/likelihoods/gamma.jl index 05c7ca9..e5b0d00 100644 --- a/test/likelihoods/gamma.jl +++ b/test/likelihoods/gamma.jl @@ -1,7 +1,7 @@ @testset "GammaLikelihood" begin for args in ((), (1.0,), (exp,), (ExpLink(),), (1.0, exp), (1.0, ExpLink())) lik = GammaLikelihood(args...) - @test lik isa GammaLikelihood{Float64,ExpLink} + @test lik isa GammaLikelihood{ExpLink,Float64} @test lik.α == 1 end