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

how can I use the hmc method to approximate the non gaussian likelihood, thank you #554

Open
lk1983823 opened this issue Sep 24, 2017 · 6 comments

Comments

@lk1983823
Copy link

lk1983823 commented Sep 24, 2017

I set the Possion distribution pdf as my GP likelihood, and want to use hmc method to infer its parameter. Here is my code as follows:

poisson_likelihood = GPy.likelihoods.Poisson()
kernel = GPy.kern.RBF(input_dim, variance=1.0, lengthscale=1.0)
hmc_inf= GPy.inference.mcmc.HMC()
m = GPy.core.GP(X=train_X_scaled, Y=train_Y_dl_total_scaled, likelihood=poisson_likelihood, inference_method=hmc_inf, kernel= kernel)

the error shows:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-97-6f996d532af2> in <module>()
      3 poisson_likelihood = GPy.likelihoods.Poisson()
      4 kernel = GPy.kern.RBF(input_dim, variance=1.0, lengthscale=1.0)
----> 5 hmc_inf= GPy.inference.mcmc.HMC()
      6 m = GPy.core.GP(X=train_X_scaled, Y=train_Y_dl_total_scaled, likelihood=poisson_likelihood, inference_method=hmc_inf, kernel= kernel)
      7 

TypeError: __init__() missing 1 required positional argument: 'model'

So I want to know is there anyway that I can use the hmc to infer the parameters of an arbitrary likelihood? Thank you for your help!!!

@lk1983823 lk1983823 reopened this Sep 24, 2017
@lk1983823 lk1983823 changed the title how can I use the hmc method to infer the parameter of the likelihood how can I use the hmc method to infer the parameter of the likelihood I set arbitrarily Sep 24, 2017
@lk1983823 lk1983823 changed the title how can I use the hmc method to infer the parameter of the likelihood I set arbitrarily how can I use the hmc method to infer the parameter of the likelihood function I set arbitrarily Sep 24, 2017
@lk1983823 lk1983823 changed the title how can I use the hmc method to infer the parameter of the likelihood function I set arbitrarily how can I use the hmc method to infer the parameter of the likelihood function I set arbitrarily, thank you Sep 24, 2017
@lk1983823 lk1983823 changed the title how can I use the hmc method to infer the parameter of the likelihood function I set arbitrarily, thank you how can I use the hmc method to infer the parameter of the non likelihood function I set arbitrarily, thank you Sep 24, 2017
@lk1983823 lk1983823 changed the title how can I use the hmc method to infer the parameter of the non likelihood function I set arbitrarily, thank you how can I use the hmc method to infer the parameter of the non gaussian likelihood, thank you Sep 24, 2017
@lk1983823 lk1983823 changed the title how can I use the hmc method to infer the parameter of the non gaussian likelihood, thank you how can I use the hmc method to approximate the non gaussian likelihood, thank you Sep 24, 2017
@mu2013
Copy link
Member

mu2013 commented Sep 24, 2017 via email

@lk1983823
Copy link
Author

@mu2013 : Do you mean this "http://nbviewer.jupyter.org/github/SheffieldML/notebook/blob/master/GPy/sampling_hmc.ipynb"? I know that tutorial, but I find it impossible to set the likelihood arbitrarily.

@zhenwendai
Copy link
Member

How would you like to handle the intractable integral of the non-Gaussian likelihood?

You can run HMC for a non-Gaussian likelihood GP with Laplace approximation, but the samples are biased because of the approximation. (This can be done with GPy.)

Alternatively, you can run HMC without marginalizing the output variable of GP prior, f, but it results in very high HMC sampling problem. (This is not implemented.)

@lk1983823
Copy link
Author

@zhenwendai Thank you for your reply. I am a new learner for GP. I can't catch all you have said above. For example "run HMC for a non-Gaussian likelihood GP with Laplace approximation". The reason I ask this question is that I find it possible in GPflow to use GPMC to make mcmc inference "http://gpflow.readthedocs.io/en/latest/notebooks/mcmc.html" , where I can set the likelihood arbitrarily. I just wander why I can't do this using GPy.

@zhenwendai
Copy link
Member

According the link that you provided, GPFlow does the second way that I mentioned previously. Its HMC sampler draw samples for f and model parameters jointly, which is typically super high dimensional.

Unfortunately, GPy does not support it at the moment, because we by default focus on the model with the latent function f marginalized out (apprioximately).

@mu2013
Copy link
Member

mu2013 commented Sep 27, 2017 via email

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

3 participants