diff --git a/Project.toml b/Project.toml index fe116e2e..04597cdd 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "AbstractGPs" uuid = "99985d1d-32ba-4be9-9821-2ec096f28918" authors = ["JuliaGaussianProcesses Team"] -version = "0.4.0" +version = "0.5.0-DEV" [deps] ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" diff --git a/src/latent_gp.jl b/src/latent_gp.jl index caf27ba7..996b7bff 100644 --- a/src/latent_gp.jl +++ b/src/latent_gp.jl @@ -2,8 +2,10 @@ LatentGP(f<:GP, lik, Σy) - `f` is a `AbstractGP`. - - `lik` is the likelihood function which maps samples from `f` to the corresponding - conditional likelihood distributions (i.e., `lik` must return a `Distribution` compatible with the observations). + - `lik` is a function mapping inputs `x` to a likelihood function, itself mapping samples + from `f` to the corresponding conditional likelihood distributions (i.e., `lik` must + return another function, which returns a `Distribution` compatible with the observations + when called at values of the latent process). - `Σy` is the noise under which the latent GP is "observed"; this represents the jitter used to avoid numeric instability and should generally be small. """ @@ -26,7 +28,7 @@ struct LatentFiniteGP{Tfx<:FiniteGP,Tlik} lik::Tlik end -(lgp::LatentGP)(x) = LatentFiniteGP(lgp.f(x, lgp.Σy), lgp.lik) +(lgp::LatentGP)(x) = LatentFiniteGP(lgp.f(x, lgp.Σy), lgp.lik(x)) function Distributions.rand(rng::AbstractRNG, lfgp::LatentFiniteGP) f = rand(rng, lfgp.fx) diff --git a/test/latent_gp.jl b/test/latent_gp.jl index 99ecfa07..e2622c23 100644 --- a/test/latent_gp.jl +++ b/test/latent_gp.jl @@ -3,10 +3,9 @@ x = rand(10) y = rand(10) - lgp = LatentGP(gp, x -> MvNormal(x, 0.1), 1e-5) + lgp = LatentGP(gp, x -> (f -> MvNormal(f, 0.1)), 1e-5) @test lgp isa LatentGP @test lgp.f isa AbstractGPs.AbstractGP - @test lgp.Σy isa Real lfgp = lgp(x) @test lfgp isa AbstractGPs.LatentFiniteGP