.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/01_quickstart.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_01_quickstart.py: Quickstart: a first design ========================== Build a 30-run design for a thermal deposition study and read its quality evidence. A materials-science lab is preparing a thermal deposition study on a multilayer coating. Reactor time is limited, so the goal is to pick a small set of runs that jointly cover the operating envelope as evenly as possible, ready to feed a first surrogate model. Parameters ---------- - temperature (100-500 degC, 10-degree steps): sweep the deposition window, from the lowest useful onset to the upper safe limit of the chamber. - pressure (0.5-5.0 bar, continuous): span sub-atmospheric to mildly pressurised conditions typical of chemical vapour deposition. - n_layers (2-10, integer): explore thin stacks up to the layer count the process can build in one campaign. What to look at --------------- - ``summary()``: the "Optimised" and "Validation" counts confirm the design was built and that a hold-out set was reserved automatically. - ``quality_report()``: percentiles against the Monte Carlo baseline should be well above 90 for min_distance and near 0 for max_absolute_correlation; that pair is the primary evidence of a good space-filling design. - ``plot('pairplot')``: every 2D projection should look evenly populated, with no clustered corners or empty bands. Mergen features used -------------------- - ``ParameterSpace`` with three factor types (discrete, continuous, integer). - ``Sampler.set_design()`` and ``Sampler.run()`` at their defaults, so the example stays minimal and shows the shape of the workflow with no configuration to reason about. Estimated runtime: a few seconds. .. GENERATED FROM PYTHON SOURCE LINES 43-62 .. code-block:: Python from mergen import ParameterSpace, Sampler # 1. Define the parameter space space = ParameterSpace({ 'temperature': range(100, 500, 10), # discrete 'pressure': ('continuous', 0.5, 5.0), # continuous grid 'n_layers': ('integer', 2, 10), # integer grid }) # 2. Configure and run the sampler sampler = Sampler(space) sampler.set_design() result = sampler.run() # 3. Inspect, visualise, export result.summary() result.quality_report() result.plot('pairplot', save=True) result.to_csv('design.csv') .. rst-class:: sphx-glr-script-out .. code-block:: none ════════════════════════════════════════════════════════════ MERGEN — Space-filling Design ════════════════════════════════════════════════════════════ Parameters : 3 Candidates : 36,000 n_samples : 30 (prescribed_in=0, focus_in=0, optimised_slots=30) Total design : 30 Validation : 6 Criterion : umaxpro Algorithm(s) : sa ──────────────────────────────────────────────────────────── [MERGEN] Optimising (criterion=umaxpro, algorithm=sa)... [SA] Restart 1/5 [SA] Tuning temperature... [SA] Start log(score)=35.870 T=5.2135e+20 iters=3000 swappable=30 hybrid=0.50 iter 500/3000 T=1.123e+20 best log(score)=34.675 iter 1000/3000 T=2.420e+19 best log(score)=34.675 iter 1500/3000 T=5.213e+18 best log(score)=34.675 iter 2000/3000 T=1.123e+18 best log(score)=34.675 iter 2500/3000 T=2.420e+17 best log(score)=34.675 iter 3000/3000 T=5.213e+16 best log(score)=34.675 [SA] Done log(score)=34.675 (accepted=2881/3000, rate=96.0%) [SA] Restart 1: new best log(score)=34.675 [SA] Restart 2/5 [SA] Tuning temperature... [SA] Start log(score)=47.598 T=1.5658e+21 iters=3000 swappable=30 hybrid=0.50 iter 500/3000 T=3.373e+20 best log(score)=34.139 iter 1000/3000 T=7.268e+19 best log(score)=34.139 iter 1500/3000 T=1.566e+19 best log(score)=34.139 iter 2000/3000 T=3.373e+18 best log(score)=34.139 iter 2500/3000 T=7.268e+17 best log(score)=34.139 iter 3000/3000 T=1.566e+17 best log(score)=34.139 [SA] Done log(score)=34.139 (accepted=2891/3000, rate=96.4%) [SA] Restart 2: new best log(score)=34.139 [SA] Restart 3/5 [SA] Tuning temperature... [SA] Start log(score)=49.134 T=3.5070e+20 iters=3000 swappable=30 hybrid=0.50 iter 500/3000 T=7.556e+19 best log(score)=36.093 iter 1000/3000 T=1.628e+19 best log(score)=35.979 iter 1500/3000 T=3.507e+18 best log(score)=35.979 iter 2000/3000 T=7.556e+17 best log(score)=35.144 iter 2500/3000 T=1.628e+17 best log(score)=35.144 iter 3000/3000 T=3.507e+16 best log(score)=35.144 [SA] Done log(score)=35.144 (accepted=2880/3000, rate=96.0%) [SA] Restart 4/5 [SA] Tuning temperature... [SA] Start log(score)=49.947 T=1.4001e+21 iters=3000 swappable=30 hybrid=0.50 iter 500/3000 T=3.017e+20 best log(score)=35.468 iter 1000/3000 T=6.499e+19 best log(score)=34.647 iter 1500/3000 T=1.400e+19 best log(score)=34.647 iter 2000/3000 T=3.017e+18 best log(score)=34.647 iter 2500/3000 T=6.499e+17 best log(score)=34.647 iter 3000/3000 T=1.400e+17 best log(score)=34.647 [SA] Done log(score)=34.647 (accepted=2871/3000, rate=95.7%) [SA] Restart 5/5 [SA] Tuning temperature... [SA] Start log(score)=50.211 T=1.1365e+21 iters=3000 swappable=30 hybrid=0.50 iter 500/3000 T=2.449e+20 best log(score)=34.994 iter 1000/3000 T=5.275e+19 best log(score)=34.631 iter 1500/3000 T=1.137e+19 best log(score)=34.631 iter 2000/3000 T=2.449e+18 best log(score)=34.631 iter 2500/3000 T=5.275e+17 best log(score)=34.631 iter 3000/3000 T=1.137e+17 best log(score)=34.631 [SA] Done log(score)=34.631 (accepted=2868/3000, rate=95.6%) [MERGEN] sa done -- score=6.702e+14 (elapsed 40.5s) ──────────────────────────────────────────────────────────── MERGEN — Final Design ──────────────────────────────────────────────────────────── Prescribed (in) : 0 Prescribed (out) : 0 Focus (in) : 0 Focus (out) : 0 Optimised : 30 Total design : 30 Validation : 6 ════════════════════════════════════════════════════════════ ──────────────────────────────────────────────────── MERGEN Design Summary ──────────────────────────────────────────────────── Optimised : 30 Total design : 30 Validation : 6 ──────────────────────────────────────────────────── Parameters : 3 Candidates : 36000 Criterion : umaxpro Seed : 44 Algorithm : sa ──────────────────────────────────────────────────── [METRICS] Computing MC baseline (300 designs)... [METRICS] MC baseline complete (300 designs). ════════════════════════════════════════════════════════════════════════ MERGEN Design Metrics (n=30, d=3) ════════════════════════════════════════════════════════════════════════ Metric Value Baseline Better when Rank ──────────────────────────────────────────────────────────────────────── Min distance 0.1355 0.0720 higher 97th pct Minimax distance 0.4675 0.5416 lower 91th pct * Max |correlation| 0.1968 0.2313 lower 63th pct * 2D projection CD2 0.0929 0.1174 lower 89th pct * CV distances 0.3627 0.3709 lower 78th pct Mean distance 0.6896 0.6937 higher 44th pct ──────────────────────────────────────────────────────────────────────── Criterion scores ──────────────────────────────────────────────────────────────────────── UMAXPRO 6.7021e+14 5.9234e+21 100th pct lower ──────────────────────────────────────────────────────────────────────── * = primarily optimised by 'umaxpro' For other priorities, see: mergen.criteria.list_criteria() ──────────────────────────────────────────────────────────────────────── Baseline: 300 MC designs from feasible space | Rank = percentile among baseline designs ════════════════════════════════════════════════════════════════════════ Saved: outputs/pairplot_1.png Saved: outputs/design.csv (36 rows) .. image-sg:: /auto_examples/images/sphx_glr_01_quickstart_001.png :alt: 01 quickstart :srcset: /auto_examples/images/sphx_glr_01_quickstart_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 43-43 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 45.404 seconds) .. _sphx_glr_download_auto_examples_01_quickstart.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 01_quickstart.ipynb <01_quickstart.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 01_quickstart.py <01_quickstart.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 01_quickstart.zip <01_quickstart.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_