4. Design of Experiment#

4.1. What is the Design of Experiment#

Design of Experiment (DoE) refers to a structured, strategic approach for selecting samples within the decision space to efficiently explore system behavior. DoE aims to extract the maximum amount of information with a minimal number of experiments or simulations. Therefore, DoE methods are essential for uncertainty quantification, optimization, or surrogate modeling.

4.2. Overview of UQPyL.DoE module#

The DoE module of UQPyL provides several design of experiments methods to meet various user requirements.

DoE methods include:

  • Full Factorial Designs (FFD): FFD explores all possible combinations of factors at different levels.

  • Latin Hypercube Sampling (LHS): LHS is designed to obtain uniform and efficient coverage of the decision space with fewer samples. The DoE module provides multiple variants such as classic, center, maximin, center_maximin, correlation.

  • Monte Carlo Sampling: Random sampling where each sample is selected independently from specified probability distributions.

  • Sobol Sequence: A quasi-random low-discrepancy sequence that uniformly fills the parameter space more effectively than purely random methods.

  • Saltelli Sequence: A variant of Sobol sequence more suitable for variance-based global sensitivity analysis.

  • Morris Sequence: Designed for the Morris Method in sensitivity analysis.

All methods in UQPyL.DoE inherit from SamplerABC. Below is the API reference of SamplerABC:

4.2.1. Class SamplerABC#

SamplerABC is the base class for DoE methods in UQPyL. It provides a unified sample function that allows users to generate samples efficiently.

4.2.1.1. Constructor#

__init__

  • Description

    Initializes a new instance of a DoE method.

    Note: The hyperparameters vary between different DoE methods. For example, LHS.__init__ accepts arguments such as criterion ('classic', 'center', 'maximin' …) and iterations.

4.2.1.2. Method#

sample

  • Description

    Generate samples from the decision space.

    Operation modes:

    1. Without a ``problem`` argument - Uses nt (number of samples) and nx (dimension)

      to generate samples in the normalized space \([0, 1]^{nx}\).

    2. With a ``problem`` argument - Uses nt and problem.nInput. - Samples are automatically scaled to the variable bounds defined in

      the problem object.

  • Parameters

    • nt (int): Number of samples.

    • nx (int, optional): Number of dimensions. Default: None.

    • problem (Problem, optional): A Problem instance. Default: None.

  • Returns

    • numpy.ndarray: A 2D sample matrix.

      • For LHS or random sampling, number of rows typically equals nt.

      • For Sobol or Saltelli sequences, row count may differ due to internal padding.

4.3. How to obtain samples#

# Step 1 : Create an instance of DoE method
from UQPyL.DoE import LHS

# Use classic LHS method
lhs = LHS(criterion="classic")

# Step 2: Generate a unit sample set with 100 samples in 10 dimensions
# shape = (nt, nx)
X = lhs.sample(nt=100, nx=10)

# Optional: Provide a problem definition to scale the samples
from UQPyL.problems.single_objective import Sphere

problem = Sphere(nInput=10)

# Samples are now generated within the bounds of the problem
# shape = (nt, problem.nInput)
X = lhs.sample(nt=100, problem=problem)