Skip to content

Continuous Functions

gpjax.decision_making.test_functions.continuous_functions

AbstractContinuousTestFunction dataclass

Bases: AbstractMeanFunction

Abstract base class for continuous test functions.

Attributes:

Name Type Description
search_space ContinuousSearchSpace

Search space for the function.

minimizer Float[Array, '1 D']

Minimizer of the function (to 5 decimal places)

minimum Float[Array, '1 1']

Minimum of the function (to 5 decimal places).

search_space: ContinuousSearchSpace instance-attribute
minimizer: Float[Array, '1 D'] instance-attribute
minimum: Float[Array, '1 1'] instance-attribute
__init_subclass__(mutable: bool = False)
replace(**kwargs: Any) -> Self

Replace the values of the fields of the object.

Parameters:

Name Type Description Default
**kwargs Any

keyword arguments to replace the fields of the object.

{}
Returns
Module: with the fields replaced.
replace_meta(**kwargs: Any) -> Self

Replace the metadata of the fields.

Parameters:

Name Type Description Default
**kwargs Any

keyword arguments to replace the metadata of the fields of the object.

{}
Returns
Module: with the metadata of the fields replaced.
update_meta(**kwargs: Any) -> Self

Update the metadata of the fields. The metadata must already exist.

Parameters:

Name Type Description Default
**kwargs Any

keyword arguments to replace the fields of the object.

{}
Returns
Module: with the fields replaced.
replace_trainable(**kwargs: Dict[str, bool]) -> Self

Replace the trainability status of local nodes of the Module.

replace_bijector(**kwargs: Dict[str, tfb.Bijector]) -> Self

Replace the bijectors of local nodes of the Module.

constrain() -> Self

Transform model parameters to the constrained space according to their defined bijectors.

Returns
Module: transformed to the constrained space.
unconstrain() -> Self

Transform model parameters to the unconstrained space according to their defined bijectors.

Returns
Module: transformed to the unconstrained space.
stop_gradient() -> Self

Stop gradients flowing through the Module.

Returns
Module: with gradients stopped.
trainables() -> Self
__add__(other: Union[AbstractMeanFunction, Float[Array, ' O']]) -> AbstractMeanFunction

Add two mean functions.

Parameters:

Name Type Description Default
other AbstractMeanFunction

The other mean function to add.

required
Returns
AbstractMeanFunction: The sum of the two mean functions.
__radd__(other: Union[AbstractMeanFunction, Float[Array, ' O']]) -> AbstractMeanFunction

Add two mean functions.

Parameters:

Name Type Description Default
other AbstractMeanFunction

The other mean function to add.

required
Returns
AbstractMeanFunction: The sum of the two mean functions.
__mul__(other: Union[AbstractMeanFunction, Float[Array, ' O']]) -> AbstractMeanFunction

Multiply two mean functions.

Parameters:

Name Type Description Default
other AbstractMeanFunction

The other mean function to multiply.

required
Returns
AbstractMeanFunction: The product of the two mean functions.
__rmul__(other: Union[AbstractMeanFunction, Float[Array, ' O']]) -> AbstractMeanFunction

Multiply two mean functions.

Parameters:

Name Type Description Default
other AbstractMeanFunction

The other mean function to multiply.

required
Returns
AbstractMeanFunction: The product of the two mean functions.
__init__() -> None
generate_dataset(num_points: int, key: KeyArray, obs_stddev: float = 0.0) -> Dataset

Generate a toy dataset from the test function.

Parameters:

Name Type Description Default
num_points int

Number of points to sample.

required
key KeyArray

JAX PRNG key.

required
obs_stddev float

(Optional) standard deviation of Gaussian distributed

0.0

Returns:

Name Type Description
Dataset Dataset

Dataset of points sampled from the test function.

generate_test_points(num_points: int, key: KeyArray) -> Float[Array, 'N D']

Generate test points from the search space of the test function.

Parameters:

Name Type Description Default
num_points int

Number of points to sample.

required
key KeyArray

JAX PRNG key.

required

Returns:

Type Description
Float[Array, 'N D']

Float[Array, 'N D']: Test points sampled from the search space.

__call__(x: Num[Array, 'N D']) -> Float[Array, 'N 1']
evaluate(x: Float[Array, 'N D']) -> Float[Array, 'N 1'] abstractmethod

Evaluate the test function at a set of points.

Parameters:

Name Type Description Default
x Float[Array, 'N D']

Points to evaluate the test function at.

required

Returns:

Type Description
Float[Array, 'N 1']

Float[Array, 'N 1']: Values of the test function at the points.

Forrester dataclass

Bases: AbstractContinuousTestFunction

Forrester function introduced in 'Engineering design via surrogate modelling: a practical guide' (Forrester et al. 2008), rescaled to have zero mean and unit variance over [0,1][0, 1].

search_space = ContinuousSearchSpace(lower_bounds=jnp.array([0.0]), upper_bounds=jnp.array([1.0])) class-attribute instance-attribute
minimizer = jnp.array([[0.75725]]) class-attribute instance-attribute
minimum = jnp.array([[-1.4528]]) class-attribute instance-attribute
__init_subclass__(mutable: bool = False)
replace(**kwargs: Any) -> Self

Replace the values of the fields of the object.

Parameters:

Name Type Description Default
**kwargs Any

keyword arguments to replace the fields of the object.

{}
Returns
Module: with the fields replaced.
replace_meta(**kwargs: Any) -> Self

Replace the metadata of the fields.

Parameters:

Name Type Description Default
**kwargs Any

keyword arguments to replace the metadata of the fields of the object.

{}
Returns
Module: with the metadata of the fields replaced.
update_meta(**kwargs: Any) -> Self

Update the metadata of the fields. The metadata must already exist.

Parameters:

Name Type Description Default
**kwargs Any

keyword arguments to replace the fields of the object.

{}
Returns
Module: with the fields replaced.
replace_trainable(**kwargs: Dict[str, bool]) -> Self

Replace the trainability status of local nodes of the Module.

replace_bijector(**kwargs: Dict[str, tfb.Bijector]) -> Self

Replace the bijectors of local nodes of the Module.

constrain() -> Self

Transform model parameters to the constrained space according to their defined bijectors.

Returns
Module: transformed to the constrained space.
unconstrain() -> Self

Transform model parameters to the unconstrained space according to their defined bijectors.

Returns
Module: transformed to the unconstrained space.
stop_gradient() -> Self

Stop gradients flowing through the Module.

Returns
Module: with gradients stopped.
trainables() -> Self
__call__(x: Num[Array, 'N D']) -> Float[Array, 'N 1']
__add__(other: Union[AbstractMeanFunction, Float[Array, ' O']]) -> AbstractMeanFunction

Add two mean functions.

Parameters:

Name Type Description Default
other AbstractMeanFunction

The other mean function to add.

required
Returns
AbstractMeanFunction: The sum of the two mean functions.
__radd__(other: Union[AbstractMeanFunction, Float[Array, ' O']]) -> AbstractMeanFunction

Add two mean functions.

Parameters:

Name Type Description Default
other AbstractMeanFunction

The other mean function to add.

required
Returns
AbstractMeanFunction: The sum of the two mean functions.
__mul__(other: Union[AbstractMeanFunction, Float[Array, ' O']]) -> AbstractMeanFunction

Multiply two mean functions.

Parameters:

Name Type Description Default
other AbstractMeanFunction

The other mean function to multiply.

required
Returns
AbstractMeanFunction: The product of the two mean functions.
__rmul__(other: Union[AbstractMeanFunction, Float[Array, ' O']]) -> AbstractMeanFunction

Multiply two mean functions.

Parameters:

Name Type Description Default
other AbstractMeanFunction

The other mean function to multiply.

required
Returns
AbstractMeanFunction: The product of the two mean functions.
generate_dataset(num_points: int, key: KeyArray, obs_stddev: float = 0.0) -> Dataset

Generate a toy dataset from the test function.

Parameters:

Name Type Description Default
num_points int

Number of points to sample.

required
key KeyArray

JAX PRNG key.

required
obs_stddev float

(Optional) standard deviation of Gaussian distributed

0.0

Returns:

Name Type Description
Dataset Dataset

Dataset of points sampled from the test function.

generate_test_points(num_points: int, key: KeyArray) -> Float[Array, 'N D']

Generate test points from the search space of the test function.

Parameters:

Name Type Description Default
num_points int

Number of points to sample.

required
key KeyArray

JAX PRNG key.

required

Returns:

Type Description
Float[Array, 'N D']

Float[Array, 'N D']: Test points sampled from the search space.

__init__(search_space=ContinuousSearchSpace(lower_bounds=jnp.array([0.0]), upper_bounds=jnp.array([1.0])), minimizer=jnp.array([[0.75725]]), minimum=jnp.array([[-1.4528]])) -> None
evaluate(x: Float[Array, 'N D']) -> Float[Array, 'N 1']
LogarithmicGoldsteinPrice dataclass

Bases: AbstractContinuousTestFunction

Logarithmic Goldstein-Price function introduced in 'A benchmark of kriging-based infill criteria for noisy optimization' (Picheny et al. 2013), which has zero mean and unit variance over [0,1]2[0, 1]^2.

search_space = ContinuousSearchSpace(lower_bounds=jnp.array([0.0, 0.0]), upper_bounds=jnp.array([1.0, 1.0])) class-attribute instance-attribute
minimizer = jnp.array([[0.5, 0.25]]) class-attribute instance-attribute
minimum = jnp.array([[-3.12913]]) class-attribute instance-attribute
__init_subclass__(mutable: bool = False)
replace(**kwargs: Any) -> Self

Replace the values of the fields of the object.

Parameters:

Name Type Description Default
**kwargs Any

keyword arguments to replace the fields of the object.

{}
Returns
Module: with the fields replaced.
replace_meta(**kwargs: Any) -> Self

Replace the metadata of the fields.

Parameters:

Name Type Description Default
**kwargs Any

keyword arguments to replace the metadata of the fields of the object.

{}
Returns
Module: with the metadata of the fields replaced.
update_meta(**kwargs: Any) -> Self

Update the metadata of the fields. The metadata must already exist.

Parameters:

Name Type Description Default
**kwargs Any

keyword arguments to replace the fields of the object.

{}
Returns
Module: with the fields replaced.
replace_trainable(**kwargs: Dict[str, bool]) -> Self

Replace the trainability status of local nodes of the Module.

replace_bijector(**kwargs: Dict[str, tfb.Bijector]) -> Self

Replace the bijectors of local nodes of the Module.

constrain() -> Self

Transform model parameters to the constrained space according to their defined bijectors.

Returns
Module: transformed to the constrained space.
unconstrain() -> Self

Transform model parameters to the unconstrained space according to their defined bijectors.

Returns
Module: transformed to the unconstrained space.
stop_gradient() -> Self

Stop gradients flowing through the Module.

Returns
Module: with gradients stopped.
trainables() -> Self
__call__(x: Num[Array, 'N D']) -> Float[Array, 'N 1']
__add__(other: Union[AbstractMeanFunction, Float[Array, ' O']]) -> AbstractMeanFunction

Add two mean functions.

Parameters:

Name Type Description Default
other AbstractMeanFunction

The other mean function to add.

required
Returns
AbstractMeanFunction: The sum of the two mean functions.
__radd__(other: Union[AbstractMeanFunction, Float[Array, ' O']]) -> AbstractMeanFunction

Add two mean functions.

Parameters:

Name Type Description Default
other AbstractMeanFunction

The other mean function to add.

required
Returns
AbstractMeanFunction: The sum of the two mean functions.
__mul__(other: Union[AbstractMeanFunction, Float[Array, ' O']]) -> AbstractMeanFunction

Multiply two mean functions.

Parameters:

Name Type Description Default
other AbstractMeanFunction

The other mean function to multiply.

required
Returns
AbstractMeanFunction: The product of the two mean functions.
__rmul__(other: Union[AbstractMeanFunction, Float[Array, ' O']]) -> AbstractMeanFunction

Multiply two mean functions.

Parameters:

Name Type Description Default
other AbstractMeanFunction

The other mean function to multiply.

required
Returns
AbstractMeanFunction: The product of the two mean functions.
generate_dataset(num_points: int, key: KeyArray, obs_stddev: float = 0.0) -> Dataset

Generate a toy dataset from the test function.

Parameters:

Name Type Description Default
num_points int

Number of points to sample.

required
key KeyArray

JAX PRNG key.

required
obs_stddev float

(Optional) standard deviation of Gaussian distributed

0.0

Returns:

Name Type Description
Dataset Dataset

Dataset of points sampled from the test function.

generate_test_points(num_points: int, key: KeyArray) -> Float[Array, 'N D']

Generate test points from the search space of the test function.

Parameters:

Name Type Description Default
num_points int

Number of points to sample.

required
key KeyArray

JAX PRNG key.

required

Returns:

Type Description
Float[Array, 'N D']

Float[Array, 'N D']: Test points sampled from the search space.

__init__(search_space=ContinuousSearchSpace(lower_bounds=jnp.array([0.0, 0.0]), upper_bounds=jnp.array([1.0, 1.0])), minimizer=jnp.array([[0.5, 0.25]]), minimum=jnp.array([[-3.12913]])) -> None
evaluate(x: Float[Array, 'N D']) -> Float[Array, 'N 1']
Quadratic dataclass

Bases: AbstractContinuousTestFunction

Toy quadratic function defined over [0,1][0, 1].

search_space = ContinuousSearchSpace(lower_bounds=jnp.array([0.0]), upper_bounds=jnp.array([1.0])) class-attribute instance-attribute
minimizer = jnp.array([[0.5]]) class-attribute instance-attribute
minimum = jnp.array([[0.0]]) class-attribute instance-attribute
__init_subclass__(mutable: bool = False)
replace(**kwargs: Any) -> Self

Replace the values of the fields of the object.

Parameters:

Name Type Description Default
**kwargs Any

keyword arguments to replace the fields of the object.

{}
Returns
Module: with the fields replaced.
replace_meta(**kwargs: Any) -> Self

Replace the metadata of the fields.

Parameters:

Name Type Description Default
**kwargs Any

keyword arguments to replace the metadata of the fields of the object.

{}
Returns
Module: with the metadata of the fields replaced.
update_meta(**kwargs: Any) -> Self

Update the metadata of the fields. The metadata must already exist.

Parameters:

Name Type Description Default
**kwargs Any

keyword arguments to replace the fields of the object.

{}
Returns
Module: with the fields replaced.
replace_trainable(**kwargs: Dict[str, bool]) -> Self

Replace the trainability status of local nodes of the Module.

replace_bijector(**kwargs: Dict[str, tfb.Bijector]) -> Self

Replace the bijectors of local nodes of the Module.

constrain() -> Self

Transform model parameters to the constrained space according to their defined bijectors.

Returns
Module: transformed to the constrained space.
unconstrain() -> Self

Transform model parameters to the unconstrained space according to their defined bijectors.

Returns
Module: transformed to the unconstrained space.
stop_gradient() -> Self

Stop gradients flowing through the Module.

Returns
Module: with gradients stopped.
trainables() -> Self
__call__(x: Num[Array, 'N D']) -> Float[Array, 'N 1']
__add__(other: Union[AbstractMeanFunction, Float[Array, ' O']]) -> AbstractMeanFunction

Add two mean functions.

Parameters:

Name Type Description Default
other AbstractMeanFunction

The other mean function to add.

required
Returns
AbstractMeanFunction: The sum of the two mean functions.
__radd__(other: Union[AbstractMeanFunction, Float[Array, ' O']]) -> AbstractMeanFunction

Add two mean functions.

Parameters:

Name Type Description Default
other AbstractMeanFunction

The other mean function to add.

required
Returns
AbstractMeanFunction: The sum of the two mean functions.
__mul__(other: Union[AbstractMeanFunction, Float[Array, ' O']]) -> AbstractMeanFunction

Multiply two mean functions.

Parameters:

Name Type Description Default
other AbstractMeanFunction

The other mean function to multiply.

required
Returns
AbstractMeanFunction: The product of the two mean functions.
__rmul__(other: Union[AbstractMeanFunction, Float[Array, ' O']]) -> AbstractMeanFunction

Multiply two mean functions.

Parameters:

Name Type Description Default
other AbstractMeanFunction

The other mean function to multiply.

required
Returns
AbstractMeanFunction: The product of the two mean functions.
generate_dataset(num_points: int, key: KeyArray, obs_stddev: float = 0.0) -> Dataset

Generate a toy dataset from the test function.

Parameters:

Name Type Description Default
num_points int

Number of points to sample.

required
key KeyArray

JAX PRNG key.

required
obs_stddev float

(Optional) standard deviation of Gaussian distributed

0.0

Returns:

Name Type Description
Dataset Dataset

Dataset of points sampled from the test function.

generate_test_points(num_points: int, key: KeyArray) -> Float[Array, 'N D']

Generate test points from the search space of the test function.

Parameters:

Name Type Description Default
num_points int

Number of points to sample.

required
key KeyArray

JAX PRNG key.

required

Returns:

Type Description
Float[Array, 'N D']

Float[Array, 'N D']: Test points sampled from the search space.

__init__(search_space=ContinuousSearchSpace(lower_bounds=jnp.array([0.0]), upper_bounds=jnp.array([1.0])), minimizer=jnp.array([[0.5]]), minimum=jnp.array([[0.0]])) -> None
evaluate(x: Float[Array, 'N D']) -> Float[Array, 'N 1']