.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/dataset/use_cases/plot_rosenbrock.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_examples_dataset_use_cases_plot_rosenbrock.py: Rosenbrock dataset ================== This :class:`.Dataset` contains 100 evaluations of the well-known Rosenbrock function: .. math:: f(x,y)=(1-x)^2+100(y-x^2)^2 This function is known for its global minimum at point (1,1), its banana valley and the difficulty to reach its minimum. This :class:`.Dataset` is based on a full-factorial design of experiments. `More information about the Rosenbrock function `_ .. GENERATED FROM PYTHON SOURCE LINES 41-51 .. code-block:: default from __future__ import annotations from gemseo import configure_logger from gemseo import create_benchmark_dataset from gemseo.post.dataset.yvsx import YvsX from gemseo.post.dataset.zvsxy import ZvsXY configure_logger() .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 52-56 Load Rosenbrock dataset ----------------------- We can easily load this dataset by means of the high-level function :func:`.create_benchmark_dataset`: .. GENERATED FROM PYTHON SOURCE LINES 56-60 .. code-block:: default dataset = create_benchmark_dataset("RosenbrockDataset") print(dataset) .. rst-class:: sphx-glr-script-out .. code-block:: none GROUP designs objectives VARIABLE x rosen COMPONENT 0 1 0 1 -2.000000 -2.0 3609.000000 2 -1.555556 -2.0 1959.952599 3 -1.111111 -2.0 1050.699741 4 -0.666667 -2.0 600.308642 5 -0.222222 -2.0 421.490779 .. ... ... ... 96 0.222222 2.0 381.095717 97 0.666667 2.0 242.086420 98 1.111111 2.0 58.600975 99 1.555556 2.0 17.927907 100 2.000000 2.0 401.000000 [100 rows x 3 columns] .. GENERATED FROM PYTHON SOURCE LINES 61-63 Show the design data -------------------- .. GENERATED FROM PYTHON SOURCE LINES 63-65 .. code-block:: default print(dataset.design_dataset) .. rst-class:: sphx-glr-script-out .. code-block:: none GROUP designs VARIABLE x COMPONENT 0 1 1 -2.000000 -2.0 2 -1.555556 -2.0 3 -1.111111 -2.0 4 -0.666667 -2.0 5 -0.222222 -2.0 .. ... ... 96 0.222222 2.0 97 0.666667 2.0 98 1.111111 2.0 99 1.555556 2.0 100 2.000000 2.0 [100 rows x 2 columns] .. GENERATED FROM PYTHON SOURCE LINES 66-68 Show the objective data ----------------------- .. GENERATED FROM PYTHON SOURCE LINES 68-70 .. code-block:: default print(dataset.objective_dataset) .. rst-class:: sphx-glr-script-out .. code-block:: none GROUP objectives VARIABLE rosen COMPONENT 0 1 3609.000000 2 1959.952599 3 1050.699741 4 600.308642 5 421.490779 .. ... 96 381.095717 97 242.086420 98 58.600975 99 17.927907 100 401.000000 [100 rows x 1 columns] .. GENERATED FROM PYTHON SOURCE LINES 71-73 Load the data with an input-output naming ----------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 73-76 .. code-block:: default dataset = create_benchmark_dataset("RosenbrockDataset", opt_naming=False) print(dataset) .. rst-class:: sphx-glr-script-out .. code-block:: none GROUP inputs outputs VARIABLE x rosen COMPONENT 0 1 0 0 -2.000000 -2.0 3609.000000 1 -1.555556 -2.0 1959.952599 2 -1.111111 -2.0 1050.699741 3 -0.666667 -2.0 600.308642 4 -0.222222 -2.0 421.490779 .. ... ... ... 95 0.222222 2.0 381.095717 96 0.666667 2.0 242.086420 97 1.111111 2.0 58.600975 98 1.555556 2.0 17.927907 99 2.000000 2.0 401.000000 [100 rows x 3 columns] .. GENERATED FROM PYTHON SOURCE LINES 77-79 Plot the data ------------- .. GENERATED FROM PYTHON SOURCE LINES 79-82 .. code-block:: default ZvsXY(dataset, x=("x", 0), y=("x", 1), z="rosen").execute(save=False, show=True) YvsX(dataset, x=("x", 0), y="rosen").execute(save=False, show=True) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/dataset/use_cases/images/sphx_glr_plot_rosenbrock_001.png :alt: rosen :srcset: /examples/dataset/use_cases/images/sphx_glr_plot_rosenbrock_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/dataset/use_cases/images/sphx_glr_plot_rosenbrock_002.png :alt: plot rosenbrock :srcset: /examples/dataset/use_cases/images/sphx_glr_plot_rosenbrock_002.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none [
] .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.389 seconds) .. _sphx_glr_download_examples_dataset_use_cases_plot_rosenbrock.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_rosenbrock.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_rosenbrock.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_