Esempio n. 1
0
        else:
            dynamic_utility_parameter_distribution = False
            sampling_policy_name = 'uEI_prior'
    elif sampling_policy_name is 'uTS':
        model = MultiOutputGP(output_dim=m,
                              exact_feval=[True] * m,
                              fixed_hyps=False)  # Model (Multi-output GP)
        sampling_policy = uTS(model, space, optimizer='CMA', utility=utility)
        if learn_preferences:
            dynamic_utility_parameter_distribution = True
        else:
            dynamic_utility_parameter_distribution = False
            sampling_policy_name = 'uTS_prior'
    elif sampling_policy_name is 'Random':
        model = BasicModel(output_dim=m)
        sampling_policy = Random(model=None, space=space)
        dynamic_utility_parameter_distribution = False
    elif sampling_policy_name is 'ParEGO':
        model = BasicModel(output_dim=m)
        sampling_policy = ParEGO(model, space, utility)
        dynamic_utility_parameter_distribution = False

    # BO model
    max_iter = 150
    experiment_name = 'test_dtlz1a'
    if len(sys.argv) > 1:
        experiment_number = int(sys.argv[1])
        filename = [
            experiment_name, sampling_policy_name,
            str(experiment_number)
        ]
Esempio n. 2
0
    # --- Sampling policy
    sampling_policy_name = 'Random'
    if sampling_policy_name is 'uEI':
        # Acquisition optimizer
        acquisition_optimizer = U_AcquisitionOptimizer(space=space, model=model, utility=utility, optimizer='lbfgs', inner_optimizer='lbfgs')

        acquisition = uEI_affine(model, space, optimizer=acquisition_optimizer, utility=utility)
        evaluator = GPyOpt.core.evaluators.Sequential(acquisition)
        sampling_policy = AcquisitionFunction(model, space, acquisition, evaluator)
    elif sampling_policy_name is 'TS':
        sampling_policy = TS(model, optimization_space, optimizer='CMA', scenario_distribution=scenario_distribution,
                             utility=utility, expectation_utility=expectation_utility)
        acquisition = None
    elif sampling_policy_name is 'Random':
        sampling_policy = Random(model, space)

    # BO model
    max_iter = 100
    experiment_name = 'test_portfolio1'
    if len(sys.argv) > 1:
        experiment_number = str(sys.argv[1])
        filename = [experiment_name, sampling_policy_name, experiment_number]

        # True underlying utility
        #true_underlying_utility_parameter = utility.sample_parameter()
        beta = 0.75
        true_underlying_utility_parameter = np.atleast_1d([beta**j for j in range(m)])
        print(true_underlying_utility_parameter)

        def true_underlying_utility_func(y):