.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/10_outputs_and_reports.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_10_outputs_and_reports.py: Outputs and reports in one place ================================ Produce every plot type, every export and the quality report from a single finished design. One finished design usually has to be communicated to several audiences at once: slides want images, a lab notebook wants a readable table, a paper wants LaTeX, and a downstream script wants raw data. This example takes a single design and produces the full range of Mergen's plots and export formats, so each audience gets the artefact that suits it. It is the one example that deliberately generates everything; every other example stays minimal. Parameters ---------- - factor_a, factor_b, factor_c (0.0-1.0, continuous, 15-level grid, rounded to 3 decimals): three generic normalised inputs, enough dimensions for an interesting pairplot and correlation view. The moderate grid lets the optimiser reach a high-quality design at its full default effort while still running quickly. What to look at --------------- - The saved plots (one PNG per type): pairplot for coverage, 1d for per-factor spread, 2d for a single pair, distances for the pairwise profile, correlation for pairwise independence, and quality for the metric percentiles. Any of these can go straight onto a slide. - ``quality_report()`` (printed): the numeric quality summary. - The six export files, each for a different consumer: PNG for slides, Markdown and HTML for a lab notebook, LaTeX for a paper, CSV and JSON for downstream code. Mergen features used -------------------- - ``criteria='phi_p'``: a maximin criterion chosen here because it gives strong, balanced percentiles across all six quality metrics, so the quality plot reads well as a showcase. - ``result.plot('all', save=True)``: render every plot type at once. - Every export format: to_csv, to_json, to_markdown, to_latex, to_html, to_excel. - ``result.quality_report()`` for the printed numeric summary. Estimated runtime: a few seconds to a minute. .. GENERATED FROM PYTHON SOURCE LINES 46-72 .. code-block:: Python # sphinx_gallery_thumbnail_number = 5 from mergen import ParameterSpace, Sampler # 1. Define a three-factor space and build one design. space = ParameterSpace({ 'factor_a': ('continuous', 0.0, 1.0, {'resolution': 15, 'round': 3}), 'factor_b': ('continuous', 0.0, 1.0, {'resolution': 15, 'round': 3}), 'factor_c': ('continuous', 0.0, 1.0, {'resolution': 15, 'round': 3}), }) sampler = Sampler(space) sampler.set_design(n_samples=30) result = sampler.run(criteria='phi_p') # 2. Printed numeric summary. result.quality_report() # 3. Every plot type, saved as PNG (slides). result.plot('all', save=True) # 4. Every export format, each for a different audience. result.to_csv('design.csv') # downstream code result.to_json('design.json') # downstream code result.to_markdown('design.md') # lab notebook result.to_latex('design.tex') # paper result.to_html('design.html') # lab notebook / web result.to_excel('design.xlsx') # spreadsheet users .. rst-class:: sphx-glr-script-out .. code-block:: none ════════════════════════════════════════════════════════════ MERGEN — Space-filling Design ════════════════════════════════════════════════════════════ Parameters : 3 Candidates : 3,375 n_samples : 30 (prescribed_in=0, focus_in=0, optimised_slots=30) Total design : 30 Validation : 6 Criterion : phi_p Algorithm(s) : sa ──────────────────────────────────────────────────────────── [MERGEN] Optimising (criterion=phi_p, algorithm=sa)... [SA] Restart 1/5 [SA] Tuning temperature... [SA] Start log(score)=2.362 T=2.0938e-02 iters=3000 swappable=30 hybrid=0.50 iter 500/3000 T=4.511e-03 best log(score)=1.451 iter 1000/3000 T=9.718e-04 best log(score)=1.335 iter 1500/3000 T=2.094e-04 best log(score)=1.285 iter 2000/3000 T=4.511e-05 best log(score)=1.277 iter 2500/3000 T=9.718e-06 best log(score)=1.260 iter 3000/3000 T=2.094e-06 best log(score)=1.252 [SA] Done log(score)=1.252 (accepted=207/3000, rate=6.9%) [SA] Restart 1: new best log(score)=1.252 [SA] Restart 2/5 [SA] Tuning temperature... [SA] Start log(score)=1.914 T=4.8265e+00 iters=3000 swappable=30 hybrid=0.50 iter 500/3000 T=1.040e+00 best log(score)=1.851 iter 1000/3000 T=2.240e-01 best log(score)=1.851 iter 1500/3000 T=4.827e-02 best log(score)=1.824 iter 2000/3000 T=1.040e-02 best log(score)=1.570 iter 2500/3000 T=2.240e-03 best log(score)=1.385 iter 3000/3000 T=4.827e-04 best log(score)=1.365 [SA] Done log(score)=1.365 (accepted=1584/3000, rate=52.8%) [SA] Restart 3/5 [SA] Tuning temperature... [SA] Start log(score)=1.835 T=2.1039e+00 iters=3000 swappable=30 hybrid=0.50 iter 500/3000 T=4.533e-01 best log(score)=1.583 iter 1000/3000 T=9.765e-02 best log(score)=1.583 iter 1500/3000 T=2.104e-02 best log(score)=1.583 iter 2000/3000 T=4.533e-03 best log(score)=1.391 iter 2500/3000 T=9.765e-04 best log(score)=1.287 iter 3000/3000 T=2.104e-04 best log(score)=1.244 [SA] Done log(score)=1.244 (accepted=1385/3000, rate=46.2%) [SA] Restart 3: new best log(score)=1.244 [SA] Restart 4/5 [SA] Tuning temperature... [SA] Start log(score)=2.285 T=1.6745e-01 iters=3000 swappable=30 hybrid=0.50 iter 500/3000 T=3.608e-02 best log(score)=1.759 iter 1000/3000 T=7.772e-03 best log(score)=1.494 iter 1500/3000 T=1.675e-03 best log(score)=1.373 iter 2000/3000 T=3.608e-04 best log(score)=1.281 iter 2500/3000 T=7.772e-05 best log(score)=1.268 iter 3000/3000 T=1.675e-05 best log(score)=1.256 [SA] Done log(score)=1.256 (accepted=617/3000, rate=20.6%) [SA] Restart 5/5 [SA] Tuning temperature... [SA] Start log(score)=2.292 T=3.4002e-01 iters=3000 swappable=30 hybrid=0.50 iter 500/3000 T=7.326e-02 best log(score)=1.799 iter 1000/3000 T=1.578e-02 best log(score)=1.601 iter 1500/3000 T=3.400e-03 best log(score)=1.380 iter 2000/3000 T=7.326e-04 best log(score)=1.296 iter 2500/3000 T=1.578e-04 best log(score)=1.289 iter 3000/3000 T=3.400e-05 best log(score)=1.264 [SA] Done log(score)=1.264 (accepted=775/3000, rate=25.8%) [MERGEN] sa done -- score=3.471 (elapsed 13.2s) ──────────────────────────────────────────────────────────── MERGEN — Final Design ──────────────────────────────────────────────────────────── Prescribed (in) : 0 Prescribed (out) : 0 Focus (in) : 0 Focus (out) : 0 Optimised : 30 Total design : 30 Validation : 6 ════════════════════════════════════════════════════════════ [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.3275 0.0720 higher 100th pct * Minimax distance 0.3768 0.5394 lower 100th pct Max |correlation| 0.0467 0.2321 lower 99th pct 2D projection CD2 0.1326 0.1187 lower 29th pct CV distances 0.3324 0.3711 lower 100th pct * Mean distance 0.8458 0.7094 higher 100th pct * ──────────────────────────────────────────────────────────────────────── Criterion scores ──────────────────────────────────────────────────────────────────────── PHI_P 3.4710 13.8943 100th pct lower ──────────────────────────────────────────────────────────────────────── * = primarily optimised by 'phi_p' For other priorities, see: mergen.criteria.list_criteria() ──────────────────────────────────────────────────────────────────────── Baseline: 300 MC designs from feasible space | Rank = percentile among baseline designs ════════════════════════════════════════════════════════════════════════ Saved: outputs/pairplot_12.png Saved: outputs/1d_1.png Saved: outputs/1d_2.png Saved: outputs/1d_3.png Saved: outputs/2d_1.png Saved: outputs/2d_2.png Saved: outputs/2d_3.png Saved: outputs/distances_2.png Saved: outputs/correlation_1.png Saved: outputs/quality_2.png Saved: outputs/design.csv (36 rows) Saved: outputs/design.json (36 rows) Saved: outputs/design.md Saved: outputs/design.tex Saved: outputs/design.html Saved: outputs/design.xlsx (36 rows) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_examples/images/sphx_glr_10_outputs_and_reports_001.png :alt: 10 outputs and reports :srcset: /auto_examples/images/sphx_glr_10_outputs_and_reports_001.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_10_outputs_and_reports_002.png :alt: 10 outputs and reports :srcset: /auto_examples/images/sphx_glr_10_outputs_and_reports_002.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_10_outputs_and_reports_003.png :alt: 10 outputs and reports :srcset: /auto_examples/images/sphx_glr_10_outputs_and_reports_003.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_10_outputs_and_reports_004.png :alt: 10 outputs and reports :srcset: /auto_examples/images/sphx_glr_10_outputs_and_reports_004.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_10_outputs_and_reports_005.png :alt: 10 outputs and reports :srcset: /auto_examples/images/sphx_glr_10_outputs_and_reports_005.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_10_outputs_and_reports_006.png :alt: 10 outputs and reports :srcset: /auto_examples/images/sphx_glr_10_outputs_and_reports_006.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_10_outputs_and_reports_007.png :alt: 10 outputs and reports :srcset: /auto_examples/images/sphx_glr_10_outputs_and_reports_007.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_10_outputs_and_reports_008.png :alt: 10 outputs and reports :srcset: /auto_examples/images/sphx_glr_10_outputs_and_reports_008.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_10_outputs_and_reports_009.png :alt: 10 outputs and reports :srcset: /auto_examples/images/sphx_glr_10_outputs_and_reports_009.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/images/sphx_glr_10_outputs_and_reports_010.png :alt: 10 outputs and reports :srcset: /auto_examples/images/sphx_glr_10_outputs_and_reports_010.png :class: sphx-glr-multi-img .. GENERATED FROM PYTHON SOURCE LINES 46-46 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 21.410 seconds) .. _sphx_glr_download_auto_examples_10_outputs_and_reports.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 10_outputs_and_reports.ipynb <10_outputs_and_reports.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 10_outputs_and_reports.py <10_outputs_and_reports.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 10_outputs_and_reports.zip <10_outputs_and_reports.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_