[cacher] now taking over the attributes from cached functions, such as docstring

This commit is contained in:
Max Zwiessele 2014-10-16 12:41:02 +01:00
parent 9b3498a912
commit 4f89c25321
2 changed files with 11 additions and 2 deletions

View file

@ -71,6 +71,13 @@ class Stationary(Kern):
@Cache_this(limit=5, ignore_args=()) @Cache_this(limit=5, ignore_args=())
def K(self, X, X2=None): def K(self, X, X2=None):
"""
Kernel function applied on inputs X and X2.
In the stationary case there is an inner function depending on the
distances from X to X2, called r.
K(X, X2) = K_of_r((X-X2)**2)
"""
r = self._scaled_dist(X, X2) r = self._scaled_dist(X, X2)
return self.K_of_r(r) return self.K_of_r(r)

View file

@ -188,4 +188,6 @@ class Cache_this(object):
self.ignore_args = ignore_args self.ignore_args = ignore_args
self.force_args = force_kwargs self.force_args = force_kwargs
def __call__(self, f): def __call__(self, f):
return Cacher_wrap(f, self.limit, self.ignore_args, self.force_args) newf = Cacher_wrap(f, self.limit, self.ignore_args, self.force_args)
update_wrapper(newf, f)
return newf