mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-05 14:55:15 +02:00
Merge branch 'params' of github.com:SheffieldML/GPy into params
This commit is contained in:
commit
d47192664f
2 changed files with 19 additions and 2 deletions
|
|
@ -215,7 +215,7 @@ class Cosine(Stationary):
|
||||||
def __init__(self, input_dim, variance=1., lengthscale=None, ARD=False, name='Cosine'):
|
def __init__(self, input_dim, variance=1., lengthscale=None, ARD=False, name='Cosine'):
|
||||||
super(Cosine, self).__init__(input_dim, variance, lengthscale, ARD, name)
|
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)
|
return self.variance * np.cos(r)
|
||||||
|
|
||||||
def dK_dr(self, r):
|
def dK_dr(self, r):
|
||||||
|
|
@ -238,7 +238,7 @@ class RatQuad(Stationary):
|
||||||
self.power = Param('power', power, Logexp())
|
self.power = Param('power', power, Logexp())
|
||||||
self.add_parameters(self.power)
|
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)
|
return self.variance*(1. + r**2/2.)**(-self.power)
|
||||||
|
|
||||||
def dK_dr(self, r):
|
def dK_dr(self, r):
|
||||||
|
|
|
||||||
17
GPy/util/initialization.py
Normal file
17
GPy/util/initialization.py
Normal 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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue