tfp.experimental.bayesopt.acquisition.GaussianProcessExpectedImprovement
Stay organized with collections
Save and categorize content based on your preferences.
Gaussian Process expected improvement acquisition function.
Inherits From: AcquisitionFunction
tfp.experimental.bayesopt.acquisition.GaussianProcessExpectedImprovement(
predictive_distribution, observations, seed=None, exploration=0.01
)
Computes the analytic sequential expected improvement for a Gaussian process
model.
Requires that predictive_distribution
has a mean
, stddev
method.
Examples
Build and evaluate a Gausian 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 20-dimensional index points and associated observations.
index_points = np.random.uniform(size=[10, 20])
observations = np.random.uniform(size=[10])
# Build a Gaussian Process regression model over the function values at
# `predictive_index_points` conditioned on observations.
predictive_index_points = np.random.uniform(size=[8, 20])
dist = tfd.GaussianProcessRegressionModel(
kernel=tfpk.MaternFiveHalves(),
observation_index_points=index_points,
observations=observations,
predictive_index_points=predictive_index_points)
# Define a GP Expected Improvement acquisition function.
gp_ei = tfp_acq.GaussianProcessExpectedImprovement(
predictive_distribution=dist,
observations=observations)
# Evaluate the acquisition function at `predictive_index_points`.
acq_fn_vals = gp_ei()
# Evaluate the acquisition function at a new set of predictive index points.
pred_index_points = np.random.uniform(size=[6, 20])
acq_fn_vals = gp_ei(pred_index_points)
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.
|
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 analytic GP 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.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2023-11-21 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-11-21 UTC."],[],[]]