sampling.effects.screening_print
sampling.effects.screening_print(X, fun, xi, p, labels, bounds=None)Generates a DataFrame 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 returns the results as a Pandas DataFrame.
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 |
Returns
| Name | Type | Description |
|---|---|---|
| pd.DataFrame | pd.DataFrame: A DataFrame containing three columns: - ‘varname’: The name of each variable. - ‘mean’: The mean of the elementary effects for each variable. - ‘sd’: The standard deviation of the elementary effects for each variable. | |
| pd.DataFrame | or None: If print is set to False, a plot of the results is generated instead of returning a DataFrame. |
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,
)