From 747d24d2fa44502caf61efcc2cebbbb16bfb9680 Mon Sep 17 00:00:00 2001 From: mzwiessele Date: Thu, 13 Oct 2016 12:19:59 +0100 Subject: [PATCH 1/2] chg: added polynomial basis func kernel --- GPy/kern/src/basis_funcs.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/GPy/kern/src/basis_funcs.py b/GPy/kern/src/basis_funcs.py index 5d589aa6..bbd6ab17 100644 --- a/GPy/kern/src/basis_funcs.py +++ b/GPy/kern/src/basis_funcs.py @@ -102,6 +102,26 @@ class BasisFuncKernel(Kern): phi2 = phi2[:, None] return phi1.dot(phi2.T) +class PolinomialBasisFuncKernel(BasisFuncKernel): + def __init__(self, input_dim, degree, variance=1., active_dims=None, ARD=True, name='polinomial_basis'): + """ + A linear segment transformation. The segments start at start, \ + are then linear to stop and constant again. The segments are + normalized, so that they have exactly as much mass above + as below the origin. + + Start and stop can be tuples or lists of starts and stops. + Behaviour of start stop is as np.where(X Date: Thu, 13 Oct 2016 12:31:39 +0100 Subject: [PATCH 2/2] new: added ploy basis kernel tests and import --- GPy/kern/__init__.py | 2 +- GPy/kern/src/basis_funcs.py | 6 +++--- GPy/testing/kernel_tests.py | 7 +++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/GPy/kern/__init__.py b/GPy/kern/__init__.py index 164b66b7..d8239910 100644 --- a/GPy/kern/__init__.py +++ b/GPy/kern/__init__.py @@ -32,7 +32,7 @@ from .src.trunclinear import TruncLinear,TruncLinear_inf from .src.splitKern import SplitKern,DEtime from .src.splitKern import DEtime as DiffGenomeKern from .src.spline import Spline -from .src.basis_funcs import LogisticBasisFuncKernel, LinearSlopeBasisFuncKernel, BasisFuncKernel, ChangePointBasisFuncKernel, DomainKernel +from .src.basis_funcs import LogisticBasisFuncKernel, LinearSlopeBasisFuncKernel, BasisFuncKernel, ChangePointBasisFuncKernel, DomainKernel, PolynomialBasisFuncKernel from .src.grid_kerns import GridRBF from .src.sde_matern import sde_Matern32 diff --git a/GPy/kern/src/basis_funcs.py b/GPy/kern/src/basis_funcs.py index bbd6ab17..569a12f1 100644 --- a/GPy/kern/src/basis_funcs.py +++ b/GPy/kern/src/basis_funcs.py @@ -102,8 +102,8 @@ class BasisFuncKernel(Kern): phi2 = phi2[:, None] return phi1.dot(phi2.T) -class PolinomialBasisFuncKernel(BasisFuncKernel): - def __init__(self, input_dim, degree, variance=1., active_dims=None, ARD=True, name='polinomial_basis'): +class PolynomialBasisFuncKernel(BasisFuncKernel): + def __init__(self, input_dim, degree, variance=1., active_dims=None, ARD=True, name='polynomial_basis'): """ A linear segment transformation. The segments start at start, \ are then linear to stop and constant again. The segments are @@ -114,7 +114,7 @@ class PolinomialBasisFuncKernel(BasisFuncKernel): Behaviour of start stop is as np.where(X