Merge branch 'params' of github.com:SheffieldML/GPy into params

This commit is contained in:
James Hensman 2014-02-24 14:57:29 +00:00
commit d47192664f
2 changed files with 19 additions and 2 deletions

View file

@ -215,7 +215,7 @@ class Cosine(Stationary):
def __init__(self, input_dim, variance=1., lengthscale=None, ARD=False, name='Cosine'):
super(Cosine, self).__init__(input_dim, variance, lengthscale, ARD, name)
def K_of_r(self, r)
def K_of_r(self, r):
return self.variance * np.cos(r)
def dK_dr(self, r):
@ -238,7 +238,7 @@ class RatQuad(Stationary):
self.power = Param('power', power, Logexp())
self.add_parameters(self.power)
def K_of_r(self, r)
def K_of_r(self, r):
return self.variance*(1. + r**2/2.)**(-self.power)
def dK_dr(self, r):

View file

@ -0,0 +1,17 @@
'''
Created on 24 Feb 2014
@author: maxz
'''
import numpy as np
from linalg import PCA
def initialize_latent(init, input_dim, Y):
Xr = np.random.randn(Y.shape[0], input_dim)
if init == 'PCA':
PC = PCA(Y, input_dim)[0]
Xr[:PC.shape[0], :PC.shape[1]] = PC
else:
pass
return Xr