.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/02_algorithms/plot_07_watchmaker_novelty.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_07_watchmaker_novelty.py: The Blind Watchmaker and novelty-filtered galleries =================================================== Dawkins' *Blind Watchmaker* (1986) showed one parent surrounded by its mutants; the user picks one, which becomes the next parent. The scheme is fast and intuitive but greedy, and galleries soon look alike. NoveltyIEC breeds a larger pool and shows the candidates that are both promising and far from what the user has already seen (novelty search of Lehman and Stanley, 2011), keeping the gallery diverse. .. GENERATED FROM PYTHON SOURCE LINES 14-16 Biomorphs bred by a simulated user ---------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 16-27 .. code-block:: Python import matplotlib.pyplot as plt import easyiec as ei from easyiec.problems import Biomorph from easyiec.strategies import InteractiveGA, NoveltyIEC, Watchmaker problem = Biomorph() user = ei.SimulatedUser(problem, target="random", noise=0.03, seed=6) res_w = ei.run(problem, Watchmaker(pop_size=9), user, generations=15, seed=6) ei.viz.plot_history(res_w.log, problem, steps=[0, 4, 9, 14], size=0.9) .. image-sg:: /auto_examples/02_algorithms/images/sphx_glr_plot_07_watchmaker_novelty_001.png :alt: plot 07 watchmaker novelty :srcset: /auto_examples/02_algorithms/images/sphx_glr_plot_07_watchmaker_novelty_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none
.. GENERATED FROM PYTHON SOURCE LINES 28-33 Gallery diversity: GA, Watchmaker and NoveltyIEC ------------------------------------------------ Mean pairwise distance of the shown genomes per query, three strategies, the same user. Novelty filtering keeps the galleries varied without slowing the progress towards the target. .. GENERATED FROM PYTHON SOURCE LINES 33-46 .. code-block:: Python fig, axes = plt.subplots(1, 2, figsize=(10, 3.4)) for k, (name, strat) in enumerate({"Watchmaker": Watchmaker(pop_size=9), "GA": InteractiveGA(pop_size=9), "NoveltyIEC": NoveltyIEC(pop_size=9)}.items()): user = ei.SimulatedUser(problem, target="random", noise=0.03, seed=6) res = ei.run(problem, strat, user, generations=15, seed=6) d = ei.validation.diversity(res.log, problem) axes[0].plot(d, lw=2, label=name, color=["#285780", "#D55E00", "#009E73"][k]) ei.viz.plot_anytime(res, ax=axes[1], label=name, color=["#285780", "#D55E00", "#009E73"][k], show_shown=False) axes[0].set_xlabel("query", fontsize=8) axes[0].set_ylabel("genome diversity", fontsize=8) axes[0].legend(frameon=False, fontsize=8) axes[1].legend(frameon=False, fontsize=8) plt.show() .. image-sg:: /auto_examples/02_algorithms/images/sphx_glr_plot_07_watchmaker_novelty_002.png :alt: plot 07 watchmaker novelty :srcset: /auto_examples/02_algorithms/images/sphx_glr_plot_07_watchmaker_novelty_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 9.910 seconds) .. _sphx_glr_download_auto_examples_02_algorithms_plot_07_watchmaker_novelty.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_07_watchmaker_novelty.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_07_watchmaker_novelty.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_07_watchmaker_novelty.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_07_watchmaker_novelty.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_