romcomma.gpf.mean_functions.MOMeanFunction§
- class MOMeanFunction(output_dim, mean_functions=<gpflow.mean_functions.Zero object>)[source]§
Bases:
MeanFunction
Mean functions for MOGPR. Basically a wrapper for a Sequence of gpflow.mean_functions.MeanFunctions, one for each output_dim. These functions constitute the prior mean predictions f(x) in the absence of any training data.
- Parameters:
output_dim (int) –
mean_functions (Union[MOMeanFunction, MeanFunction, Sequence[MeanFunction]]) –
- __init__(output_dim, mean_functions=<gpflow.mean_functions.Zero object>)[source]§
- Parameters:
output_dim (int) – The number of mean_functions required, also known as L.
mean_functions (MOMeanFunction | MeanFunction | Sequence[MeanFunction]) – Is broadcast to an L-Sequence of functions, giving the prior mean f(x) for each output_dim in turn.
Methods
__init__
(output_dim[, mean_functions])- param output_dim:
The number of mean_functions required, also known as L.
with_name_scope
(method)Decorator to automatically enter the module name scope.
Attributes
L
The sequence of functions defining this MOMeanFunction.
Returns the name of this module as passed or determined in the ctor.
Returns a tf.name_scope instance for this class.
Sequence of non-trainable variables owned by this module and its submodules.
Also known as L.
parameters
Sequence of all sub-modules.
trainable_parameters
Sequence of trainable variables owned by this module and its submodules.
Sequence of variables owned by this module and its submodules.
- property output_dim§
Also known as L.
- property functions§
The sequence of functions defining this MOMeanFunction.
- property name§
Returns the name of this module as passed or determined in the ctor.
NOTE: This is not the same as the self.name_scope.name which includes parent module names.
- property name_scope§
Returns a tf.name_scope instance for this class.
- property non_trainable_variables§
Sequence of non-trainable variables owned by this module and its submodules.
Note: this method uses reflection to find variables on the current instance and submodules. For performance reasons you may wish to cache the result of calling this method if you don’t expect the return value to change.
- Returns:
A sequence of variables for the current module (sorted by attribute name) followed by variables from all submodules recursively (breadth first).
- property submodules§
Sequence of all sub-modules.
Submodules are modules which are properties of this module, or found as properties of modules which are properties of this module (and so on).
>>> a = tf.Module() >>> b = tf.Module() >>> c = tf.Module() >>> a.b = b >>> b.c = c >>> list(a.submodules) == [b, c] True >>> list(b.submodules) == [c] True >>> list(c.submodules) == [] True
- Returns:
A sequence of all submodules.
- property trainable_variables§
Sequence of trainable variables owned by this module and its submodules.
Note: this method uses reflection to find variables on the current instance and submodules. For performance reasons you may wish to cache the result of calling this method if you don’t expect the return value to change.
- Returns:
A sequence of variables for the current module (sorted by attribute name) followed by variables from all submodules recursively (breadth first).
- property variables§
Sequence of variables owned by this module and its submodules.
Note: this method uses reflection to find variables on the current instance and submodules. For performance reasons you may wish to cache the result of calling this method if you don’t expect the return value to change.
- Returns:
A sequence of variables for the current module (sorted by attribute name) followed by variables from all submodules recursively (breadth first).
- classmethod with_name_scope(method)§
Decorator to automatically enter the module name scope.
>>> class MyModule(tf.Module): ... @tf.Module.with_name_scope ... def __call__(self, x): ... if not hasattr(self, 'w'): ... self.w = tf.Variable(tf.random.normal([x.shape[1], 3])) ... return tf.matmul(x, self.w)
Using the above module would produce `tf.Variable`s and `tf.Tensor`s whose names included the module name:
>>> mod = MyModule() >>> mod(tf.ones([1, 2])) <tf.Tensor: shape=(1, 3), dtype=float32, numpy=..., dtype=float32)> >>> mod.w <tf.Variable 'my_module/Variable:0' shape=(2, 3) dtype=float32, numpy=..., dtype=float32)>
- Parameters:
method – The method to wrap.
- Returns:
The original method wrapped such that it enters the module’s name scope.