# How to run:
# 1) sudo apt-get install python-pip
# 2) pip install gpyopt

import high_dimensional_sampling as hds
from high_dimensional_sampling.optimisation import GPyOpt

procedure = GPyOpt(initial_design_numdata=5,
                   aquisition_type='EI',
                   exact_feval=True,
                   de_duplication=True,
                   num_cores=2,
                   max_iter=1000,
                   max_time=60,
                   eps=1e-6)
experiment = hds.OptimisationExperiment(procedure, './hds')
feeder = hds.functions.FunctionFeeder()
feeder.load_function('Rastrigin', {'dimensionality': 5})
for function in feeder:
    experiment.run(function, finish_line=1000)
Ejemplo n.º 2
0
    bestfit_logL_values = np.zeros(len(convthresh_values))
    count = 0
    for convthresh in convthresh_values:

        RESULTS_FOLDER = "/home/user/high-dimensional-sampling/" + numdim + "D_diver_" + str(
            convthresh) + "_" + str(numpoints)

        procedure = optimisation.PyScannerBit(scanner="diver",
                                              multinest_tol=0.5,
                                              multinest_nlive=100,
                                              polychord_tol=1.0,
                                              polychord_nlive=20,
                                              diver_convthresh=convthresh,
                                              diver_np=numpoints,
                                              twalk_sqrtr=1.05,
                                              random_point_number=10000,
                                              toy_mcmc_point_number=10,
                                              badass_points=1000,
                                              badass_jumps=10,
                                              pso_np=400,
                                              output_path=RESULTS_FOLDER)

        experiment = hds.OptimisationExperiment(procedure, RESULTS_FOLDER)

        # Perform experiment with function
        for function in feeder:
            #if MPI.COMM_WORLD.Get_rank() == 0:
            experiment.run(function,
                           finish_line=int(MAXIMUM_NUMBER_OF_SAMPLES))
Ejemplo n.º 3
0
# Maximum number of samples to take
MAX_N_SAMPLES = int(1e7)

for function in functions:

    # Create ParticleFilter instance
    procedure = optimisation.ParticleFilter(seed_size=N_SEED,
                                            iteration_size=N_ITERATION_STEP,
                                            boundaries=np.array(function.ranges),
                                            initial_width=1,
                                            wc_decay_rate=input_width_decay,
                                            wc_apply_every_n_iterations=1,
                                            sc_scales_with_boundary=False,
                                            sc_logarithmic=input_stdev_configs,
                                            kc_survival_rate=input_survival_rates)

    # Sample seed and get function values at that seed
    seed_x = np.random.rand(N_SEED, input_dimensionality)
    for i, d in enumerate(function.ranges):
        width = d[1] - d[0]
        seed_x[:, i] = seed_x[:, i] * width + d[0]
    seed_y = function(seed_x)
    procedure.set_seed(seed_x, seed_y)
    
    # Format results folder
    results_folder = RESULTS_FOLDER.format(input_dimensionality, input_width_decay, input_stdev_configs, input_survival_rates)

    # Run experiment
    experiment = hds.OptimisationExperiment(procedure, results_folder)
    experiment.run(function, finish_line=int(MAX_N_SAMPLES))