# discrete_acqf.expected_improvement

``` python
discrete_acqf.expected_improvement(pred, best, *, maximize=True)
```

How much each candidate is expected to improve on `best`.

$\mathbb{E}[\max(f(x) - y^*, 0)]$ under the Gaussian of `pred`, or $\mathbb{E}[\max(y^* - f(x), 0)]$ with `maximize=False`.

## Parameters

| Name | Type | Description | Default |
|----|----|----|----|
| pred | Prediction | The prediction at the candidates. | *required* |
| best | float \| Tensor | The best outcome so far, $y^*$: the largest, or the smallest with `maximize=False`. | *required* |
| maximize | bool | Whether larger outcomes are better. | `True` |

## Returns

| Name | Type   | Description                                       |
|------|--------|---------------------------------------------------|
|      | Tensor | One score per candidate, shaped like `pred.mean`. |
