Added mlp mapping (with possibility of having multiple layers).

This commit is contained in:
Neil Lawrence 2013-08-29 19:26:00 +02:00
parent e6739788ea
commit 128ebbabc5
12 changed files with 187 additions and 17 deletions

View file

@ -69,6 +69,40 @@ def mlp(input_dim,variance=1., weight_variance=None,bias_variance=100.,ARD=False
part = parts.mlp.MLP(input_dim,variance,weight_variance,bias_variance,ARD)
return kern(input_dim, [part])
# def gibbs(input_dim,variance=1., mapping=None):
# """
# Gibbs and MacKay non-stationary covariance function.
# .. math::
# r = sqrt((x_i - x_j)'*(x_i - x_j))
# k(x_i, x_j) = \sigma^2*Z*exp(-r^2/(l(x)*l(x) + l(x')*l(x')))
# Z = \sqrt{2*l(x)*l(x')/(l(x)*l(x) + l(x')*l(x')}
# where :math:`l(x)` is a function giving the length scale as a function of space.
# This is the non stationary kernel proposed by Mark Gibbs in his 1997
# thesis. It is similar to an RBF but has a length scale that varies
# with input location. This leads to an additional term in front of
# the kernel.
# The parameters are :math:`\sigma^2`, the process variance, and the parameters of l(x) which is a function that can be specified by the user, by default an multi-layer peceptron is used is used.
# :param input_dim: the number of input dimensions
# :type input_dim: int
# :param variance: the variance :math:`\sigma^2`
# :type variance: float
# :param mapping: the mapping that gives the lengthscale across the input space.
# :type mapping: GPy.core.Mapping
# :param ARD: Auto Relevance Determination. If equal to "False", the kernel is isotropic (ie. one weight variance parameter \sigma^2_w), otherwise there is one weight variance parameter per dimension.
# :type ARD: Boolean
# :rtype: Kernpart object
# """
# part = parts.gibbs.Gibbs(input_dim,variance,mapping)
# return kern(input_dim, [part])
def poly(input_dim,variance=1., weight_variance=None,bias_variance=1.,degree=2, ARD=False):
"""
Construct a polynomial kernel
@ -312,10 +346,10 @@ def coregionalise(output_dim, rank=1, W=None, kappa=None):
Used for computing covariance functions of the form
.. math::
k_2(x, y)=B k(x, y)
k_2(x, y)=\mathbf{B} k(x, y)
where
.. math::
B = WW^\top + kappa I..
\mathbf{B} = \mathbf{W}\mathbf{W}^\top + kappa \mathbf{I}
:param output_dim: the number of output dimensions
:type output_dim: int

View file

@ -4,6 +4,7 @@ import coregionalise
import exponential
import finite_dimensional
import fixed
import gibbs
import independent_outputs
import linear
import Matern32