0a60b2d2807cf370e984b0bd9f7c4d0edabe4267,skopt/gbrt_opt.py,,gbrt_minimize,#,24

Before Change


    rng = check_random_state(random_state)

    // Bounds
    num_params = len(bounds)
    lower_bounds, upper_bounds = extract_bounds(bounds)

    // Default estimator
    if base_estimator is None:
        base_estimator = GradientBoostingQuantileRegressor(random_state=rng)

    // Record the points and function values evaluated as part of
    // the minimization
    Xi = np.zeros((maxiter, num_params))
    yi = np.zeros(maxiter)

    // Initialize with random points
    if n_start == 0:
        raise ValueError("Need at least one starting point.")

    if maxiter == 0:
        raise ValueError("Need to perform at least one iteration.")

    n_start = min(n_start, maxiter)

    Xi[:n_start] = _random_points(
        lower_bounds, upper_bounds, n_points=n_start, random_state=rng)
    best_x = Xi[:n_start].ravel()
    yi[:n_start] = [func(xi) for xi in Xi[:n_start]]
    best_y = np.min(yi[:n_start])

    models = []

    for i in range(n_start, maxiter):
        rgr = clone(base_estimator)
        // only the first i points are meaningful
        rgr.fit(Xi[:i, :], yi[:i])
        models.append(rgr)

        // `rgr` predicts constants for each leaf which means that the EI
        // has zero gradient over large distances. As a result we can not
        // use gradient based optimisers like BFGS, use random sampling
        // for the moment.
        x0 = _random_points(lower_bounds, upper_bounds,
                            n_points=n_points,
                            random_state=rng)
        best = np.argmax(gaussian_ei(x0, rgr, best_y))

        Xi[i] = x0[best].ravel()
        yi[i] = func(x0[best])

        if yi[i] < best_y:
            best_y = yi[i]

After Change


        x0 = space.transform(space.rvs(n_samples=n_points, random_state=rng))
        best = np.argmax(gaussian_ei(x0, rgr, best_y))

        Xi[i] = space.inverse_transform(x0[best:best+1])[0]
        yi[i] = func(Xi[i])

        if yi[i] < best_y:
            best_y = yi[i]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


Project Name: scikit-optimize/scikit-optimize
Commit Name: 0a60b2d2807cf370e984b0bd9f7c4d0edabe4267
Time: 2016-06-14
Author: g.louppe@gmail.com
File Name: skopt/gbrt_opt.py
Class Name:
Method Name: gbrt_minimize


Project Name: kymatio/kymatio
Commit Name: 0a8619ecf57eb68021e6aef48aefdc8cfa0795ed
Time: 2020-02-18
Author: janden@flatironinstitute.org
File Name: examples/1d/plot_real_signal.py
Class Name:
Method Name:


Project Name: mapbox/robosat
Commit Name: 9a8d91022cfde0a380d8700be76d6ddbd716a2af
Time: 2018-09-12
Author: o@courtin.co
File Name: robosat/tools/train.py
Class Name:
Method Name: train


Project Name: mapbox/robosat
Commit Name: 9a8d91022cfde0a380d8700be76d6ddbd716a2af
Time: 2018-09-12
Author: o@courtin.co
File Name: robosat/tools/train.py
Class Name:
Method Name: validate