factorial_DOE_n_level#

obsidian.experiment.utils.factorial_DOE_n_level(d: int, levels: int = 2, n_CP: int | None = None, shuffle: bool = True, seed: Generator | int | None = None, full: bool = False)[source]#

Creates a statistically designed factorial experiment (DOE). Supports n-level designs (2-level, 3-level, etc.). Uses the range (0,1) for low-high.

Parameters:
  • d (int) – Number of dimensions/inputs in the design.

  • levels (int, optional) – Number of levels per factor (e.g., 2, 3, 4). Default is 2.

  • n_CP (int | None, optional) – Number of replicate centerpoints, for estimating pure error and testing curvature/lack-of-fit. Default (None) is 3 for all levels, since replication is what provides pure-error degrees of freedom. Use n_CP=0 for a deterministic, noise-free grid comparison.

  • shuffle (bool, optional) – Whether or not to shuffle the design or leave them in the default run order. Default is True.

  • seed (Generator | int | None, optional) – Controls the run-order shuffle. A Generator is used directly; an int seeds an isolated default_rng (reproducible, without touching global RNG state); None (default) defers to the ambient global np.random stream (e.g. one set by with_tmp_seed). Global state is never reseeded.

  • full (bool, optional) – Whether or not to run the full DOE. Default is False, which will lead to an efficient Res4+ design (2-level only).

Returns:

An (m)-by-(d) array of experiments in the (0,1) domain

Return type:

ndarray

Raises:
  • UnsupportedError – If the number of dimensions exceeds 12

  • ValueError – If d < 1, levels < 2, n_CP < 0, or a fractional factorial is requested with levels != 2