Example #1
0
def probability_of_improvement_acquisition(gpy_model):
    return ProbabilityOfImprovement(gpy_model)
Example #2
0
def acquisition():
    rng = np.random.RandomState(42)
    x_init = rng.rand(5, 2)
    y_init = rng.rand(5, 1)
    model = GPRegression(x_init, y_init, RBF(2))
    return ProbabilityOfImprovement(GPyModelWrapper(model))
Example #3
0
        boEI = BayesianOptimizationLoop(model=model_emukitEI,
                                        space=parameter_space,
                                        acquisition=ExpectedImprovement(
                                            model=model_emukit,
                                            jitter=Exploration_parameter),
                                        batch_size=1)
        boEIep_r = []
        EIcurMax = 0
        EIcurMin = float('inf')

        model_gpyPI = GPRegression(X, Y)  # Train and wrap the model in Emukit
        model_emukitPI = GPyModelWrapper(model_gpyPI)
        boPI = BayesianOptimizationLoop(model=model_emukitPI,
                                        space=parameter_space,
                                        acquisition=ProbabilityOfImprovement(
                                            model=model_emukit,
                                            jitter=Exploration_parameter),
                                        batch_size=1)
        boPIep_r = []
        PIcurMax = 0
        PIcurMin = float('inf')

        for t in range(50):  # in one episode
            bo.run_loop(fun, 1)
            a = bo.loop_state.X[-1]
            ppo.ppoMax = max(ppo.ppoMax, fun(a))
            ppoMin = min(ppoMin, ppo.curFun(a))
            # r = -(env.maxVal-ppo.ppoMax)
            r = (env.minVal - ppoMin)
            r = float(r)
            boPPOep_r.append(r)
Example #4
0
elif args.model_type == "rf":
    model = RandomForest(X_init=X_init, Y_init=Y_init)
    with_gradients = False

elif args.model_type == "dngo":
    model = DNGO(X_init=X_init, Y_init=Y_init)
    with_gradients = False

elif args.model_type == "gp":
    model = BOGP(X_init=X_init, Y_init=Y_init)

if args.acquisition_type == "ei":
    acquisition = ExpectedImprovement(model)
elif args.acquisition_type == "pi":
    acquisition = ProbabilityOfImprovement(model)
elif args.acquisition_type == "nlcb":
    acquisition = NegativeLowerConfidenceBound(model)
elif args.acquisition_type == "logei":
    acquisition = LogExpectedImprovement(model)
elif args.acquisition_type == "entropy_search":
    model = BOGP(X_init=X_init, Y_init=Y_init)
    acquisition = EntropySearch(model, space=space)


# if with_gradients:
#    acquisition_optimizer = AcquisitionOptimizer(space)
# else:
acquisition_optimizer = DirectOptimizer(space)

candidate_point_calculator = Sequential(acquisition, acquisition_optimizer)