ReportDOE Class#

class ReportDOE(**kwds)

Class for reporting Design of Experiments (DOE).

This class handles the generation of reports for DOE. It can take either an instance of DesignExperiment or a path to a CSV file containing experiment data. It utilizes a plotting package (default ‘matplotlib’) for generating visual representations of the experiments.

design_experiment

An instance of DesignExperiment.

Type

DesignExperiment

serialized_design_experiment

Serialized version of the design_experiment. Can be used to perform additional post-processing, visualization and manipulation of the design space in the report.

Type

bytes

plotting_package

Name of the plotting package to be used for generating plots.

Type

str

csv_file

Path to the CSV file containing the experiment data.

Type

str

Raises
  • ValueError – If both or neither design_experiment and csv_file are provided.

  • ValueError – If the provided design_experiment is not an instance of DesignExperiment or if the csv_file is not a string.

Parameters
  • design_experiment (DesignExperiment, optional) – An instance of DesignExperiment.

  • csv_file (str, optional) – Path to a CSV file containing experiment data.

  • output (str, optional) – Output destination for the plots. If None, plots will be pop-ups.

  • plotting_package (str, optional) – The plotting package to use. Defaults to ‘matplotlib’.

addAnovaTable()

Generates and adds an ANOVA (Analysis of Variance) table to the notebook.

The method computes the ANOVA table based on the design matrix and the response results. It calculates the sum of squares, degrees of freedom, mean squares, and F-statistic for each factor in the design experiment. The computed ANOVA table is then rendered as an HTML table and added to the notebook.

Returns

The generated HTML string representing the ANOVA table.

Return type

str

Raises

ValueError – If the design matrix is empty or not set up correctly.

Notes

The ANOVA table is color-coded based on the F-statistic values. Factors with a significant F-statistic are highlighted, aiding in visual interpretation. Ensure that the assumptions of ANOVA are met before interpreting the results.

Sources:

https://en.wikipedia.org/wiki/Analysis_of_variance#Algorithm https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.f.html

addParameterTable()

Prints a table with the parameters as a function of a run.

addParetoChart()

Generates a string of Python code for creating a Pareto chart using matplotlib. The Pareto chart visualizes the significance of various factors in an ANOVA table.

Returns

Python code for creating the Pareto chart.

Return type

str

Example

>>> report = ReportDOE(design_experiment = experiment,
>>>     plotting_package  = "matplotlib",
>>>     output            = "report_doe.ipynb",
>>>    )
>>> report ()

Note

The generated code assumes that the ANOVA table is stored in a pandas DataFrame with the name ‘anova_table’ and it has a column named ‘F’ for F-values.

addSummaryTable()
create()

Creates the notebook, saves it in the specified output location

createHeader()

Creates some preliminary markdown cells including a table based on the design_experiment object.

static generate_html_table(header, rows, title=None)

Writes an HTML table. It uses a theme close to the msolve documentation theme (color-wise).

plotImportanceRanking()

Returns a list of strings, each string is a command that performs a step in ranking the importance of different design variables using ML algorithm.

plot_parameters_bokeh()

Generates a string of Python code for creating a Bokeh plot. The plot shows the parameters used in the design of experiment. :returns: Python code for creating the plot. :rtype: str

plot_parameters_matplotlib()

Generates a string of Python code for creating a matplotlib plot. The plot shows the parameters used in the design of experiment. :returns: Python code for creating the plot. :rtype: str

plot_parameters_plotly()

Generates a string of Python code for creating a Plotly plot. The plot shows the parameters used in the design of experiment. :returns: Python code for creating the plot. :rtype: str

static print_ascii_table(headers, rows)

Prints an ASCII table with proper vertical and horizontal delimiters and corner markings.

Parameters
  • headers – A list of strings to be used as column headers.

  • rows – A list of lists, where each sublist represents a row of data.

writeTheNotebook(file_path)

Takes all the cells that have been created and writes the notebook to file.

Parameters

file_path – The optional path to the ipynb file where the notebook should be written. If this is None, messages will be displayed in standard output.