skopt.plots.partial_dependence#

skopt.plots.partial_dependence(space, model, i, j=None, sample_points=None, n_samples=250, n_points=40, x_eval=None)[source][source]#

Calculate the partial dependence for dimensions i and j with respect to the objective value, as approximated by model.

The partial dependence plot shows how the value of the dimensions i and j influence the model predictions after “averaging out” the influence of all other dimensions.

When x_eval is not None, the given values are used instead of random samples. In this case, n_samples will be ignored.

Parameters:
spaceSpace

The parameter space over which the minimization was performed.

model

Surrogate model for the objective function.

iint

The first dimension for which to calculate the partial dependence.

jint, default=None

The second dimension for which to calculate the partial dependence. To calculate the 1D partial dependence on i alone set j=None.

sample_pointsnp.array, shape=(n_points, n_dims), default=None

Only used when x_eval=None, i.e in case partial dependence should be calculated. Randomly sampled and transformed points to use when averaging the model function at each of the n_points when using partial dependence.

n_samplesint, default=100

Number of random samples to use for averaging the model function at each of the n_points when using partial dependence. Only used when sample_points=None and x_eval=None.

n_pointsint, default=40

Number of points at which to evaluate the partial dependence along each dimension i and j.

x_evallist, default=None

x_eval is a list of parameter values or None. In case x_eval is not None, the parsed dependence will be calculated using these values. Otherwise, random selected samples will be used.

Returns:
For 1D partial dependence:
xinp.array

The points at which the partial dependence was evaluated.

yinp.array

The value of the model at each point xi.

For 2D partial dependence:
xinp.array, shape=n_points

The points at which the partial dependence was evaluated.

yinp.array, shape=n_points

The points at which the partial dependence was evaluated.

zinp.array, shape=(n_points, n_points)

The value of the model at each point (xi, yi).

For Categorical variables, the xi (and yi for 2D) returned are
the indices of the variable in Dimension.categories.