.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/10_mlops/plot_41_dashboard.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 or to run this example in your browser via Binder. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_10_mlops_plot_41_dashboard.py: A one-page report of a search ============================= :func:`~eqdisco.viz.plot_dashboard` summarizes a fitted search on one page: the selected equation, its tree, the Pareto front on test data, a parity plot and the convergence of the run. Together with the model card it documents a model for colleagues who did not run the search. The data are Feynman I.12.2, Coulomb's law :math:`F=q_1q_2/(4\pi\varepsilon r^2)`, with 0.5 % noise. .. GENERATED FROM PYTHON SOURCE LINES 11-18 .. code-block:: Python import matplotlib.pyplot as plt import eqdisco as eq prob = eq.datasets.get_problem("feynman-I.12.2", noise=0.005, n_train=300) .. GENERATED FROM PYTHON SOURCE LINES 19-21 Search and report ----------------- .. GENERATED FROM PYTHON SOURCE LINES 21-27 .. code-block:: Python sr = eq.SymbolicRegressor(population_size=400, generations=30, functions=("add", "sub", "mul", "div", "sqrt", "square"), optimize="lm", feature_names=prob.feature_names, random_state=0) sr.fit(prob.X_train, prob.y_train) print("selected: ", sr.equation_) print("simplified:", eq.simplify.simplify(sr.equation_, prob.X_train, prob.y_train, sympy=True, refit=True, round_digits=True)) print("law recovered (affine, tol 1e-2):", eq.benchmarks.is_symbolic_solution(sr.equation_, prob.truth, X=prob.X_test, affine=True, tol=1e-2)) fig = eq.viz.plot_dashboard(sr, prob.X_train, prob.y_train, prob.X_test, prob.y_test) .. image-sg:: /auto_examples/10_mlops/images/sphx_glr_plot_41_dashboard_001.png :alt: plot 41 dashboard :srcset: /auto_examples/10_mlops/images/sphx_glr_plot_41_dashboard_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none selected: -5.628e-05 + 1.254 * (q2 - 0.002241) * q1 / r / (-1.984)^2 / (sqrt(r^2) / ((r / (r + r))^2 / ((epsilon * epsilon)^2 * (-2.414e-05) + epsilon))) simplified: 0.0796 * (q2 - 0.00224) * q1 / r / abs(r) / (-2.41e-05 * (epsilon^2)^2 + epsilon) - 5.63e-05 law recovered (affine, tol 1e-2): True .. GENERATED FROM PYTHON SOURCE LINES 28-30 Parameter study: population size and recovery --------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 30-44 .. code-block:: Python sizes = [100, 200, 400] hits = [] for mu in sizes: h = 0 for s in range(3): m = eq.SymbolicRegressor(population_size=mu, generations=20, functions=("add", "sub", "mul", "div", "sqrt", "square"), optimize="lm", feature_names=prob.feature_names, random_state=s).fit(prob.X_train, prob.y_train) h += eq.benchmarks.is_symbolic_solution(m.equation_, prob.truth, X=prob.X_test, affine=True, tol=1e-2) hits.append(h) print("population", sizes, "recoveries of 3", hits) fig, ax = plt.subplots(figsize=(4, 3)) ax.bar([str(s) for s in sizes], hits, color="#285780") ax.set_xlabel("population size") ax.set_ylabel("recoveries (of 3 runs)") plt.show() .. image-sg:: /auto_examples/10_mlops/images/sphx_glr_plot_41_dashboard_002.png :alt: plot 41 dashboard :srcset: /auto_examples/10_mlops/images/sphx_glr_plot_41_dashboard_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none population [100, 200, 400] recoveries of 3 [2, 1, 3] .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 46.066 seconds) .. _sphx_glr_download_auto_examples_10_mlops_plot_41_dashboard.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/ComplexSystemsIntelligence/eqdisco/main?urlpath=lab/tree/notebooks/auto_examples/10_mlops/plot_41_dashboard.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_41_dashboard.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_41_dashboard.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_41_dashboard.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_