.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/dataset/plot_rosenbrock.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_dataset_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 43-52 .. code-block:: default from __future__ import division, unicode_literals from matplotlib import pyplot as plt from gemseo.api import configure_logger, load_dataset configure_logger() .. rst-class:: sphx-glr-script-out Out: .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 53-57 Load Rosenbrock dataset ----------------------- We can easily load this dataset by means of the :meth:`~gemseo.api.load_dataset` function of the API: .. GENERATED FROM PYTHON SOURCE LINES 57-61 .. code-block:: default dataset = load_dataset("RosenbrockDataset") print(dataset) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Rosenbrock Number of samples: 100 Number of variables: 2 Variables names and sizes by group: design_parameters: x (2) functions: rosen (1) Number of dimensions (total = 3) by group: design_parameters: 2 functions: 1 .. GENERATED FROM PYTHON SOURCE LINES 62-64 Show the input and output data ------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 64-67 .. code-block:: default print(dataset.get_data_by_group("design_parameters")) print(dataset.get_data_by_group("functions")) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none [[-2. -2. ] [-1.55555556 -2. ] [-1.11111111 -2. ] [-0.66666667 -2. ] [-0.22222222 -2. ] [ 0.22222222 -2. ] [ 0.66666667 -2. ] [ 1.11111111 -2. ] [ 1.55555556 -2. ] [ 2. -2. ] [-2. -1.55555556] [-1.55555556 -1.55555556] [-1.11111111 -1.55555556] [-0.66666667 -1.55555556] [-0.22222222 -1.55555556] [ 0.22222222 -1.55555556] [ 0.66666667 -1.55555556] [ 1.11111111 -1.55555556] [ 1.55555556 -1.55555556] [ 2. -1.55555556] [-2. -1.11111111] [-1.55555556 -1.11111111] [-1.11111111 -1.11111111] [-0.66666667 -1.11111111] [-0.22222222 -1.11111111] [ 0.22222222 -1.11111111] [ 0.66666667 -1.11111111] [ 1.11111111 -1.11111111] [ 1.55555556 -1.11111111] [ 2. -1.11111111] [-2. -0.66666667] [-1.55555556 -0.66666667] [-1.11111111 -0.66666667] [-0.66666667 -0.66666667] [-0.22222222 -0.66666667] [ 0.22222222 -0.66666667] [ 0.66666667 -0.66666667] [ 1.11111111 -0.66666667] [ 1.55555556 -0.66666667] [ 2. -0.66666667] [-2. -0.22222222] [-1.55555556 -0.22222222] [-1.11111111 -0.22222222] [-0.66666667 -0.22222222] [-0.22222222 -0.22222222] [ 0.22222222 -0.22222222] [ 0.66666667 -0.22222222] [ 1.11111111 -0.22222222] [ 1.55555556 -0.22222222] [ 2. -0.22222222] [-2. 0.22222222] [-1.55555556 0.22222222] [-1.11111111 0.22222222] [-0.66666667 0.22222222] [-0.22222222 0.22222222] [ 0.22222222 0.22222222] [ 0.66666667 0.22222222] [ 1.11111111 0.22222222] [ 1.55555556 0.22222222] [ 2. 0.22222222] [-2. 0.66666667] [-1.55555556 0.66666667] [-1.11111111 0.66666667] [-0.66666667 0.66666667] [-0.22222222 0.66666667] [ 0.22222222 0.66666667] [ 0.66666667 0.66666667] [ 1.11111111 0.66666667] [ 1.55555556 0.66666667] [ 2. 0.66666667] [-2. 1.11111111] [-1.55555556 1.11111111] [-1.11111111 1.11111111] [-0.66666667 1.11111111] [-0.22222222 1.11111111] [ 0.22222222 1.11111111] [ 0.66666667 1.11111111] [ 1.11111111 1.11111111] [ 1.55555556 1.11111111] [ 2. 1.11111111] [-2. 1.55555556] [-1.55555556 1.55555556] [-1.11111111 1.55555556] [-0.66666667 1.55555556] [-0.22222222 1.55555556] [ 0.22222222 1.55555556] [ 0.66666667 1.55555556] [ 1.11111111 1.55555556] [ 1.55555556 1.55555556] [ 2. 1.55555556] [-2. 2. ] [-1.55555556 2. ] [-1.11111111 2. ] [-0.66666667 2. ] [-0.22222222 2. ] [ 0.22222222 2. ] [ 0.66666667 2. ] [ 1.11111111 2. ] [ 1.55555556 2. ] [ 2. 2. ]] [[3.60900000e+03] [1.95995260e+03] [1.05069974e+03] [6.00308642e+02] [4.21490779e+02] [4.20601890e+02] [5.97641975e+02] [1.04625530e+03] [1.95373038e+03] [3.60100000e+03] [3.09541975e+03] [1.58683874e+03] [7.82935681e+02] [4.02777778e+02] [2.59076513e+02] [2.58187624e+02] [4.00111111e+02] [7.78491236e+02] [1.58061652e+03] [3.08741975e+03] [2.62134568e+03] [1.25323106e+03] [5.54677793e+02] [2.44753086e+02] [1.36168419e+02] [1.35279531e+02] [2.42086420e+02] [5.50233349e+02] [1.24700884e+03] [2.61334568e+03] [2.18677778e+03] [9.59129553e+02] [3.65926078e+02] [1.26234568e+02] [5.27664990e+01] [5.18776101e+01] [1.23567901e+02] [3.61481634e+02] [9.52907331e+02] [2.17877778e+03] [1.79171605e+03] [7.04534217e+02] [2.16680537e+02] [4.72222222e+01] [8.87075141e+00] [7.98186252e+00] [4.45555556e+01] [2.12236092e+02] [6.98311995e+02] [1.78371605e+03] [1.43616049e+03] [4.89445054e+02] [1.06941168e+02] [7.71604938e+00] [4.48117665e+00] [3.59228776e+00] [5.04938272e+00] [1.02496723e+02] [4.83222832e+02] [1.42816049e+03] [1.12011111e+03] [3.13862064e+02] [3.67079713e+01] [7.71604938e+00] [3.95977747e+01] [3.87088858e+01] [5.04938272e+00] [3.22635269e+01] [3.07639841e+02] [1.11211111e+03] [8.43567901e+02] [1.77785246e+02] [5.98094803e+00] [4.72222222e+01] [1.14220546e+02] [1.13331657e+02] [4.45555556e+01] [1.53650358e+00] [1.71563024e+02] [8.35567901e+02] [6.06530864e+02] [8.12146014e+01] [1.47600975e+01] [1.26234568e+02] [2.28349489e+02] [2.27460601e+02] [1.23567901e+02] [1.03156531e+01] [7.49923792e+01] [5.98530864e+02] [4.09000000e+02] [2.41501296e+01] [6.30454199e+01] [2.44753086e+02] [3.81984606e+02] [3.81095717e+02] [2.42086420e+02] [5.86009755e+01] [1.79279073e+01] [4.01000000e+02]] .. GENERATED FROM PYTHON SOURCE LINES 68-70 Load the data with an input-output naming ----------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 70-73 .. code-block:: default dataset = load_dataset("RosenbrockDataset", opt_naming=False) print(dataset) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Rosenbrock Number of samples: 100 Number of variables: 2 Variables names and sizes by group: inputs: x (2) outputs: rosen (1) Number of dimensions (total = 3) by group: inputs: 2 outputs: 1 .. GENERATED FROM PYTHON SOURCE LINES 74-76 Plot the data ------------- .. GENERATED FROM PYTHON SOURCE LINES 76-81 .. code-block:: default dataset.plot("ZvsXY", x="x", x_comp=0, y="x", y_comp=1, z="rosen", show=False) dataset.plot("YvsX", x="x", x_comp=0, y="rosen", show=False) # Workaround for HTML rendering, instead of ``show=True`` plt.show() .. rst-class:: sphx-glr-horizontal * .. image:: /examples/dataset/images/sphx_glr_plot_rosenbrock_001.png :alt: rosen :class: sphx-glr-multi-img * .. image:: /examples/dataset/images/sphx_glr_plot_rosenbrock_002.png :alt: plot rosenbrock :class: sphx-glr-multi-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.384 seconds) .. _sphx_glr_download_examples_dataset_plot_rosenbrock.py: .. only :: html .. container:: sphx-glr-footer :class: 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 `_