# GaussianProcess

Source: https://docs.q-ctrl.com/references/boulder-opal/boulderopal/closed_loop/GaussianProcess

```python
class boulderopal.closed_loop.GaussianProcess(bounds, length_scale_bounds=None, seed=None)
```

The Gaussian process optimizer.

### Parameters
* **bounds** ([*Bounds*](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/closed_loop/Bounds.md#boulderopal.closed_loop.Bounds)) – The bounds on the test points.
* **length_scale_bounds** (*np.ndarray* *or* *None* *,* *optional*) – The per-parameter length scale bounds on the test points.
  The bounds must be a NumPy array of shape `(parameter_count, 2)` where the trailing
  axis are the bounds for each parameter (with the lower bound first, followed by the upper
  bound).
  If not specified,  `optimize` will pick a value derived from the
  bounds by picking orders of magnitudes below/above the sidelength for each box axis.
* **seed** (*int* *or* *None* *,* *optional*) – Seed for the random number generator used in the optimizer.
  If set, must be a non-negative integer.
  Use this option to generate deterministic results from the optimizer.

## Notes

The Gaussian process is defined by the kernel

$$
k({\mathbf x}_j, {\mathbf x}_k)
    = \exp \left(-\frac{1}{2} ( {\mathbf x}_j - {\mathbf x}_k )^\top
        \Sigma^{-2} ( {\mathbf x}_j - {\mathbf x}_k )\right) ,
$$

where ${\mathbf x}_j$ is an $n$-dimensional vector representing the
$j$-th test point, $\Sigma= {\mathrm diag}(l_1, \cdots, l_n)$
is an $n \times n$ diagonal matrix, and $\{ l_j \}$ are the length scales.
The length scales are tuned while training the model, within the bounds set by the
length_scale_bounds parameter. Roughly speaking, the amount a parameter needs to change
to impact the optimization cost should lie within the length scale bounds.

It’s recommended to provide non-zero cost_uncertainty to `optimize`
when using this optimizer, otherwise you might encounter a numerical error when the optimizer
tries to fit the kernel with your input data. If the error persists, try increasing the
cost_uncertainty value or decreasing the minimum length scale bound. However, such numerical
error is also an indication that your data might not be suitable to be modelled by a
Gaussian process, and in that case, consider using a different closed-loop optimizer.

For more detail on Gaussian processes see
[Gaussian process](https://en.wikipedia.org/wiki/Gaussian_process) on Wikipedia.
