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
andj
with respect to the objective value, as approximated bymodel
.The partial dependence plot shows how the value of the dimensions
i
andj
influence themodel
predictions after “averaging out” the influence of all other dimensions.When
x_eval
is notNone
, the given values are used instead of random samples. In this case,n_samples
will be ignored. Parameters
 space
Space
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 setj=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 then_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 whensample_points=None
andx_eval=None
. n_pointsint, default=40
Number of points at which to evaluate the partial dependence along each dimension
i
andj
. x_evallist, default=None
x_eval
is a list of parameter values or None. In casex_eval
is not None, the parsed dependence will be calculated using these values. Otherwise, random selected samples will be used.
 space
 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
(andyi
for 2D) returned are  the indices of the variable in
Dimension.categories
.