<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/probability/blob/v0.25.0/tensorflow_probability/python/experimental/bayesopt/acquisition/upper_confidence_bound.py#L154-L244) |

Analytical Gaussian Process upper confidence bound acquisition function.

Inherits From: [`AcquisitionFunction`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/bayesopt/acquisition/AcquisitionFunction)

    tfp.experimental.bayesopt.acquisition.GaussianProcessUpperConfidenceBound(
        predictive_distribution, observations, seed=None, exploration=0.01
    )

Computes the analytic sequential upper confidence bound for a Gaussian
process model.

Requires that `predictive_distribution` has a `.mean`, `stddev` method.

#### Examples

Build and evaluate a GP Upper Confidence Bound 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 12 5-dimensional index points and associated observations.
    index_points = np.random.uniform(size=[12, 5])
    observations = np.random.uniform(size=[12])

    # Build a GP regression model conditioned on observed data.
    dist = tfd.GaussianProcessRegressionModel(
        kernel=tfpk.ExponentiatedQuadratic(),
        observation_index_points=index_points,
        observations=observations)

    # Build a GP upper confidence bound acquisition function.
    gp_ucb = tfp_acq.GausianProcessUpperConfidenceBound(
        predictive_distribution=dist,
        observations=observations,
        exploration=0.05,
        num_samples=int(2e4))

    # Evaluate the acquisition function at a set of 6 predictive index points.
    pred_index_points = np.random.uniform(size=[6, 5])
    acq_fn_vals = gp_ucb(pred_index_points)  # Has shape [6].

<br />

<br />

<br />

| ## 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. |

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `exploration` | <br /> <br /> |
| `is_parallel` | Python `bool` indicating whether the acquisition function is parallel. <br /> 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. |

<br />

## Methods

### `__call__`

[View source](https://github.com/tensorflow/probability/blob/v0.25.0/tensorflow_probability/python/experimental/bayesopt/acquisition/upper_confidence_bound.py#L230-L244)

    __call__(
        **kwargs
    )

Computes analytic GP upper confidence bound.

<br />

<br />

<br />

| Args ||
|---|---|
| `**kwargs` | Keyword args passed on to the `mean` and `stddev` methods of `predictive_distribution`. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| Upper confidence bound at index points implied by `predictive_distribution` (or overridden in `**kwargs`). ||

<br />