tfp.experimental.bayesopt.acquisition.StudentTProcessExpectedImprovement
Stay organized with collections
Save and categorize content based on your preferences.
Student-T Process expected improvement acquisition function.
Inherits From: AcquisitionFunction
tfp.experimental.bayesopt.acquisition.StudentTProcessExpectedImprovement(
predictive_distribution, observations, seed=None, exploration=0.01
)
Computes the analytic sequential expected improvement for a Student-T process
model.
Requires that predictive_distribution
has a mean
, stddev
method.
Examples
Build and evaluate a Student T Process Expected Improvement acquisition
function.
import numpy as np
import tensorflow_probability as tfp
tfd = tfp.distributions
tfpk = tfp.math.psd_kernels
tfp_acq = tfp.experimental.bayesopt.acquisition
# Sample 10 5-dimensional index points and associated observations.
index_points = np.random.uniform(size=[10, 5])
observations = np.random.uniform(size=[10])
# Build a Student T Process regression model over the function values at
# `predictive_index_points` conditioned on observations.
predictive_index_points = np.random.uniform(size=[8, 5])
dist = tfd.StudentTProcessRegressionModel(
kernel=tfpk.MaternFiveHalves(),
df=5.,
observation_index_points=index_points,
observations=observations,
predictive_index_points=predictive_index_points)
# Define a Student T Process Expected Improvement acquisition function.
stp_ei = tfp_acq.StudentTProcessExpectedImprovement(
predictive_distribution=dist,
observations=observations,
exploration=0.02)
# Evaluate the acquisition function at `predictive_index_points`.
acq_fn_vals = stp_ei() # Has shape [8].
# Evaluate the acquisition function at a new set of predictive index points.
new_pred_index_points = np.random.uniform(size=[6, 5])
acq_fn_vals = stp_ei(pred_index_points) # Has shape [6].
Args |
predictive_distribution
|
tfd.Distribution -like, the distribution over
observations at a set of index points. Must have mean , stddev
methods.
|
observations
|
Float Tensor of observations. Shape has the form
[b1, ..., bB, e] , where e is the number of index points (such that
the event shape of predictive_distribution is [e] ) and
[b1, ..., bB] is broadcastable with the batch shape of
predictive_distribution .
|
seed
|
PRNG seed; see tfp.random.sanitize_seed for details.
|
exploration
|
Exploitation-exploration trade-off parameter.
|
Attributes |
exploration
|
|
is_parallel
|
Python bool indicating whether the acquisition function is parallel.
Parallel (batched) acquisition functions evaluate batches of points rather
than single points.
|
observations
|
Float Tensor of observations.
|
predictive_distribution
|
The distribution over observations at a set of index points.
|
seed
|
PRNG seed.
|
Methods
__call__
View source
__call__(
**kwargs
)
Computes the Student-T process expected improvement.
Args |
**kwargs
|
Keyword args passed on to the mean and stddev methods of
predictive_distribution .
|
Returns |
Expected improvements at index points implied by predictive_distribution
(or overridden in **kwargs ).
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-11-21 UTC.
[null,null,["Last updated 2023-11-21 UTC."],[],[],null,["# tfp.experimental.bayesopt.acquisition.StudentTProcessExpectedImprovement\n\n\u003cbr /\u003e\n\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/probability/blob/v0.23.0/tensorflow_probability/python/experimental/bayesopt/acquisition/expected_improvement.py#L149-L248) |\n\nStudent-T Process expected improvement acquisition function.\n\nInherits From: [`AcquisitionFunction`](../../../../tfp/experimental/bayesopt/acquisition/AcquisitionFunction) \n\n tfp.experimental.bayesopt.acquisition.StudentTProcessExpectedImprovement(\n predictive_distribution, observations, seed=None, exploration=0.01\n )\n\nComputes the analytic sequential expected improvement for a Student-T process\nmodel.\n\nRequires that `predictive_distribution` has a `mean`, `stddev` method.\n\n#### Examples\n\nBuild and evaluate a Student T Process Expected Improvement acquisition\nfunction. \n\n import numpy as np\n import tensorflow_probability as tfp\n\n tfd = tfp.distributions\n tfpk = tfp.math.psd_kernels\n tfp_acq = tfp.experimental.bayesopt.acquisition\n\n # Sample 10 5-dimensional index points and associated observations.\n index_points = np.random.uniform(size=[10, 5])\n observations = np.random.uniform(size=[10])\n\n # Build a Student T Process regression model over the function values at\n # `predictive_index_points` conditioned on observations.\n predictive_index_points = np.random.uniform(size=[8, 5])\n dist = tfd.StudentTProcessRegressionModel(\n kernel=tfpk.MaternFiveHalves(),\n df=5.,\n observation_index_points=index_points,\n observations=observations,\n predictive_index_points=predictive_index_points)\n\n # Define a Student T Process Expected Improvement acquisition function.\n stp_ei = tfp_acq.StudentTProcessExpectedImprovement(\n predictive_distribution=dist,\n observations=observations,\n exploration=0.02)\n\n # Evaluate the acquisition function at `predictive_index_points`.\n acq_fn_vals = stp_ei() # Has shape [8].\n\n # Evaluate the acquisition function at a new set of predictive index points.\n new_pred_index_points = np.random.uniform(size=[6, 5])\n acq_fn_vals = stp_ei(pred_index_points) # Has shape [6].\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `predictive_distribution` | `tfd.Distribution`-like, the distribution over observations at a set of index points. Must have `mean`, `stddev` methods. |\n| `observations` | `Float` `Tensor` of observations. Shape has the form `[b1, ..., bB, e]`, where `e` is the number of index points (such that the event shape of `predictive_distribution` is `[e]`) and `[b1, ..., bB]` is broadcastable with the batch shape of `predictive_distribution`. |\n| `seed` | PRNG seed; see tfp.random.sanitize_seed for details. |\n| `exploration` | Exploitation-exploration trade-off parameter. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|---------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `exploration` | \u003cbr /\u003e \u003cbr /\u003e |\n| `is_parallel` | Python `bool` indicating whether the acquisition function is parallel. \u003cbr /\u003e Parallel (batched) acquisition functions evaluate batches of points rather than single points. |\n| `observations` | Float `Tensor` of observations. |\n| `predictive_distribution` | The distribution over observations at a set of index points. |\n| `seed` | PRNG seed. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `__call__`\n\n[View source](https://github.com/tensorflow/probability/blob/v0.23.0/tensorflow_probability/python/experimental/bayesopt/acquisition/expected_improvement.py#L232-L248) \n\n __call__(\n **kwargs\n )\n\nComputes the Student-T process expected improvement.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|------------|-----------------------------------------------------------------------------------------|\n| `**kwargs` | Keyword args passed on to the `mean` and `stddev` methods of `predictive_distribution`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| Expected improvements at index points implied by `predictive_distribution` (or overridden in `**kwargs`). ||\n\n\u003cbr /\u003e"]]