gpflow.mean_functions

Throughout GPflow, by default, latent functions being modelled with Gaussian processes are assumed to have zero mean, f ~ GP(0, k(x,x’)).

In some cases we may wish to model only the deviation from a fixed function with a Gaussian process. For flexibility this fixed function could be both input dependent and parameterised function, μ(x; θ), with some unknown parameters θ, resulting in f ~ GP(μ(x;θ), k(x,x’)).

The GPflow MeanFunction class allows this to be done whilst additionally learning parameters of the parametric function.

gpflow.mean_functions.Additive

class gpflow.mean_functions.Additive(first_part, second_part)[source]

Bases: gpflow.mean_functions.MeanFunction

Attributes
name

Returns the name of this module as passed or determined in the ctor.

name_scope

Returns a tf.name_scope instance for this class.

non_trainable_variables

Sequence of non-trainable variables owned by this module and its submodules.

parameters
submodules

Sequence of all sub-modules.

trainable_parameters
trainable_variables

Sequence of trainable variables owned by this module and its submodules.

variables

Sequence of variables owned by this module and its submodules.

Methods

__call__(X)

Call self as a function.

with_name_scope(method)

Decorator to automatically enter the module name scope.

Parameters

gpflow.mean_functions.Constant

class gpflow.mean_functions.Constant(c=None)[source]

Bases: gpflow.mean_functions.MeanFunction

Attributes
name

Returns the name of this module as passed or determined in the ctor.

name_scope

Returns a tf.name_scope instance for this class.

non_trainable_variables

Sequence of non-trainable variables owned by this module and its submodules.

parameters
submodules

Sequence of all sub-modules.

trainable_parameters
trainable_variables

Sequence of trainable variables owned by this module and its submodules.

variables

Sequence of variables owned by this module and its submodules.

Methods

__call__(X)

Call self as a function.

with_name_scope(method)

Decorator to automatically enter the module name scope.

Parameters

c (Union[ndarray, Tensor, Variable, Parameter, None]) –

gpflow.mean_functions.Identity

class gpflow.mean_functions.Identity(input_dim=None)[source]

Bases: gpflow.mean_functions.Linear

y_i = x_i

Attributes
A
b
name

Returns the name of this module as passed or determined in the ctor.

name_scope

Returns a tf.name_scope instance for this class.

non_trainable_variables

Sequence of non-trainable variables owned by this module and its submodules.

parameters
submodules

Sequence of all sub-modules.

trainable_parameters
trainable_variables

Sequence of trainable variables owned by this module and its submodules.

variables

Sequence of variables owned by this module and its submodules.

Methods

__call__(X)

Call self as a function.

with_name_scope(method)

Decorator to automatically enter the module name scope.

Parameters

input_dim (Optional[int]) –

gpflow.mean_functions.Linear

class gpflow.mean_functions.Linear(A=None, b=None)[source]

Bases: gpflow.mean_functions.MeanFunction

y_i = A x_i + b

Attributes
name

Returns the name of this module as passed or determined in the ctor.

name_scope

Returns a tf.name_scope instance for this class.

non_trainable_variables

Sequence of non-trainable variables owned by this module and its submodules.

parameters
submodules

Sequence of all sub-modules.

trainable_parameters
trainable_variables

Sequence of trainable variables owned by this module and its submodules.

variables

Sequence of variables owned by this module and its submodules.

Methods

__call__(X)

Call self as a function.

with_name_scope(method)

Decorator to automatically enter the module name scope.

Parameters
  • A (Union[ndarray, Tensor, Variable, Parameter, None]) –

  • b (Union[ndarray, Tensor, Variable, Parameter, None]) –

gpflow.mean_functions.MeanFunction

class gpflow.mean_functions.MeanFunction(name=None)[source]

Bases: gpflow.base.Module

The base mean function class. To implement a mean function, write the __call__ method. This takes a tensor X and returns a tensor m(X). In accordance with the GPflow standard, each row of X represents one datum, and each row of Y is computed independently for each row of X.

MeanFunction classes can have parameters, see the Linear class for an example.

Attributes
name

Returns the name of this module as passed or determined in the ctor.

name_scope

Returns a tf.name_scope instance for this class.

non_trainable_variables

Sequence of non-trainable variables owned by this module and its submodules.

parameters
submodules

Sequence of all sub-modules.

trainable_parameters
trainable_variables

Sequence of trainable variables owned by this module and its submodules.

variables

Sequence of variables owned by this module and its submodules.

Methods

__call__(X)

Call self as a function.

with_name_scope(method)

Decorator to automatically enter the module name scope.

gpflow.mean_functions.Product

class gpflow.mean_functions.Product(first_part, second_part)[source]

Bases: gpflow.mean_functions.MeanFunction

Attributes
name

Returns the name of this module as passed or determined in the ctor.

name_scope

Returns a tf.name_scope instance for this class.

non_trainable_variables

Sequence of non-trainable variables owned by this module and its submodules.

parameters
submodules

Sequence of all sub-modules.

trainable_parameters
trainable_variables

Sequence of trainable variables owned by this module and its submodules.

variables

Sequence of variables owned by this module and its submodules.

Methods

__call__(X)

Call self as a function.

with_name_scope(method)

Decorator to automatically enter the module name scope.

Parameters

gpflow.mean_functions.SwitchedMeanFunction

class gpflow.mean_functions.SwitchedMeanFunction(meanfunction_list)[source]

Bases: gpflow.mean_functions.MeanFunction

This class enables to use different (independent) mean_functions respective to the data ‘label’. We assume the ‘label’ is stored in the extra column of X.

Attributes
name

Returns the name of this module as passed or determined in the ctor.

name_scope

Returns a tf.name_scope instance for this class.

non_trainable_variables

Sequence of non-trainable variables owned by this module and its submodules.

parameters
submodules

Sequence of all sub-modules.

trainable_parameters
trainable_variables

Sequence of trainable variables owned by this module and its submodules.

variables

Sequence of variables owned by this module and its submodules.

Methods

__call__(X)

Call self as a function.

with_name_scope(method)

Decorator to automatically enter the module name scope.

Parameters

meanfunction_list (Collection[MeanFunction]) –

gpflow.mean_functions.Zero

class gpflow.mean_functions.Zero(output_dim=1)[source]

Bases: gpflow.mean_functions.Constant

Attributes
name

Returns the name of this module as passed or determined in the ctor.

name_scope

Returns a tf.name_scope instance for this class.

non_trainable_variables

Sequence of non-trainable variables owned by this module and its submodules.

parameters
submodules

Sequence of all sub-modules.

trainable_parameters
trainable_variables

Sequence of trainable variables owned by this module and its submodules.

variables

Sequence of variables owned by this module and its submodules.

Methods

__call__(X)

Call self as a function.

with_name_scope(method)

Decorator to automatically enter the module name scope.

Parameters

output_dim (int) –