.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_meta_modeling/kriging_metamodel/plot_draw_covariance_models.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_meta_modeling_kriging_metamodel_plot_draw_covariance_models.py: Kriging : draw covariance models ================================ .. GENERATED FROM PYTHON SOURCE LINES 5-10 .. code-block:: default import openturns as ot import openturns.viewer as otv from matplotlib import pylab as plt import pylab as pl .. GENERATED FROM PYTHON SOURCE LINES 11-17 Abstract -------- Gaussian processes are a common fixture in UQ and in OpenTURNS. They are defined by their covariance function and OpenTURNS implements several of them. In this example we should depict covariance functions and play with parameters for two families of models : the generalized exponential model and the Matern models. For visualization sake we should limit ourselves to the dimension 1. .. GENERATED FROM PYTHON SOURCE LINES 17-19 .. code-block:: default dimension = 1 .. GENERATED FROM PYTHON SOURCE LINES 20-21 We set the lower bound to zero for stationary kernels .. GENERATED FROM PYTHON SOURCE LINES 21-24 .. code-block:: default ot.ResourceMap.SetAsScalar("CovarianceModel-DefaultTMin", 0.0) .. GENERATED FROM PYTHON SOURCE LINES 25-32 The generalized exponential model --------------------------------- The :class:`~openturns.GeneralizedExponential` class implements a generalized exponential with a parameter :math:`p < 0 \leq 2` exponent. The case :math:`p=1` is the standard exponential model while :math:`p=2` is the squared exponential. .. GENERATED FROM PYTHON SOURCE LINES 34-40 Various parameters p and a fixed correlation length of 0.1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ In this part we set the correlation length to :math:`\theta = 0.1` and study three different models with parameters :math:`p=0.25`, :math:`p=1` and :math:`p=2` and trajectories from gaussian processes based on these models. .. GENERATED FROM PYTHON SOURCE LINES 42-43 We define the :math:`p = 0.25` generalized exponential model : .. GENERATED FROM PYTHON SOURCE LINES 43-45 .. code-block:: default covarianceModel = ot.GeneralizedExponential([0.1], 0.25) .. GENERATED FROM PYTHON SOURCE LINES 46-47 We define the :math:`p = 1` generalized exponential model : .. GENERATED FROM PYTHON SOURCE LINES 47-49 .. code-block:: default covarianceModel2 = ot.GeneralizedExponential([0.1], 1.0) .. GENERATED FROM PYTHON SOURCE LINES 50-51 We define the :math:`p = 2` generalized exponential model : .. GENERATED FROM PYTHON SOURCE LINES 51-53 .. code-block:: default covarianceModel3 = ot.GeneralizedExponential([0.1], 2.0) .. GENERATED FROM PYTHON SOURCE LINES 54-55 We draw the covariance models : .. GENERATED FROM PYTHON SOURCE LINES 55-64 .. code-block:: default graphModel = covarianceModel.draw() graphModel.add(covarianceModel2.draw()) graphModel.add(covarianceModel3.draw()) graphModel.setColors(["green", "orange", "blue"]) graphModel.setXTitle(r"$\tau = \|s-t\|$") graphModel.setYTitle(r"$C(\tau)$") graphModel.setLegends([r"$p = 0.25$", r"$p = 1$", r"$p = 2$"]) .. GENERATED FROM PYTHON SOURCE LINES 65-68 For each covariance model we build a gaussian process and generate a random trajectory of on :math:`[-1,1]`. We first build a discretization of this interval with a regular grid with step 0.01. .. GENERATED FROM PYTHON SOURCE LINES 68-74 .. code-block:: default xmin = -1.0 step = 0.01 n = 200 grid1D = ot.RegularGrid(xmin, step, n + 1) nbTrajectories = 1 .. GENERATED FROM PYTHON SOURCE LINES 75-76 We define the first gaussian process and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 76-79 .. code-block:: default process = ot.GaussianProcess(covarianceModel, grid1D) sample = process.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 80-81 then the second one and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 81-84 .. code-block:: default process2 = ot.GaussianProcess(covarianceModel2, grid1D) sample2 = process2.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 85-86 and finally the third one and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 86-89 .. code-block:: default process3 = ot.GaussianProcess(covarianceModel3, grid1D) sample3 = process3.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 90-91 We draw the trajectories : .. GENERATED FROM PYTHON SOURCE LINES 91-100 .. code-block:: default graphTraj = sample.drawMarginal(0) graphTraj.add(sample2.drawMarginal(0)) graphTraj.add(sample3.drawMarginal(0)) graphTraj.setXTitle(r"$x$") graphTraj.setYTitle(r"$GP_{\nu}(x)$") graphTraj.setTitle("Random realization from the covariance model") graphTraj.setColors(["green", "orange", "blue"]) graphTraj.setLegends([r"$p = 0.25$", r"$p = 1$", r"$p = 2$"]) .. GENERATED FROM PYTHON SOURCE LINES 101-102 We present each covariance model and the corresponding tracjectory side by side. .. GENERATED FROM PYTHON SOURCE LINES 102-109 .. code-block:: default fig = pl.figure(figsize=(12, 4)) ax_pdf = fig.add_subplot(1, 2, 1) _ = otv.View(graphModel, figure=fig, axes=[ax_pdf]) ax_cdf = fig.add_subplot(1, 2, 2) _ = otv.View(graphTraj, figure=fig, axes=[ax_cdf]) _ = fig.suptitle(r"Generalized Exponential Model : influence of the p parameter") .. image-sg:: /auto_meta_modeling/kriging_metamodel/images/sphx_glr_plot_draw_covariance_models_001.png :alt: Generalized Exponential Model : influence of the p parameter :srcset: /auto_meta_modeling/kriging_metamodel/images/sphx_glr_plot_draw_covariance_models_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 110-112 The blue trajectory corresponding to the parameter :math:`p=2` is smooth as expected as compared with the :math:`p=0.25` process which is less regular. .. GENERATED FROM PYTHON SOURCE LINES 115-121 The exponential model (:math:`p=1`) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ In the case of the exponential model (:math:`p=1`) we show the influence of the correlation length on the trajectories. .. GENERATED FROM PYTHON SOURCE LINES 123-124 with correlation length :math:`\theta = 0.01` : .. GENERATED FROM PYTHON SOURCE LINES 124-126 .. code-block:: default covarianceModel = ot.GeneralizedExponential([0.01], 1.0) .. GENERATED FROM PYTHON SOURCE LINES 127-128 with correlation length :math:`\theta = 0.1` : .. GENERATED FROM PYTHON SOURCE LINES 128-130 .. code-block:: default covarianceModel2 = ot.GeneralizedExponential([0.1], 1.0) .. GENERATED FROM PYTHON SOURCE LINES 131-132 with correlation length :math:`\theta = 1.0` .. GENERATED FROM PYTHON SOURCE LINES 132-134 .. code-block:: default covarianceModel3 = ot.GeneralizedExponential([1.0], 1.0) .. GENERATED FROM PYTHON SOURCE LINES 135-136 We draw the covariance models : .. GENERATED FROM PYTHON SOURCE LINES 136-145 .. code-block:: default graphModel = covarianceModel.draw() graphModel.add(covarianceModel2.draw()) graphModel.add(covarianceModel3.draw()) graphModel.setColors(["green", "orange", "blue"]) graphModel.setXTitle(r"$\tau = \|s-t\|$") graphModel.setYTitle(r"$C(\tau)$") graphModel.setLegends([r"$\theta = 0.01$", r"$\theta = 0.1$", r"$\theta = 1$"]) .. GENERATED FROM PYTHON SOURCE LINES 146-149 For each covariance model we build a gaussian process and generate a random trajectory of on :math:`[-1,1]`. We first build a discretization of this interval with a regular grid with step 0.01. .. GENERATED FROM PYTHON SOURCE LINES 149-155 .. code-block:: default xmin = -1.0 step = 0.01 n = 200 grid1D = ot.RegularGrid(xmin, step, n + 1) nbTrajectories = 1 .. GENERATED FROM PYTHON SOURCE LINES 156-157 We define the first gaussian process and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 157-160 .. code-block:: default process = ot.GaussianProcess(covarianceModel, grid1D) sample = process.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 161-162 then the second one and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 162-165 .. code-block:: default process2 = ot.GaussianProcess(covarianceModel2, grid1D) sample2 = process2.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 166-167 and finally the third one and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 167-170 .. code-block:: default process3 = ot.GaussianProcess(covarianceModel3, grid1D) sample3 = process3.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 171-172 We draw the trajectories : .. GENERATED FROM PYTHON SOURCE LINES 172-181 .. code-block:: default graphTraj = sample.drawMarginal(0) graphTraj.add(sample2.drawMarginal(0)) graphTraj.add(sample3.drawMarginal(0)) graphTraj.setXTitle(r"$x$") graphTraj.setYTitle(r"$GP_{\theta}(x)$") graphTraj.setTitle("Random realization from the covariance model") graphTraj.setColors(["green", "orange", "blue"]) graphTraj.setLegends([r"$\theta = 0.01$", r"$\theta = 0.1$", r"$\theta = 1$"]) .. GENERATED FROM PYTHON SOURCE LINES 182-183 We present each covariance model and the corresponding tracjectory side by side. .. GENERATED FROM PYTHON SOURCE LINES 183-190 .. code-block:: default fig = pl.figure(figsize=(12, 4)) ax_pdf = fig.add_subplot(1, 2, 1) _ = otv.View(graphModel, figure=fig, axes=[ax_pdf]) ax_cdf = fig.add_subplot(1, 2, 2) _ = otv.View(graphTraj, figure=fig, axes=[ax_cdf]) _ = fig.suptitle(r"Exponential Model : influence of correlation length $\theta$") .. image-sg:: /auto_meta_modeling/kriging_metamodel/images/sphx_glr_plot_draw_covariance_models_002.png :alt: Exponential Model : influence of correlation length $\theta$ :srcset: /auto_meta_modeling/kriging_metamodel/images/sphx_glr_plot_draw_covariance_models_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 191-192 We observe a smoother trajectory with a high correlation value. .. GENERATED FROM PYTHON SOURCE LINES 195-202 The squared exponential (:math:`p=2`) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ In the case of the squared exponential model (:math:`p=2`) we show the influence of the correlation length on the trajectories. .. GENERATED FROM PYTHON SOURCE LINES 204-205 with correlation length :math:`\theta = 0.01` : .. GENERATED FROM PYTHON SOURCE LINES 205-207 .. code-block:: default covarianceModel = ot.GeneralizedExponential([0.01], 2.0) .. GENERATED FROM PYTHON SOURCE LINES 208-209 with correlation length :math:`\theta = 0.1` : .. GENERATED FROM PYTHON SOURCE LINES 209-211 .. code-block:: default covarianceModel2 = ot.GeneralizedExponential([0.1], 2.0) .. GENERATED FROM PYTHON SOURCE LINES 212-213 with correlation length :math:`\theta = 1.0` .. GENERATED FROM PYTHON SOURCE LINES 213-215 .. code-block:: default covarianceModel3 = ot.GeneralizedExponential([1.0], 2.0) .. GENERATED FROM PYTHON SOURCE LINES 216-217 We draw the covariance models : .. GENERATED FROM PYTHON SOURCE LINES 217-226 .. code-block:: default graphModel = covarianceModel.draw() graphModel.add(covarianceModel2.draw()) graphModel.add(covarianceModel3.draw()) graphModel.setColors(["green", "orange", "blue"]) graphModel.setXTitle(r"$\tau = \|s-t\|$") graphModel.setYTitle(r"$C(\tau)$") graphModel.setLegends([r"$\theta = 0.01$", r"$\theta = 0.1$", r"$\theta = 1$"]) .. GENERATED FROM PYTHON SOURCE LINES 227-230 For each covariance model we build a gaussian process and generate a random trajectory of on :math:`[-1,1]`. We first build a discretization of this interval with a regular grid with step 0.01. .. GENERATED FROM PYTHON SOURCE LINES 230-236 .. code-block:: default xmin = -1.0 step = 0.01 n = 200 grid1D = ot.RegularGrid(xmin, step, n + 1) nbTrajectories = 1 .. GENERATED FROM PYTHON SOURCE LINES 237-238 We define the first gaussian process and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 238-241 .. code-block:: default process = ot.GaussianProcess(covarianceModel, grid1D) sample = process.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 242-243 then the second one and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 243-246 .. code-block:: default process2 = ot.GaussianProcess(covarianceModel2, grid1D) sample2 = process2.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 247-248 and finally the third one and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 248-251 .. code-block:: default process3 = ot.GaussianProcess(covarianceModel3, grid1D) sample3 = process3.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 252-253 We draw the trajectories : .. GENERATED FROM PYTHON SOURCE LINES 253-262 .. code-block:: default graphTraj = sample.drawMarginal(0) graphTraj.add(sample2.drawMarginal(0)) graphTraj.add(sample3.drawMarginal(0)) graphTraj.setXTitle(r"$x$") graphTraj.setYTitle(r"$GP_{\theta}(x)$") graphTraj.setTitle("Random realization from the covariance model") graphTraj.setColors(["green", "orange", "blue"]) graphTraj.setLegends([r"$\theta = 0.01$", r"$\theta = 0.1$", r"$\theta = 1$"]) .. GENERATED FROM PYTHON SOURCE LINES 263-264 We present each covariance model and the corresponding tracjectory side by side. .. GENERATED FROM PYTHON SOURCE LINES 264-274 .. code-block:: default fig = pl.figure(figsize=(12, 4)) ax_pdf = fig.add_subplot(1, 2, 1) _ = otv.View(graphModel, figure=fig, axes=[ax_pdf]) ax_cdf = fig.add_subplot(1, 2, 2) _ = otv.View(graphTraj, figure=fig, axes=[ax_cdf]) _ = fig.suptitle( r"Squared exponential model : influence of correlation length $\theta$" ) .. image-sg:: /auto_meta_modeling/kriging_metamodel/images/sphx_glr_plot_draw_covariance_models_003.png :alt: Squared exponential model : influence of correlation length $\theta$ :srcset: /auto_meta_modeling/kriging_metamodel/images/sphx_glr_plot_draw_covariance_models_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 275-277 Execpt for very small values of the correlation length, trajectories are usually smooth. It is the main effect of teh squared exponential model which leads to smooth process. .. GENERATED FROM PYTHON SOURCE LINES 280-286 The Matern covariance model --------------------------- The :class:`~openturns.MaternModel` class implements the Matern model of parameter :math:`\nu`. This parameter controls the smoothness of the process : for any :math:`\nu = n + \frac{1}{2}` the process is :math:`n` times continuously differentiable. .. GENERATED FROM PYTHON SOURCE LINES 288-295 Influence of the regularity ^^^^^^^^^^^^^^^^^^^^^^^^^^^ In this paragraph we represent three models with different regularity and generate the corresponding random trajectories. We shall use :math:`\nu = 0.5`, :math:`\nu = 1.5` and :math:`\nu = 2.5` and observe the regularity. .. GENERATED FROM PYTHON SOURCE LINES 297-298 We define the :math:`\nu = 0.5` Matern model : .. GENERATED FROM PYTHON SOURCE LINES 298-300 .. code-block:: default covarianceModel = ot.MaternModel([1.0], 0.5) .. GENERATED FROM PYTHON SOURCE LINES 301-302 We define the :math:`\nu = 1.5` Matern model : .. GENERATED FROM PYTHON SOURCE LINES 302-304 .. code-block:: default covarianceModel2 = ot.MaternModel([1.0], 1.5) .. GENERATED FROM PYTHON SOURCE LINES 305-306 We define the :math:`\nu = 2.5` Matern model : .. GENERATED FROM PYTHON SOURCE LINES 306-308 .. code-block:: default covarianceModel3 = ot.MaternModel([1.0], 2.5) .. GENERATED FROM PYTHON SOURCE LINES 309-310 We draw the covariance models : .. GENERATED FROM PYTHON SOURCE LINES 310-319 .. code-block:: default graphModel = covarianceModel.draw() graphModel.add(covarianceModel2.draw()) graphModel.add(covarianceModel3.draw()) graphModel.setColors(["green", "orange", "blue"]) graphModel.setXTitle(r"$\tau = \|s-t\|$") graphModel.setYTitle(r"$C(\tau)$") graphModel.setLegends([r"$\nu = 1/2$", r"$\nu = 3/2$", r"$\nu = 5/2$"]) .. GENERATED FROM PYTHON SOURCE LINES 320-323 For each covariance model we build a gaussian process and generate a random trajectory of on :math:`[-1,1]`. We first build a discretization of this interval with a regular grid with step 0.001. .. GENERATED FROM PYTHON SOURCE LINES 323-329 .. code-block:: default xmin = -5.0 step = 0.01 n = 1000 grid1D = ot.RegularGrid(xmin, step, n + 1) nbTrajectories = 1 .. GENERATED FROM PYTHON SOURCE LINES 330-331 We define the first gaussian process and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 331-334 .. code-block:: default process = ot.GaussianProcess(covarianceModel, grid1D) sample = process.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 335-336 then the second one and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 336-339 .. code-block:: default process2 = ot.GaussianProcess(covarianceModel2, grid1D) sample2 = process2.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 340-341 and finally the third one and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 341-344 .. code-block:: default process3 = ot.GaussianProcess(covarianceModel3, grid1D) sample3 = process3.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 345-346 We draw the trajectories : .. GENERATED FROM PYTHON SOURCE LINES 346-355 .. code-block:: default graphTraj = sample.drawMarginal(0) graphTraj.add(sample2.drawMarginal(0)) graphTraj.add(sample3.drawMarginal(0)) graphTraj.setXTitle(r"$x$") graphTraj.setYTitle(r"$GP_{\nu}(x)$") graphTraj.setTitle("Random realization from the covariance model") graphTraj.setColors(["green", "orange", "blue"]) graphTraj.setLegends([r"$\nu = 1/2$", r"$\nu = 3/2$", r"$\nu = 5/2$"]) .. GENERATED FROM PYTHON SOURCE LINES 356-357 We present each covariance model and the corresponding tracjectory side by side. .. GENERATED FROM PYTHON SOURCE LINES 357-364 .. code-block:: default fig = pl.figure(figsize=(12, 4)) ax_pdf = fig.add_subplot(1, 2, 1) _ = otv.View(graphModel, figure=fig, axes=[ax_pdf]) ax_cdf = fig.add_subplot(1, 2, 2) _ = otv.View(graphTraj, figure=fig, axes=[ax_cdf]) _ = fig.suptitle(r"Matern model : influence of the regularity $\nu$ parameter") .. image-sg:: /auto_meta_modeling/kriging_metamodel/images/sphx_glr_plot_draw_covariance_models_004.png :alt: Matern model : influence of the regularity $\nu$ parameter :srcset: /auto_meta_modeling/kriging_metamodel/images/sphx_glr_plot_draw_covariance_models_004.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 365-367 The red trajectory is the least regular (:math:`nu = 0.5`) as it is only continuous. We see that the the blue trajectory is more smooth as expected. .. GENERATED FROM PYTHON SOURCE LINES 370-378 Variation of the correlation length ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ In this paragraph we fix the regularity by choosing :math:`\nu = 1.5` so we expect a continuously differentiable realization. We then use three different correlation lengths :math:`\theta = 0.01`, :math:`\theta = 0.1` and :math:`\theta = 1.0` and observe the impact on realizations of gaussian processes based on these covariance models. .. GENERATED FROM PYTHON SOURCE LINES 380-381 We define the Matern model with :math:`\theta = 0.01` : .. GENERATED FROM PYTHON SOURCE LINES 381-383 .. code-block:: default covarianceModel = ot.MaternModel([0.01], 1.5) .. GENERATED FROM PYTHON SOURCE LINES 384-385 We define the Matern model with :math:`\theta = 0.1` : .. GENERATED FROM PYTHON SOURCE LINES 385-387 .. code-block:: default covarianceModel2 = ot.MaternModel([0.1], 1.5) .. GENERATED FROM PYTHON SOURCE LINES 388-389 We define the Matern model with :math:`\theta = 1.0` : .. GENERATED FROM PYTHON SOURCE LINES 389-391 .. code-block:: default covarianceModel3 = ot.MaternModel([1.0], 1.5) .. GENERATED FROM PYTHON SOURCE LINES 392-393 We draw the covariance models : .. GENERATED FROM PYTHON SOURCE LINES 393-402 .. code-block:: default graphModel = covarianceModel.draw() graphModel.add(covarianceModel2.draw()) graphModel.add(covarianceModel3.draw()) graphModel.setColors(["green", "orange", "blue"]) graphModel.setXTitle(r"$\tau = \|s-t\|$") graphModel.setYTitle(r"$C(\tau)$") graphModel.setTitle("Matern covariance model with \nu = 3/2") graphModel.setLegends([r"$\theta = 0.01$", r"$\theta = 0.1$", r"$\theta = 1.0$"]) .. GENERATED FROM PYTHON SOURCE LINES 403-406 For each covariance model we build a gaussian process and generate a random trajectory of on :math:`[-1,1]`. We build a discretization of this interval with a regular grid with step 0.01. .. GENERATED FROM PYTHON SOURCE LINES 406-412 .. code-block:: default xmin = -1.0 step = 0.01 n = 200 grid1D = ot.RegularGrid(xmin, step, n + 1) nbTrajectories = 1 .. GENERATED FROM PYTHON SOURCE LINES 413-414 We define the first gaussian process and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 414-417 .. code-block:: default process = ot.GaussianProcess(covarianceModel, grid1D) sample = process.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 418-419 then the second process : .. GENERATED FROM PYTHON SOURCE LINES 419-422 .. code-block:: default process2 = ot.GaussianProcess(covarianceModel2, grid1D) sample2 = process2.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 423-424 and the third one : .. GENERATED FROM PYTHON SOURCE LINES 424-427 .. code-block:: default process3 = ot.GaussianProcess(covarianceModel3, grid1D) sample3 = process3.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 428-429 We draw the trajectories : .. GENERATED FROM PYTHON SOURCE LINES 429-437 .. code-block:: default graphTraj = sample.drawMarginal(0) graphTraj.add(sample2.drawMarginal(0)) graphTraj.add(sample3.drawMarginal(0)) graphTraj.setXTitle(r"$x$") graphTraj.setYTitle(r"$GP_{\theta}(x)$") graphTraj.setColors(["green", "orange", "blue"]) graphTraj.setLegends([r"$\theta = 0.01$", r"$\theta = 0.1$", r"$\theta = 1.0$"]) .. GENERATED FROM PYTHON SOURCE LINES 438-439 We present each covariance model and the corresponding tracjectory side by side. .. GENERATED FROM PYTHON SOURCE LINES 439-446 .. code-block:: default fig = pl.figure(figsize=(12, 4)) ax_pdf = fig.add_subplot(1, 2, 1) _ = otv.View(graphModel, figure=fig, axes=[ax_pdf]) ax_cdf = fig.add_subplot(1, 2, 2) _ = otv.View(graphTraj, figure=fig, axes=[ax_cdf]) _ = fig.suptitle("The Matern model : variation of the correlation length") .. image-sg:: /auto_meta_modeling/kriging_metamodel/images/sphx_glr_plot_draw_covariance_models_005.png :alt: The Matern model : variation of the correlation length :srcset: /auto_meta_modeling/kriging_metamodel/images/sphx_glr_plot_draw_covariance_models_005.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 447-449 From the previous figure we see that the trajectory of the gaussian process is smoother with large correlation length. .. GENERATED FROM PYTHON SOURCE LINES 451-452 Display figures .. GENERATED FROM PYTHON SOURCE LINES 452-453 .. code-block:: default plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 1.224 seconds) .. _sphx_glr_download_auto_meta_modeling_kriging_metamodel_plot_draw_covariance_models.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_draw_covariance_models.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_draw_covariance_models.ipynb `