mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-05 14:55:15 +02:00
adding limited support for svg to have differnet number of latent functions to columns of Y
This commit is contained in:
parent
49701b33c0
commit
3e4f272808
1 changed files with 7 additions and 3 deletions
|
|
@ -9,7 +9,7 @@ from ..inference.latent_function_inference import SVGP as svgp_inf
|
||||||
|
|
||||||
|
|
||||||
class SVGP(SparseGP):
|
class SVGP(SparseGP):
|
||||||
def __init__(self, X, Y, Z, kernel, likelihood, mean_function=None, name='SVGP', Y_metadata=None, batchsize=None):
|
def __init__(self, X, Y, Z, kernel, likelihood, mean_function=None, name='SVGP', Y_metadata=None, batchsize=None, num_latent_functions=None):
|
||||||
"""
|
"""
|
||||||
Stochastic Variational GP.
|
Stochastic Variational GP.
|
||||||
|
|
||||||
|
|
@ -41,8 +41,12 @@ class SVGP(SparseGP):
|
||||||
SparseGP.__init__(self, X_batch, Y_batch, Z, kernel, likelihood, mean_function=mean_function, inference_method=inf_method,
|
SparseGP.__init__(self, X_batch, Y_batch, Z, kernel, likelihood, mean_function=mean_function, inference_method=inf_method,
|
||||||
name=name, Y_metadata=Y_metadata, normalizer=False)
|
name=name, Y_metadata=Y_metadata, normalizer=False)
|
||||||
|
|
||||||
self.m = Param('q_u_mean', np.zeros((self.num_inducing, Y.shape[1])))
|
#assume the number of latent functions is one per col of Y unless specified
|
||||||
chol = choleskies.triang_to_flat(np.tile(np.eye(self.num_inducing)[:,:,None], (1,1,Y.shape[1])))
|
if num_latent_functions is None:
|
||||||
|
num_latent_functions = Y.shape[1]
|
||||||
|
|
||||||
|
self.m = Param('q_u_mean', np.zeros((self.num_inducing, num_latent_functions)))
|
||||||
|
chol = choleskies.triang_to_flat(np.tile(np.eye(self.num_inducing)[:,:,None], (1,1,num_latent_functions)))
|
||||||
self.chol = Param('q_u_chol', chol)
|
self.chol = Param('q_u_chol', chol)
|
||||||
self.link_parameter(self.chol)
|
self.link_parameter(self.chol)
|
||||||
self.link_parameter(self.m)
|
self.link_parameter(self.m)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue