gpflow.config

This is a private module that manages GPflow configuration.

The module provides functions to modify default settings of GPflow, such as: - the standard float precision and integer type - the type of positive transformation - a value for a minimum shift from zero for the positive transformation - an output format for gpflow.utilities.print_summary

The module holds global configuration Config variable that stores all setting values.

Environment variables are an alternative way for changing the default GPflow configuration.

Warning

The user has to set environment variables before running python interpreter to modify the configuration.

Full set of environment variables and available options:

  • GPFLOW_INT: “int16”, “int32”, or “int64”

  • GPFLOW_FLOAT: “float16”, “float32”, or “float64”

  • GPFLOW_POSITIVE_BIJECTOR: “exp” or “softplus”

  • GPFLOW_POSITIVE_MINIMUM: Any positive float number

  • GPFLOW_SUMMARY_FMT: “notebook” or any other format that tabulate can handle.

  • GPFLOW_JITTER: Any positive float number

The user can also change the GPflow configuration temporarily with a context manager as_context():

>>> config = Config(jitter=1e-5)
>>> with as_context(config):
>>>     # ...code here sees new config

gpflow.config.Config

class gpflow.config.Config(int=<factory>, float=<factory>, jitter=<factory>, positive_bijector=<factory>, positive_minimum=<factory>, summary_fmt=<factory>)[source]

Bases: object

Immutable object for storing global GPflow settings

Args:

int: Integer data type, int32 or int64. float: Float data type, float32 or float64 jitter: Jitter value. Mainly used for for making badly conditioned matrices more stable.

Default value is 1e-6.

positive_bijector: Method for positive bijector, either “softplus” or “exp”.

Default is “softplus”.

positive_minimum: Lower bound for the positive transformation. summary_fmt: Summary format for module printing.

Parameters
  • int (type) –

  • float (type) –

  • jitter (float) –

  • positive_bijector (str) –

  • positive_minimum (float) –

  • summary_fmt (Optional[str]) –

gpflow.config.as_context

gpflow.config.as_context(temporary_config=None)[source]

Ensure that global configs defaults, with a context manager. Useful for testing.

Parameters

temporary_config (Optional[Config]) –

Return type

Generator[None, None, None]

gpflow.config.config

gpflow.config.config()[source]

Returns current active config.

Return type

Config

gpflow.config.default_positive_bijector

gpflow.config.default_positive_bijector()[source]

Type of bijector used for positive constraints: exp or softplus.

Return type

str

gpflow.config.default_positive_minimum

gpflow.config.default_positive_minimum()[source]

Shift constant that GPflow adds to all positive constraints.

Return type

float

gpflow.config.positive_bijector_type_map

gpflow.config.positive_bijector_type_map()[source]
Return type

Dict[str, type]

gpflow.config.set_config

gpflow.config.set_config(new_config)[source]

Update GPflow config with new settings from new_config.

Parameters

new_config (Config) –

Return type

None

gpflow.config.set_default_float

gpflow.config.set_default_float(value_type)[source]

Sets default float type. Available options are np.float16, np.float32, or np.float64.

Parameters

value_type (type) –

Return type

None

gpflow.config.set_default_int

gpflow.config.set_default_int(value_type)[source]

Sets default integer type. Available options are np.int16, np.int32, or np.int64.

Parameters

value_type (type) –

Return type

None

gpflow.config.set_default_jitter

gpflow.config.set_default_jitter(value)[source]

Sets constant jitter value. The jitter is a constant that GPflow adds to the diagonal of matrices to achieve numerical stability of the system when the condition number of the associated matrices is large, and therefore the matrices nearly singular.

Parameters

value (float) –

Return type

None

gpflow.config.set_default_positive_bijector

gpflow.config.set_default_positive_bijector(value)[source]

Sets positive bijector type. There are currently two options implemented: “exp” and “softplus”.

Parameters

value (str) –

Return type

None

gpflow.config.set_default_positive_minimum

gpflow.config.set_default_positive_minimum(value)[source]

Sets shift constant for positive transformation.

Parameters

value (float) –

Return type

None

gpflow.config.set_default_summary_fmt

gpflow.config.set_default_summary_fmt(value)[source]
Parameters

value (Optional[str]) –

Return type

None