optimeo.doe#

This module provides a class for creating and visualizing a design of experiments (DoE). It supports various types of designs including Full Factorial, Sobol sequence, Fractional Factorial, Definitive Screening Design, Space Filling Latin Hypercube, Randomized Latin Hypercube, Optimal, Plackett-Burman, and Box-Behnken. The class allows the user to specify the parameters, their types, and values, and generates the design accordingly. It also provides a method to plot the design using scatter plots.

You can see an example notebook [here](../examples/doe.ipynb).

class optimeo.doe.DesignOfExperiments(type, parameters, Nexp=4, order=2, randomize=True, reduction=2, feature_constraints=None, center=(2, 2), alpha='o', face='ccc', seed=42)[source]#

Bases: object

Class to create a design of experiments (DoE) for a given model. This class allows the user to specify the type of design, the parameters, and various options for the design generation. The design can be visualized using scatter plots.

Example

from optimeo.doe import DesignOfExperiments

parameters = [
    {'name': 'Temperature', 'type': 'integer', 'values': [20, 30, 40]},
    {'name': 'Pressure', 'type': 'float', 'values': [1, 2, 3]},
    {'name': 'Catalyst', 'type': 'categorical', 'values': ['A', 'B', 'C']}
]

doe = DesignOfExperiments(
    type='Full Factorial',
    parameters=parameters,
)
design = doe.design
print(design)
Parameters:
  • type (str) – The type of design to create. Must be one of: ‘Full Factorial’, ‘Sobol sequence’, ‘Fractional Factorial’, ‘Definitive Screening’, ‘Space Filling Latin Hypercube’, ‘Randomized Latin Hypercube’, ‘Optimal’, ‘Plackett-Burman’, ‘Box-Behnken’ or ‘Central Composite’.

  • parameters (List[Dict[str, Dict[str, Any]]]) – List of parameters for the design, each with a dictionary of properties. Each dictionary should contain ‘name’, ‘type’, and ‘values’. ‘values’ should be a list of possible values for the parameter. ‘type’ should be either “int”, “integer”, “float”, “<other>”. Any <other> will be considered as “categorical”. ‘values’ should be a list of possible values for the parameter.

  • Nexp (int, optional) – Number of experiments in the design, when applicable. Default is 4.

  • order (int, optional) – Order of the model (for ‘Optimal’ design). Default is 2.

  • randomize (bool, optional) – Whether to randomize the run order. Default is True.

  • reduction (int, optional) – Reduction factor for ‘Fractional Factorial’ designs. Default is 2.

  • feature_constraints (Optional[List[Dict[str, Any]]], optional) – Feature constraints of the experiment for Sobol sequence. Default is None. If a single dictionary is provided, it will be converted to a list. If a string is provided, it will be converted to a list with one element. If a list is provided, it will be used as is. If None, no constraints will be applied.

  • seed (int)

Variables:
  • type (str) – The type of design.

  • parameters (List[Dict[str, Dict[str, Any]]]) – The parameters for the design.

  • Nexp (int) – Number of experiments in the design.

  • order (int) – Order of the model.

  • randomize (bool) – Whether to randomize the run order.

  • reduction (int) – Reduction factor for ‘Fractional Factorial’ designs.

  • design (pd.DataFrame) – The design DataFrame.

  • lows (Dict[str, float]) – Lower bounds for the parameters.

  • highs (Dict[str, float]) – Upper bounds for the parameters.

create_design()[source]#

Create the design of experiments based on the specified type and parameters.

plot()[source]#

Plot the design of experiments using plotly.

property type: str#

‘Full Factorial’, ‘Sobol sequence’, ‘Fractional Factorial’, ‘Definitive Screening’, ‘Space Filling Latin Hypercube’, ‘Randomized Latin Hypercube’, ‘Optimal’, ‘Plackett-Burman’, ‘Box-Behnken’ or ‘Central Composite’.

Type:

The type of design to create. Must be one of

property seed: int#

Random seed for reproducibility. Default is 42.

property parameters: List[Dict[str, Dict[str, Any]]]#

List of parameters for the design, each with a dictionary of properties. Each dictionary should contain the keys “name”, “type”, and “values”. “values” should be a list of possible values for the parameter. “type” should be either “int”, “integer”, “float”, “<other>”. Any “<other>” will be considered as “categorical”. values should be a list of possible values for the parameter.

property Nexp: int#

Number of experiments in the design, when applicable. Default is 4.

property center: tuple#

Center for the Central Composite Design. Must be a tuple of two values.

property alpha: str#

Alpha for the Central Composite Design. Default is ‘o’ (orthogonal). Can be either ‘o’ or ‘r’ (rotatable).

property face: str#

The relation between the start points and the corner (factorial) points for the Central Composite Design.

There are three possible options for this input:

  1. ‘circumscribed’ or ‘ccc’ (Default)

  2. ‘inscribed’ or ‘cci’

  3. ‘faced’ or ‘ccf’

property lows: Dict[str, float]#

Get the lower bounds for the parameters.

property highs: Dict[str, float]#

Get the upper bounds for the parameters.

property order: int#

Order of the model (for ‘Optimal’ design). Default is 2.

property randomize: bool#

Whether to randomize the run order. Default is True.

property reduction: int#

Reduction factor for ‘Fractional Factorial’ designs. Default is 2.

property design: DataFrame#

Get the design DataFrame.

property feature_constraints#

Get the feature constraints of the experiment for Sobol sequence.

create_design()[source]#

Create the design of experiments based on the specified type and parameters.

plot()[source]#

Plot the design of experiments.

Returns:

A list of Plotly figures representing the design of experiments.

Return type:

List of plotly.graph_objs._figure.Figure