Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have a logpdf and loglikelihood for NamedTuple of f and y #59

Open
theogf opened this issue Jan 4, 2022 · 2 comments
Open

Have a logpdf and loglikelihood for NamedTuple of f and y #59

theogf opened this issue Jan 4, 2022 · 2 comments

Comments

@theogf
Copy link
Member

theogf commented Jan 4, 2022

Right now to compute logpdf or loglikelihood given a pair of GP samples f and observations y one needs to do:

logpdf(likelihood(f), y)

would that make sense to have a small wrapper

function logpdf(like::Likelihood, f_y::NamedTuple)
  logpdf(likelihood(f_y.f), f_y.y)
end

since this is what rand would return for a LatentGP :
https://github.com/JuliaGaussianProcesses/AbstractGPs.jl/blob/e7c67bd24c454f0b8179032ecbb82284887159c0/src/latent_gp.jl#L37

(and similarly for loglikelihood)

@theogf theogf changed the title Have a logpdf and loglikelihood for Tuple of f and y Have a logpdf and loglikelihood for NamedTuple of f and y Jan 4, 2022
@st--
Copy link
Member

st-- commented Mar 25, 2022

I can see the appeal, but then I think we should have a proper type for this. Dispatching on generic NamedTuple without specifying what fields that tuple might contain seems like it could easily lead to bugs somewhere down the line.

@theogf
Copy link
Member Author

theogf commented Mar 25, 2022

We can dispatch on NamedTuple{(:f, :y)}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants