discopt-doe
Design-of-experiments plugin for the discopt
modeling language. Installs as the discopt.doe namespace package — code written
against from discopt.doe import ... works unchanged.
Three complementary entry points:
- "What is the best operating condition?" — active-learning optimization: fit a surrogate to completed experiments, recommend the next batch via an acquisition function (EI, UCB, steepest ascent), track everything in an Excel workbook.
- "Does this factor matter?" — classical designs: 2-level full/fractional factorials, mixture designs, Latin/Graeco-Latin squares, main-effect estimates, ANOVA.
- "How precisely can I estimate the model parameters?" — model-based DoE: exact D/A/E-optimal design from the Fisher Information Matrix (JAX autodiff), identifiability/estimability diagnostics, profile likelihood, model discrimination, sequential estimate–design loops.
Parameter estimation (discopt.estimate) lives in the base package; both
share the same Experiment interface.
Try it without installing anything
jkitchin.github.io/discopt-doe/app/ runs the design workflow in your browser — pick a design, download the spreadsheet, fill in your measurements, upload it back for fitting and ANOVA. It is Pyodide running the real package, not a reimplementation, and the workbooks it produces are the same ones the CLI reads. Nothing leaves your machine. See docs/browser-app.md.
The full app, with one command
The browser page has no jax, so it cannot run extend, optimize, or a model
of your own (--module). The local GUI can do all of these. If you have
uv, one line downloads everything (Python
included) into uv's cache and opens the app, with no environment to set up:
uvx --from discopt --with "discopt-doe[gui]" discopt doe gui
discopt comes first because it provides the discopt command, and
discopt-doe adds the doe subcommand to it. Pass a workbook to open it
(... discopt doe gui campaign.xlsx), or --port N / --no-browser. The same
prefix runs every CLI verb, e.g. uvx --from discopt --with discopt-doe discopt doe status campaign.xlsx.
The first run downloads jax, jaxlib, scipy and Streamlit (well over a gigabyte
of cache), and later runs start from the cache. To pin a version, write
"discopt-doe[gui]==X.Y.Z". To pick up a newer release, add --refresh. A
--module model is found in the working directory or next to the workbook, so
keeping my_model.py beside campaign.xlsx just works. A model that lives in
an installable package can be added with another --with (e.g.
--with ./my-models).
Install
Both discopt-doe and its discopt>=0.13 dependency are published on
PyPI, so a plain pip install resolves
everything:
pip install discopt-doe # core
pip install "discopt-doe[gui]" # + Streamlit workbook GUI
pip install "discopt-doe[ml]" # + scikit-learn surrogates
Or with uv:
uv pip install "discopt-doe[gui]"
To just run the app without installing it, see the one-command route above.
From source, to work on the package itself:
git clone https://github.com/jkitchin/discopt-doe
cd discopt-doe
uv sync --all-extras # core + gui + ml + dev
Quick start
FIM-based optimal design:
from discopt.doe import compute_fim, optimal_experiment, DesignCriterion
fim = compute_fim(experiment, param_values={"k": 2.0}, design_values={"T": 350.0})
design = optimal_experiment(
experiment,
param_values={"k": 2.0},
design_bounds={"T": (300, 400)},
criterion=DesignCriterion.D_OPTIMAL,
)
print(design.summary())
Active-learning round against a workbook:
from discopt.doe import optimize_round, OptimizationCriterion
result = optimize_round(
workbook="opt.xlsx",
criterion=OptimizationCriterion.MAXIMIZE,
surrogate="gp",
acquisition="expected_improvement",
batch_size=4,
)
print(result.next_designs)
Several objectives at once -- with a mechanistic model, or trading information against cost:
from discopt.doe import design_tradeoff, model_based_optimize_round
# Yield vs. impurity: model-based ParEGO; returns the model's predicted Pareto front.
result = model_based_optimize_round(
"reactor.xlsx", experiment=experiment,
objectives={"yield": "maximize", "impurity": "minimize"}, batch_size=3,
)
# How much information does each hour of experiment cost?
front = design_tradeoff(
experiment, param_values, design_bounds,
tradeoff=lambda d: max(d.values()), sense="minimize",
)
print(front.summary())
Design for what you actually need to know, not for every parameter: a prediction at an operating point, a derived quantity, or a few parameters with the rest as nuisance, optionally to a tolerance. Then certify how close to optimal the design is:
from discopt.doe import Target, batch_optimal_experiment, certify_design
target = Target.responses(at=[{"T": 365.0, "t": 4.0}], tolerances={"B": 0.004})
batch = batch_optimal_experiment(
experiment, theta, bounds, 2, criterion="trace", target=target, prior_fim=prior
)
print(batch.target_precision().summary()) # SE and SE/tolerance per target
print(certify_design(experiment, theta, batch.designs, target,
design_bounds=bounds, prior_fim=prior).summary())
sequential_doe(..., target=target, stop_at_tolerance=True) stops a campaign
as soon as the goal is met, robust_optimal_experiment(..., target=target)
keeps the design good over parameter uncertainty, and profile_target checks
the promised precision against the profile likelihood once data are in. The
GUI and the browser app take targets too. See
Targeted design and the
worked example.
Identifiability diagnostics before you spend beam time:
from discopt.doe import diagnose_identifiability, estimability_rank
diag = diagnose_identifiability(experiment, param_values)
est = estimability_rank(experiment, param_values)
Command line
Installing this package adds the doe subcommand to the base discopt CLI
(via the "discopt.cli" entry-point group):
discopt doe templates # list workbook templates
discopt doe new linear -o run.xlsx --input T:300:400 --n 8
discopt doe status run.xlsx
discopt doe fit run.xlsx # fit parameters to completed rows
discopt doe anova run.xlsx # ANOVA F-table (latin/factorial designs)
discopt doe extend run.xlsx --n 4 # design the next batch
discopt doe foldover screen.xlsx # de-alias a 2-level screening design
discopt doe optimize run.xlsx # one active-learning round (optimize template)
discopt doe gui run.xlsx # Streamlit GUI (needs [gui] extra)
Classical designs over a continuous factor box — space-filling, or built for a quadratic response surface — need no model up front:
discopt doe new latin-hypercube -o lhs.xlsx --input T:300:400 --input P:1:5 --n 12
discopt doe new central-composite -o ccd.xlsx --input T:300:400 --input P:1:5
discopt doe new box-behnken -o bbd.xlsx --input T:300:400 --input P:1:5 --input F:0.1:2
fit estimates the recorded basis (--basis linear|quadratic) by least
squares, so a Box-Behnken or central-composite campaign goes straight from
new to fit with no model definition. extend augments it through the same
basis: the new runs are D-optimal given every run already planned (measured or
not, since a linear model's information does not depend on the responses), and
it reports how much narrower the coefficient intervals become.
A two-level screening campaign (factorial-2level, fractional-factorial,
plackett-burman) is followed up differently. Optimal runs would not undo its
aliasing, so extend refuses it and points to foldover, which appends the
mirror image of the original corner runs as batch 2: every main effect is then
clear of the two-factor interactions. --factor NAME reverses one factor only,
which clears that factor and its interactions.
discopt doe new fractional-factorial -o screen.xlsx \
--factor a:-1:1 --factor b:-1:1 --factor c:-1:1 --factor d:-1:1 --factor e:-1:1 \
--generator d=ab --generator e=ac # resolution III, 8 runs
discopt doe foldover screen.xlsx # + 8 mirror runs: resolution IV
``` Central-composite keeps every run
inside the bounds you give by default; pass `--outside-bounds` for the textbook
scaling where the axial points sit beyond them.
For a model of your own — including one nonlinear in its parameters — write the
response and its parameters directly:
```bash
discopt doe new symbolic -o arrhenius.xlsx \
--expr "k0 * exp(-Ea / (8.314 * T))" \
--param k0=2.0 --param Ea=5000 \
--input T:300:500 --n 6
discopt doe fit arrhenius.xlsx # nonlinear least squares, analytic Jacobian
discopt doe extend arrhenius.xlsx --n 4 # next batch, re-centred on the fit
The expression is differentiated with sympy, so ∂y/∂θ is exact rather than a
finite difference. A nonlinear model's information depends on its parameter
values, so --param gives the nominal point the design is built around; fit
then extend re-centres it on what the data say.
When one expression is not enough (several measured responses per run, or a
model you already have as a discopt.estimate.Experiment), load it with
new module. The runs sheet gets one column per response of the
ExperimentModel, with the model's measurement_error as each response's
sigma:
discopt doe new module --module mypkg.partition:Partition -o part.xlsx \
--bounds pH:2:8 --params aA=0.5 --params bA=0.8 --params cA=-0.1 \
--params aB=-0.3 --params bB=-0.6 --params cB=0.05 \
--sigma B_aq=0.03 --n 8 # override one response's sigma
discopt doe fit part.xlsx # weighted least squares over every response
discopt doe extend part.xlsx --n 10 --batch-strategy joint
Any campaign designed around a model can be designed for a target instead
of all parameters. The target is stored in the workbook, reused by extend,
and reported against its tolerance by status:
discopt doe new symbolic ... --criterion trace \
--target-response B@T=365,t=4 --tolerance B=0.004 # a prediction
# --target Ea --tolerance Ea=0.02 --relative-precision # a parameter, to 2 %
# --target-expr "half_life=log(2)/k" # a formula
discopt doe extend ccd.xlsx --n 2 --target b12 # augment a CCD for one interaction
Leave a cell blank when something was not measured. A run counts as done once
any response is filled in, and blanks are dropped from the fit, not read as
zero. fit gives the same estimates and intervals as
sequential_doe(..., initial_runs=...) on the same rows, and reports the reduced
chi-square so you can check the declared errors. The
CLI notebook works through a two-species,
two-phase example.
GUI
discopt doe gui [workbook.xlsx] launches a Streamlit app over a campaign
workbook (install the [gui] extra, which also pulls scikit-learn for the
active-learning round, or run it without installing:
uvx --from discopt --with "discopt-doe[gui]" discopt doe gui). It wraps the
same do_* functions as the CLI:
- Create a new campaign from a template, browsing to an output folder.
- Edit responses in-app or in Excel, then Save; the Rename panel can rename factors/response — note this clears the fit artifacts, so re-run Fit.
- Fit / Extend / Optimize / ANOVA panels drive the corresponding verb, and a History panel shows the workbook's audit log.
Flags: --port N, --no-browser. The DISCOPT_DOE_WORKBOOK environment
variable pre-selects a workbook. Keep charts in a separate file — the CLI/GUI
rewrite the workbook and openpyxl does not preserve embedded charts (a .bak
is written before the first save).
Development
The project is uv-managed:
uv sync --all-extras # create .venv with everything
uv run pytest # fast test set (slow tests excluded by default)
uv run pytest -m '' # everything
To develop against a local discopt checkout instead of the PyPI release, add
a [tool.uv.sources] override pointing discopt at your editable clone:
[tool.uv.sources]
discopt = { path = "../discopt", editable = true }
Docs are a Jupyter Book:
uv run jupyter-book build docs/
Claude Code skill
The package bundles a /discopt-doe skill and four expert agents (DoE,
estimability, identifiability, model discrimination) for Claude Code:
discopt-doe-install-skill # install to ~/.claude
discopt-doe-install-skill --project # install to ./.claude (versioned)
The skill and agents also follow the Agent Skills
repository layout (skills/discopt-doe/SKILL.md, agents/*.md), so they can be installed
straight from GitHub with knowhow, for Claude Code,
VS Code (Copilot), Codex, OpenCode, Gemini CLI, Cursor and other agents, without
installing this package first. The skill still needs discopt-doe installed to run.
uvx knowhow add jkitchin/discopt-doe --list # what's available
uvx knowhow add jkitchin/discopt-doe --skill discopt-doe # the skill, into this project
uvx knowhow add jkitchin/discopt-doe --all -g # skill + agents, all projects
# or, skill only: npx skills add jkitchin/discopt-doe --skill discopt-doe
knowhow records installs in lock files, so uvx knowhow check / upgrade pick up new
versions of the skill.
Related work
discopt-doe is not the only open-source option, and for some jobs it is not the best one. What distinguishes it is the combination of classical designs, model-based design, and a workbook/CLI/app workflow in one package; where another tool is a better fit, use it.
Model-based design of experiments. These are the closest neighbours — they design experiments from a mechanistic model and its Fisher information.
- Pyomo.DoE
— MBDoE for models written in Pyomo, solving the design problem as a
nonlinear program with finite-difference sensitivities. If your model
is already an algebraic or DAE Pyomo model, or you need design variables
subject to serious process constraints, this is more powerful than what is
here. Wang & Dowling, AIChE J 68 (2022), e17813. The two packages are
compared head to head, against exact references rather than against each
other, in
benchmarks/pyomo_doe_comparison/REPORT.md; several correctness fixes in discopt-doe came out of it. - pydex — optimal continuous (approximate) designs: it optimises weights over a candidate set through scipy or cvxpy, which is the natural home for the equivalence theorem. discopt-doe builds exact designs of a fixed number of runs instead; the two answer different questions about the same problem.
- Pyomo.parmest — the estimation half of the same loop: parameter fitting with bootstrap and likelihood-ratio confidence regions. It pairs naturally with Pyomo.DoE.
- PyOED — model-constrained OED for inverse problems and data assimilation, aimed at PDE-scale problems.
Classical and algorithmic designs.
- pyDOE3 — the maintained descendant of pyDOE/pyDOE2: factorial, fractional factorial, Plackett–Burman, Box–Behnken, central composite and Latin hypercube generators. Small, dependency-light, and a fine choice if a design matrix is all you need.
- dexpy — classical DOE from Stat-Ease, with D-optimal construction and power analysis.
- OApackage — orthogonal arrays, conference designs and D-efficient designs, with the combinatorial search done properly in C++.
- pyoptex — optimal design with extensible criteria and design structures, including split-plot and other restricted randomizations.
Sequential optimization and surrogates. Chapters on Bayesian optimization here are deliberately introductory; for production campaigns these are stronger.
- BoTorch and Ax — Bayesian optimization on PyTorch, with multi-objective, batch and constrained variants.
- BayBE — Bayesian experimental design aimed squarely at chemistry and formulation, with good handling of categorical and mixture-like search spaces.
- SMT — surrogate modelling toolbox, including sampling plans and gradient-enhanced models.
Outside Python. R remains the deepest ecosystem for classical DOE:
DoE.base and FrF2 for factorial and fractional designs, AlgDesign for
D/A/I-optimal construction, rsm for response-surface work, and daewr for the
designs in Lawson's textbook. JMP, Design-Expert and Minitab are the
commercial standards; the capability map in the book is written against the
workflow those tools support, without naming them.
Literature
The methods implemented here are referenced throughout the docs; the full bibliography is in docs/references.bib (Atkinson & Donev optimal design, Franceschini & Macchietto MBDoE, Yao estimability, Raue profile likelihood, Hunter–Reiner/Buzzi-Ferraris discrimination, and more).
Metadata
Release files for discopt-doe 0.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| discopt_doe-0.7.1.tar.gz | 1.5 MB | With provenance | Details for discopt_doe-0.7.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| discopt_doe-0.7.1-py3-none-any.whl | Python 3 | none | any | Details for discopt_doe-0.7.1-py3-none-any.whl |
Total release size: 2.9 MB
Release files / discopt_doe-0.7.1.tar.gz
| Download URL | discopt_doe-0.7.1.tar.gz |
|---|---|
| Size | 1.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4544833ebd143524eaa4b142a2828998ac7a9ab7e26daa5bd2f202d57d55f0d0
|
|
BLAKE2b-256 checksum How to use checksums |
7c0d081fffc1df094cf76e4702481a343e5d83750caef3f7703401aac63dccbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logRelease files / discopt_doe-0.7.1-py3-none-any.whl
| Download URL | discopt_doe-0.7.1-py3-none-any.whl |
|---|---|
| Size | 1.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d3cd5cf650f6919130b99b4d0649656016c36203a99d176ea8bc63c45913325e
|
|
BLAKE2b-256 checksum How to use checksums |
292eb16fdafd20445c9a679b4a9987b6027e2aade21009bb83415b1c8a659349
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logSecurity for discopt-doe 0.7.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for discopt_doe-0.7.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.