def PI(model, _, X, xi=0.05):
    """
    Probability of improvement policy with an exploration parameter of `xi`.
    """
    model = model.copy()
    target = model.predict(X)[0].max() + xi

    def index(X, grad=False):
        """PI policy instance."""
        return model.get_tail(target, X, grad)

    return index