2f381632862d04f55a0cb8c396804f93c9d0cad5,skopt/gp_opt.py,,gp_minimize,#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#,35

Before Change


                func_call_no=func_call_no))
            func_call_no += 1

            if callback is not None:
                callback(set_results(x0, y0, space, rng, specs))

    elif x0:
        if isinstance(y0, Iterable):
            y0 = list(y0)

After Change


    specs = {"args": copy.copy(inspect.currentframe().f_locals),
             "function": inspect.currentframe().f_code.co_name}

    if callback is not None:
        if isinstance(callback, Callable):
            callback = [callback]
        elif not (isinstance(callback, list) and
                  all([isinstance(c, Callable) for c in callback])):
            raise ValueError("callback should be either a callable or "
                             "a list of callables.")

    // Check params
    rng = check_random_state(random_state)
    space = Space(dimensions)

    // Default GP
    if base_estimator is None:
        base_estimator = GaussianProcessRegressor(
            kernel=(ConstantKernel(1.0, (0.01, 1000.0)) *
                    Matern(length_scale=np.ones(space.transformed_n_dims),
                           length_scale_bounds=[(0.01, 100)] * space.transformed_n_dims,
                           nu=2.5)),
            normalize_y=True, alpha=alpha, random_state=random_state)

    // Initialize with provided points (x0 and y0) and/or random points
    if x0 is None:
        x0 = []
    elif not isinstance(x0[0], list):
        x0 = [x0]

    if not isinstance(x0, list):
        raise ValueError("`x0` should be a list, but got %s" % type(x0))

    n_init_func_calls = len(x0) if y0 is None else 0
    n_total_init_calls = n_random_starts + n_init_func_calls

    if n_total_init_calls <= 0:
        // if x0 is not provided and n_random_starts is 0 then
        // it will ask for n_random_starts to be > 0.
        raise ValueError(
            "Expected `n_random_starts` > 0, got %d" % n_random_starts)

    if n_calls < n_total_init_calls:
        raise ValueError(
            "Expected `n_calls` >= %d, got %d" % (n_total_init_calls, n_calls))

    func_call_no = 0
    if y0 is None and x0:
        y0 = []
        for i, x in enumerate(x0):

            y0.append(verbose_func(
                func, x, verbose=verbose, prev_ys=y0, x_info="provided",
                func_call_no=func_call_no))
            func_call_no += 1

            if callback is not None:
                curr_res = create_result(x0, y0, space, rng, specs)
                for c in callback:
                    c(curr_res)

    elif x0:
        if isinstance(y0, Iterable):
            y0 = list(y0)
        elif isinstance(y0, numbers.Number):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 28

Instances


Project Name: scikit-optimize/scikit-optimize
Commit Name: 2f381632862d04f55a0cb8c396804f93c9d0cad5
Time: 2016-08-08
Author: manojkumarsivaraj334@gmail.com
File Name: skopt/gp_opt.py
Class Name:
Method Name: gp_minimize


Project Name: scikit-optimize/scikit-optimize
Commit Name: 2f381632862d04f55a0cb8c396804f93c9d0cad5
Time: 2016-08-08
Author: manojkumarsivaraj334@gmail.com
File Name: skopt/dummy_opt.py
Class Name:
Method Name: dummy_minimize


Project Name: scikit-optimize/scikit-optimize
Commit Name: 2f381632862d04f55a0cb8c396804f93c9d0cad5
Time: 2016-08-08
Author: manojkumarsivaraj334@gmail.com
File Name: skopt/gp_opt.py
Class Name:
Method Name: gp_minimize


Project Name: scikit-optimize/scikit-optimize
Commit Name: 2f381632862d04f55a0cb8c396804f93c9d0cad5
Time: 2016-08-08
Author: manojkumarsivaraj334@gmail.com
File Name: skopt/tree_opt.py
Class Name:
Method Name: _tree_minimize