mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-09 20:12:38 +02:00
renamed TanhWarpingFunction to TanhFunction
This commit is contained in:
parent
50f72f0294
commit
b266b578cd
3 changed files with 5 additions and 5 deletions
|
|
@ -5,7 +5,7 @@ import numpy as np
|
||||||
from ..util.warping_functions import *
|
from ..util.warping_functions import *
|
||||||
from ..core import GP
|
from ..core import GP
|
||||||
from .. import likelihoods
|
from .. import likelihoods
|
||||||
from GPy.util.warping_functions import TanhWarpingFunction
|
from GPy.util.warping_functions import TanhFunction
|
||||||
from GPy import kern
|
from GPy import kern
|
||||||
|
|
||||||
class WarpedGP(GP):
|
class WarpedGP(GP):
|
||||||
|
|
@ -17,7 +17,7 @@ class WarpedGP(GP):
|
||||||
if kernel is None:
|
if kernel is None:
|
||||||
kernel = kern.RBF(X.shape[1])
|
kernel = kern.RBF(X.shape[1])
|
||||||
if warping_function == None:
|
if warping_function == None:
|
||||||
self.warping_function = TanhWarpingFunction(warping_terms)
|
self.warping_function = TanhFunction(warping_terms)
|
||||||
self.warping_params = (np.random.randn(self.warping_function.n_terms * 3 + 1) * 1)
|
self.warping_params = (np.random.randn(self.warping_function.n_terms * 3 + 1) * 1)
|
||||||
else:
|
else:
|
||||||
self.warping_function = warping_function
|
self.warping_function = warping_function
|
||||||
|
|
|
||||||
|
|
@ -319,7 +319,7 @@ class MiscTests(unittest.TestCase):
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
warp_k = GPy.kern.RBF(1)
|
warp_k = GPy.kern.RBF(1)
|
||||||
warp_f = GPy.util.warping_functions.TanhWarpingFunction(n_terms=2)
|
warp_f = GPy.util.warping_functions.TanhFunction(n_terms=2)
|
||||||
warp_m = GPy.models.WarpedGP(X[:, None], Y[:, None], kernel=warp_k, warping_function=warp_f)
|
warp_m = GPy.models.WarpedGP(X[:, None], Y[:, None], kernel=warp_k, warping_function=warp_f)
|
||||||
|
|
||||||
m = GPy.models.GPRegression(X[:, None], Y[:, None])
|
m = GPy.models.GPRegression(X[:, None], Y[:, None])
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ class WarpingFunction(Parameterized):
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
class TanhWarpingFunction(WarpingFunction):
|
class TanhFunction(WarpingFunction):
|
||||||
|
|
||||||
def __init__(self, n_terms=3, initial_y=None):
|
def __init__(self, n_terms=3, initial_y=None):
|
||||||
"""
|
"""
|
||||||
|
|
@ -59,7 +59,7 @@ class TanhWarpingFunction(WarpingFunction):
|
||||||
self.num_parameters = 3 * self.n_terms + 1
|
self.num_parameters = 3 * self.n_terms + 1
|
||||||
self.psi = np.ones((self.n_terms, 3))
|
self.psi = np.ones((self.n_terms, 3))
|
||||||
|
|
||||||
super(TanhWarpingFunction, self).__init__(name='warp_tanh')
|
super(TanhFunction, self).__init__(name='warp_tanh')
|
||||||
self.psi = Param('psi', self.psi)
|
self.psi = Param('psi', self.psi)
|
||||||
self.psi[:, :2].constrain_positive()
|
self.psi[:, :2].constrain_positive()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue