mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-08 15:05:15 +02:00
Merge ce2b15481b into 38bffb154c
This commit is contained in:
commit
f653711a4b
6 changed files with 30 additions and 4 deletions
|
|
@ -63,7 +63,7 @@ def randomize(self, rand_gen=None, *args, **kwargs):
|
|||
Make this draw from the prior if one exists, else draw from given random generator
|
||||
|
||||
:param rand_gen: np random number generator which takes args and kwargs
|
||||
:param flaot loc: loc parameter for random number generator
|
||||
:param float loc: loc parameter for random number generator
|
||||
:param float scale: scale parameter for random number generator
|
||||
:param args, kwargs: will be passed through to random number generator
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@ class Coregionalize(Kern):
|
|||
input_dict["W"] = self.W.values.tolist()
|
||||
input_dict["kappa"] = self.kappa.values.tolist()
|
||||
input_dict["output_dim"] = self.output_dim
|
||||
input_dict["rank"] = self.rank
|
||||
return input_dict
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
|
|
@ -40,6 +40,13 @@ class Periodic(Kern):
|
|||
return alpha*np.cos(omega*x + phase)
|
||||
return f
|
||||
|
||||
def _save_to_input_dict(self):
|
||||
input_dict = super(Periodic, self)._save_to_input_dict()
|
||||
input_dict["variance"] = self.variance.values.tolist()
|
||||
input_dict["lengthscale"] = self.lengthscale.values.tolist()
|
||||
input_dict["period"] = self.period.values.tolist()
|
||||
return input_dict
|
||||
|
||||
@silence_errors
|
||||
def _cos_factorization(self, alpha, omega, phase):
|
||||
r1 = np.sum(alpha*np.cos(phase),axis=1)[:,None]
|
||||
|
|
@ -200,6 +207,24 @@ class PeriodicMatern32(Periodic):
|
|||
self.G = self.Gram_matrix()
|
||||
self.Gi = np.linalg.inv(self.G)
|
||||
|
||||
def to_dict(self):
|
||||
"""
|
||||
Convert the object into a json serializable dictionary.
|
||||
|
||||
Note: It uses the private method _save_to_input_dict of the parent.
|
||||
|
||||
:return dict: json serializable dictionary containing the needed information to instantiate the object
|
||||
"""
|
||||
|
||||
input_dict = super(PeriodicMatern32, self)._save_to_input_dict()
|
||||
input_dict["class"] = "GPy.kern.PeriodicMatern32"
|
||||
return input_dict
|
||||
|
||||
@staticmethod
|
||||
def _build_from_input_dict(kernel_class, input_dict):
|
||||
useGPU = input_dict.pop('useGPU', None)
|
||||
return kernel_class(**input_dict)
|
||||
|
||||
def Gram_matrix(self):
|
||||
La = np.column_stack((self.a[0]*np.ones((self.n_basis,1)),self.a[1]*self.basis_omega,self.a[2]*self.basis_omega**2))
|
||||
Lo = np.column_stack((self.basis_omega,self.basis_omega,self.basis_omega))
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class GPCoregionalizedRegression(GP):
|
|||
:type likelihoods_list: None | a list GPy.likelihoods
|
||||
:param name: model name
|
||||
:type name: string
|
||||
:param W_rank: number tuples of the corregionalization parameters 'W' (see coregionalize kernel documentation)
|
||||
:param W_rank: number tuples of the coregionalization parameters 'W' (see coregionalize kernel documentation)
|
||||
:type W_rank: integer
|
||||
:param kernel_name: name of the kernel
|
||||
:type kernel_name: string
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class SparseGPCoregionalizedRegression(SparseGP):
|
|||
|
||||
:param name: model name
|
||||
:type name: string
|
||||
:param W_rank: number tuples of the corregionalization parameters 'W' (see coregionalize kernel documentation)
|
||||
:param W_rank: number tuples of the coregionalization parameters 'W' (see coregionalize kernel documentation)
|
||||
:type W_rank: integer
|
||||
:param kernel_name: name of the kernel
|
||||
:type kernel_name: string
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ def ICM(input_dim, num_outputs, kernel, W_rank=1, W=None, kappa=None, name="ICM"
|
|||
:num_outputs: Number of outputs
|
||||
:param kernel: kernel that will be multiplied by the coregionalize kernel (matrix B).
|
||||
:type kernel: a GPy kernel
|
||||
:param W_rank: number tuples of the corregionalization parameters 'W'
|
||||
:param W_rank: number tuples of the coregionalization parameters 'W'
|
||||
:type W_rank: integer
|
||||
"""
|
||||
if kernel.input_dim != input_dim:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue