mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-07 19:12:40 +02:00
[cacher] now taking over the attributes from cached functions, such as docstring
This commit is contained in:
parent
9b3498a912
commit
4f89c25321
2 changed files with 11 additions and 2 deletions
|
|
@ -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)
|
||||||
|
|
||||||
|
|
@ -311,7 +318,7 @@ class Matern52(Stationary):
|
||||||
|
|
||||||
class ExpQuad(Stationary):
|
class ExpQuad(Stationary):
|
||||||
"""
|
"""
|
||||||
The Exponentiated quadratic covariance function.
|
The Exponentiated quadratic covariance function.
|
||||||
|
|
||||||
.. math::
|
.. math::
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue