2014-08-15 18:22:09 +01:00
|
|
|
# Copyright (c) 2014, James Hensman, Alan Saul
|
2015-09-07 17:26:27 +01:00
|
|
|
# Licensed under the BSD 3-clause license (see LICENSE.txt)
|
2014-08-15 18:22:09 +01:00
|
|
|
|
|
|
|
|
import numpy as np
|
2015-08-18 11:39:27 +01:00
|
|
|
from ..core import GP
|
2014-08-15 18:22:09 +01:00
|
|
|
from ..core.parameterization.param import Param
|
2015-08-18 11:39:27 +01:00
|
|
|
from ..inference.latent_function_inference import VarGauss
|
2014-08-15 18:22:09 +01:00
|
|
|
|
|
|
|
|
log_2_pi = np.log(2*np.pi)
|
|
|
|
|
|
|
|
|
|
|
2015-08-18 11:39:27 +01:00
|
|
|
class GPVariationalGaussianApproximation(GP):
|
2014-08-15 18:22:09 +01:00
|
|
|
"""
|
2015-07-16 15:36:17 +01:00
|
|
|
The Variational Gaussian Approximation revisited
|
2014-08-15 18:22:09 +01:00
|
|
|
|
2020-04-02 15:51:41 +01:00
|
|
|
.. rubric:: References
|
|
|
|
|
|
|
|
|
|
.. [opper_archambeau_2009] Opper, M.; Archambeau, C.; The Variational Gaussian Approximation Revisited. Neural Comput. 2009, pages 786-792.
|
2014-08-15 18:22:09 +01:00
|
|
|
"""
|
2015-08-18 11:39:27 +01:00
|
|
|
def __init__(self, X, Y, kernel, likelihood, Y_metadata=None):
|
2015-07-16 15:36:17 +01:00
|
|
|
|
2015-08-18 11:39:27 +01:00
|
|
|
num_data = Y.shape[0]
|
|
|
|
|
self.alpha = Param('alpha', np.zeros((num_data,1))) # only one latent fn for now.
|
|
|
|
|
self.beta = Param('beta', np.ones(num_data))
|
|
|
|
|
|
|
|
|
|
inf = VarGauss(self.alpha, self.beta)
|
2015-09-25 11:15:18 +01:00
|
|
|
super(GPVariationalGaussianApproximation, self).__init__(X, Y, kernel, likelihood, name='VarGP', inference_method=inf, Y_metadata=Y_metadata)
|
2014-08-15 18:22:09 +01:00
|
|
|
|
2014-09-08 08:57:28 +01:00
|
|
|
self.link_parameter(self.alpha)
|
|
|
|
|
self.link_parameter(self.beta)
|