Ejemplo n.º 1
0
    x_location = y_data.index(min(y_data))
    max_expected_improvement = 0
    max_points = []
    max_points_unnormalized = []

    print("xi - ", xi)
    # logging.info("xi - %f", xi)
    print("iter - ", i)
    # logging.info("iter - %i", i)

    for pool_size in range(thread_pool_min, thread_pool_max + 1):
        x = [pool_size]
        x_val = [x[0]]

        # may be add a condition to stop explorering the already expored locations
        ei = gaussian_ei(np.array(x_val).reshape(1, -1), model, minimum, xi)


        if ei > max_expected_improvement:
            max_expected_improvement = ei
            max_points = [x_val]

        elif ei == max_expected_improvement:
            max_points.append(x_val)

    if max_expected_improvement == 0:
        print("WARN: Maximum expected improvement was 0. Most likely to pick a random point next")
        # logging.info("WARN: Maximum expected improvement was 0. Most likely to pick a random point next")
        next_x = x_data[x_location]

        # logging.info(next_x)
    Y_plot_data = function(X_plot_data, plot_number)

    minimum = min(y_data)
    x_location = y_data.index(min(y_data))
    max_expected_improvement = 0
    max_points = []

    print("xi -", xi)
    print("iteration -", i)

    for pool_size in range(thread_pool_min, thread_pool_max + 1):
        x_val = [pool_size]
        # may be add a condition to stop explorering the already expored locations
        feed_val = np.array(x_val).reshape(1, -1)
        #ei = gaussian_ei(np.array(x_val).reshape(1, -1), model, minimum, xi)
        ei = gaussian_ei(feed_val, model, minimum, xi)

        if ei > max_expected_improvement:
            max_expected_improvement = ei
            max_points = [x_val]

        elif ei == max_expected_improvement:
            max_points.append(x_val)

        #else:
            #print("WARN: Expected improvement < Max value")

    if max_expected_improvement == 0:
        print("WARN: Maximum expected improvement was 0. Most likely to pick a random point next")

        if keep_min < 10: