.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/02_algorithms/plot_01_easyiec_es.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_02_algorithms_plot_01_easyiec_es.py: The EASY-IEC algorithm: a self-adaptive evolution strategy driven by clicks =========================================================================== EASY-IEC (Madár, Abonyi and Szeifert, 2005) is a (μ+λ) evolution strategy in which the user's clicks define the parents: a candidate clicked once becomes a parent, clicked twice it is also copied unchanged into the next gallery. Every individual carries its own step sizes, mutated log-normally before the genes (Schwefel's self-adaptation), so the search contracts automatically once the user keeps choosing similar images. .. GENERATED FROM PYTHON SOURCE LINES 14-18 Three classical strategies on a synthetic landscape --------------------------------------------------- A synthetic preference landscape in six dimensions gives the ground truth; the simulated user answers with Thurstonian noise. Ten seeds per strategy. .. GENERATED FROM PYTHON SOURCE LINES 18-33 .. code-block:: Python import matplotlib.pyplot as plt import easyiec as ei from easyiec.problems import SyntheticPreference from easyiec.strategies import EasyIEC, InteractiveES, InteractiveGA from easyiec.validation import run_benchmark bench = run_benchmark( problems={"ellipsoid-6": lambda: SyntheticPreference(dim=6, kind="ellipsoid", seed=2)}, strategies={"EASY-IEC": lambda: EasyIEC(pop_size=9), "(μ+λ)-ES": lambda: InteractiveES(pop_size=9), "GA": lambda: InteractiveGA(pop_size=9)}, users={"user": lambda p, s: ei.SimulatedUser(p, target="random", noise=0.05, seed=s)}, seeds=range(10), generations=20) print(bench.summary.groupby("strategy")["best_true"].agg(["mean", "std"]).round(3)) ax = ei.viz.plot_convergence(bench.curves, by="strategy", title="ellipsoid landscape, d = 6, 10 seeds") .. image-sg:: /auto_examples/02_algorithms/images/sphx_glr_plot_01_easyiec_es_001.png :alt: ellipsoid landscape, d = 6, 10 seeds :srcset: /auto_examples/02_algorithms/images/sphx_glr_plot_01_easyiec_es_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none mean std strategy (μ+λ)-ES 0.904 0.078 EASY-IEC 0.943 0.047 GA 0.970 0.019 .. GENERATED FROM PYTHON SOURCE LINES 34-38 Gene trajectories of one run ---------------------------- The chosen individuals of each generation in the unit cube: the spread of the genes shrinks as the self-adapted step sizes decrease. .. GENERATED FROM PYTHON SOURCE LINES 38-44 .. code-block:: Python problem = SyntheticPreference(dim=6, kind="ellipsoid", seed=2) user = ei.SimulatedUser(problem, target="random", noise=0.05, seed=4) strategy = EasyIEC(pop_size=9) result = ei.run(problem, strategy, user, generations=20, seed=4) ei.viz.plot_gene_trajectories(result.log, problem) .. image-sg:: /auto_examples/02_algorithms/images/sphx_glr_plot_01_easyiec_es_002.png :alt: plot 01 easyiec es :srcset: /auto_examples/02_algorithms/images/sphx_glr_plot_01_easyiec_es_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 45-49 Self-adapted step sizes ----------------------- The distribution of the mean step size of the final population (initially :math:`1/(2\sqrt d) \approx 0.20`). .. GENERATED FROM PYTHON SOURCE LINES 49-51 .. code-block:: Python ei.viz.plot_strategy_state(strategy) plt.show() .. image-sg:: /auto_examples/02_algorithms/images/sphx_glr_plot_01_easyiec_es_003.png :alt: EasyIEC: mean step sizes of the population :srcset: /auto_examples/02_algorithms/images/sphx_glr_plot_01_easyiec_es_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.697 seconds) .. _sphx_glr_download_auto_examples_02_algorithms_plot_01_easyiec_es.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/easyiec/main?urlpath=lab/tree/notebooks/auto_examples/02_algorithms/plot_01_easyiec_es.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_01_easyiec_es.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_easyiec_es.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_01_easyiec_es.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_