.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_metrics.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_plot_metrics.py: Computing Multi-Objective Quality Metrics ========================================= TODO: Expand this .. GENERATED FROM PYTHON SOURCE LINES 7-11 .. code-block:: Python import numpy as np import moocore .. GENERATED FROM PYTHON SOURCE LINES 12-14 First, read the datasets. .. GENERATED FROM PYTHON SOURCE LINES 14-42 .. code-block:: Python spherical = moocore.get_dataset("spherical-250-10-3d.txt") uniform = moocore.get_dataset("uniform-250-10-3d.txt") ref = 1.1 ref_set = moocore.filter_dominated( np.vstack((spherical[:, :-1], uniform[:, :-1])) ) def apply_within_sets(x, fun, **kwargs): """Apply ``fun`` for each dataset in ``x``.""" _, uniq_index = np.unique(x[:, -1], return_index=True) x_split = np.vsplit(x[:, :-1], uniq_index[1:]) return [fun(g, **kwargs) for g in x_split] uniform_igd_plus = apply_within_sets(uniform, moocore.igd_plus, ref=ref_set) spherical_igd_plus = apply_within_sets( spherical, moocore.igd_plus, ref=ref_set ) print(f""" Uniform Spherical ------- --------- Mean IGD+: {np.mean(uniform_igd_plus):.5f} {np.mean(spherical_igd_plus):.5f} """) .. rst-class:: sphx-glr-script-out .. code-block:: none Uniform Spherical ------- --------- Mean IGD+: 5.96976 0.01988 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.145 seconds) .. _sphx_glr_download_auto_examples_plot_metrics.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_metrics.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_metrics.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_metrics.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_