[plotting&kern] bugfixes in plotting and kernel size

This commit is contained in:
Max Zwiessele 2016-01-22 11:26:29 +00:00
parent 1bda209469
commit 7b5422b694
5 changed files with 21 additions and 17 deletions

View file

@ -61,12 +61,12 @@ class Kern(Parameterized):
self.psicomp = PSICOMP_GH()
def __setstate__(self, state):
self._all_dims_active = range(0, max(state['active_dims'])+1)
self._all_dims_active = np.arange(0, max(state['active_dims'])+1)
super(Kern, self).__setstate__(state)
@property
def _effective_input_dim(self):
return self._all_dims_active.size
return np.size(self._all_dims_active)
@Cache_this(limit=20)
def _slice_X(self, X):

View file

@ -97,7 +97,7 @@ class Stationary(Kern):
r = self._scaled_dist(X, X2)
return self.K_of_r(r)
@Cache_this(limit=20, ignore_args=())
@Cache_this(limit=3, ignore_args=())
def dK_dr_via_X(self, X, X2):
#a convenience function, so we can cache dK_dr
return self.dK_dr(self._scaled_dist(X, X2))
@ -127,7 +127,7 @@ class Stationary(Kern):
r2 = np.clip(r2, 0, np.inf)
return np.sqrt(r2)
@Cache_this(limit=20, ignore_args=())
@Cache_this(limit=3, ignore_args=())
def _scaled_dist(self, X, X2=None):
"""
Efficiently compute the scaled distance, r.