mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-08 03:22:38 +02:00
Minor edits
This commit is contained in:
parent
4dcf2b85ce
commit
c003b2f34d
3 changed files with 7 additions and 3 deletions
|
|
@ -9,7 +9,7 @@ import pylab as pb
|
||||||
import datetime as dt
|
import datetime as dt
|
||||||
|
|
||||||
class Optimizer():
|
class Optimizer():
|
||||||
def __init__(self, x_init, f_fp, f, fp , messages = False, max_f_eval = 1e4, ftol = None, gtol = None, xtol = None):
|
def __init__(self, x_init, f_fp, f, fp , messages=False, max_f_eval=1e4, ftol=None, gtol=None, xtol=None):
|
||||||
"""
|
"""
|
||||||
Superclass for all the optimizers.
|
Superclass for all the optimizers.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ class sparse_GP_regression(GP_regression):
|
||||||
:type normalize_(X|Y): bool
|
:type normalize_(X|Y): bool
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,X,Y,kernel=None, beta=100., Z=None,Zslices=None,M=10,normalize_X=False,normalize_Y=False):
|
def __init__(self,X,Y,kernel=None, X_uncertainty=None, beta=100., Z=None,Zslices=None,M=10,normalize_X=False,normalize_Y=False):
|
||||||
self.beta = beta
|
self.beta = beta
|
||||||
if Z is None:
|
if Z is None:
|
||||||
self.Z = np.random.permutation(X.copy())[:M]
|
self.Z = np.random.permutation(X.copy())[:M]
|
||||||
|
|
@ -56,6 +56,10 @@ class sparse_GP_regression(GP_regression):
|
||||||
GP_regression.__init__(self, X, Y, kernel=kernel, normalize_X=normalize_X, normalize_Y=normalize_Y)
|
GP_regression.__init__(self, X, Y, kernel=kernel, normalize_X=normalize_X, normalize_Y=normalize_Y)
|
||||||
self.trYYT = np.sum(np.square(self.Y))
|
self.trYYT = np.sum(np.square(self.Y))
|
||||||
|
|
||||||
|
#normalise X uncertainty also
|
||||||
|
if self.has_uncertain_inputs:
|
||||||
|
self.X_uncertainty /= np.square(self._Xstd)
|
||||||
|
|
||||||
def set_param(self, p):
|
def set_param(self, p):
|
||||||
self.Z = p[:self.M*self.Q].reshape(self.M, self.Q)
|
self.Z = p[:self.M*self.Q].reshape(self.M, self.Q)
|
||||||
self.beta = p[self.M*self.Q]
|
self.beta = p[self.M*self.Q]
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2012, GPy authors (see AUTHORS.txt).
|
# Copyright (c) 2012 James Hensman
|
||||||
# Licensed under the BSD 3-clause license (see LICENSE.txt)
|
# Licensed under the BSD 3-clause license (see LICENSE.txt)
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue