def __init__(self):
     ## Library parameters 
     self.params = bo.initialize_params()
     n_dim = 5    ## n dimensions
     n_sam = 100  ## n samples
     ## Set of discrete points
     self.x_set = np.random.rand(n_sam, n_dim)
 def __init__(self):
     ## Library parameters 
     self.params = bo.initialize_params()
     ## n dimensions
     self.n_dim = 5
     ## Lower bounds
     self.lower_bound = np.zeros((self.n_dim,))
     ## Upper bounds
     self.upper_bound = np.ones((self.n_dim,))
def quad(x, mu):
    return ((np.asarray(x) - mu) ** 2).mean()


def func(x):
    # print "x", x
    # ~ target = np.ones(len(x))*0.3
    target = np.arange(1, 1 + len(x))
    target2 = np.ones(len(x)) * 10
    # print "target", target
    e = quad(x, target)
    return e


# Initialize the parameters by default
params = bayesopt.initialize_params()

# We decided to change some of them
params["n_init_samples"] = 150
params["n_iter_relearn"] = 20
# params['noise'] = 0.01
params["kernel_name"] = "kMaternISO3"
params["kernel_hp_mean"] = [1]
params["kernel_hp_std"] = [5]
params["surr_name"] = "sStudentTProcessNIG"

dim = 20
lb = np.ones((dim,)) * 0
ub = np.ones((dim,)) * 20

mvalue, x_out, error = bayesopt.optimize(func, dim, lb, ub, params)