minor edit in scg, raise notimplemented dL_dX in hierarchical

This commit is contained in:
James Hensman 2014-05-14 10:04:58 +01:00
parent 53ff580a6e
commit ec70fef780
2 changed files with 4 additions and 1 deletions

View file

@ -32,7 +32,7 @@ def print_out(len_maxiters, fnow, current_grad, beta, iteration):
sys.stdout.flush() sys.stdout.flush()
def exponents(fnow, current_grad): def exponents(fnow, current_grad):
exps = [np.abs(fnow), current_grad] exps = [np.abs(np.float(fnow)), current_grad]
return np.sign(exps) * np.log10(exps).astype(int) return np.sign(exps) * np.log10(exps).astype(int)
def SCG(f, gradf, x, optargs=(), maxiters=500, max_f_eval=np.inf, display=True, xtol=None, ftol=None, gtol=None): def SCG(f, gradf, x, optargs=(), maxiters=500, max_f_eval=np.inf, display=True, xtol=None, ftol=None, gtol=None):

View file

@ -180,6 +180,9 @@ class Hierarchical(CombinationKernel):
def Kdiag(self,X): def Kdiag(self,X):
return np.diag(self.K(X)) return np.diag(self.K(X))
def gradients_X(self, dL_dK, X, X2=None):
raise NotImplementedError
def update_gradients_full(self,dL_dK,X,X2=None): def update_gradients_full(self,dL_dK,X,X2=None):
slices = [index_to_slices(X[:,i]) for i in self.extra_dims] slices = [index_to_slices(X[:,i]) for i in self.extra_dims]
if X2 is None: if X2 is None: