# Creating new acquisitions for GPyOpt¶

## Reference Manual index¶

Last updated Friday, 11 Jun 2016.

You can create and use your own aquisition functions in GPyOpt. To do it just complete the following template.

In [1]:
from GPyOpt.acquisitions.base import AcquisitionBase

class AcquisitionNew(AcquisitionBase):

"""
General template to create a new GPyOPt acquisition function

:param model: GPyOpt class of model
:param space: GPyOpt class of domain
:param optimizer: optimizer of the acquisition. Should be a GPyOpt optimizer

"""

# --- Set this line to true if analytical gradients are available

def __init__(self, model, space, optimizer, cost_withGradients=None, **kwargs):
self.optimizer = optimizer
super(AcquisitionNew, self).__init__(model, space, optimizer)

# --- UNCOMMENT ONE OF THE TWO NEXT BITS

# 1) THIS ONE IF THE EVALUATION COSTS MAKES SENSE
#
# else:

# 2) THIS ONE IF THE EVALUATION COSTS DOES NOT MAKE SENSE
#
# else:
#     print('LBC acquisition does now make sense with cost. Cost set to constant.')

def _compute_acq(self,x):

# --- DEFINE YOUR AQUISITION HERE (TO BE MAXIMIZED)
#
# Compute here the value of the new acquisition function. Remember that x is a 2D  numpy array
# with a point in the domanin in each row. f_acqu_x should be a column vector containing the
# values of the acquisition at x.
#

return f_acqu_x