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
iandjwith respect to the objective value, as approximated bymodel.The partial dependence plot shows how the value of the dimensions
iandjinfluence themodelpredictions after “averaging out” the influence of all other dimensions.When
x_evalis notNone, the given values are used instead of random samples. In this case,n_sampleswill 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
ialone 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_pointswhen using partial dependence.- n_samplesint, default=100
Number of random samples to use for averaging the model function at each of the
n_pointswhen using partial dependence. Only used whensample_points=Noneandx_eval=None.- n_pointsint, default=40
Number of points at which to evaluate the partial dependence along each dimension
iandj.- x_evallist, default=None
x_evalis a list of parameter values or None. In casex_evalis 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(andyifor 2D) returned are - the indices of the variable in
Dimension.categories.