sampling.effects.screening_plot
sampling.effects.screening_plot(X, fun, xi, p, labels, bounds=None, show=True)Generates a plot with elementary effect screening metrics.
This function calculates the mean and standard deviation of the elementary effects for a given set of design variables and plots the results.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| X | np.ndarray | The screening plan matrix, typically structured within a [0,1]^k box. | required |
| fun | object | The objective function to evaluate at each design point in the screening plan. | required |
| xi | float | The elementary effect step length factor. | required |
| p | int | Number of discrete levels along each dimension. | required |
| labels | list of str | A list of variable names corresponding to the design variables. | required |
| bounds | np.ndarray | A 2xk matrix where the first row contains lower bounds and the second row contains upper bounds for each variable. | None |
| show | bool | If True, the plot is displayed. Defaults to True. | True |
Returns
| Name | Type | Description |
|---|---|---|
| None | None | The function generates a plot of the results. |
Examples
>>> import numpy as np
from spotpython.utils.effects import screening, screeningplan
from spotpython.fun.objectivefunctions import Analytical
fun = Analytical()
k = 10
p = 10
xi = 1
r = 25
X = screeningplan(k=k, p=p, xi=xi, r=r) # shape (r x (k+1), k)
# Provide real-world bounds from the wing weight docs (2 x 10).
value_range = np.array([
[150, 220, 6, -10, 16, 0.5, 0.08, 2.5, 1700, 0.025],
[200, 300, 10, 10, 45, 1.0, 0.18, 6.0, 2500, 0.08 ],
])
labels = [
"S_W", "W_fw", "A", "Lambda",
"q", "lambda", "tc", "N_z",
"W_dg", "W_p"
]
screening(
X=X,
fun=fun.fun_wingwt,
bounds=value_range,
xi=xi,
p=p,
labels=labels,
print=False,
)