.. 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 Click :ref:`here ` 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-110 .. 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 111-113 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 116-122 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 124-125 with correlation length :math:`\theta = 0.01` : .. GENERATED FROM PYTHON SOURCE LINES 125-127 .. code-block:: default covarianceModel = ot.GeneralizedExponential([0.01], 1.0) .. GENERATED FROM PYTHON SOURCE LINES 128-129 with correlation length :math:`\theta = 0.1` : .. GENERATED FROM PYTHON SOURCE LINES 129-131 .. code-block:: default covarianceModel2 = ot.GeneralizedExponential([0.1], 1.0) .. GENERATED FROM PYTHON SOURCE LINES 132-133 with correlation length :math:`\theta = 1.0` .. GENERATED FROM PYTHON SOURCE LINES 133-135 .. code-block:: default covarianceModel3 = ot.GeneralizedExponential([1.0], 1.0) .. GENERATED FROM PYTHON SOURCE LINES 136-137 We draw the covariance models : .. GENERATED FROM PYTHON SOURCE LINES 137-146 .. 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 147-150 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 150-156 .. 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 157-158 We define the first gaussian process and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 158-161 .. code-block:: default process = ot.GaussianProcess(covarianceModel, grid1D) sample = process.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 162-163 then the second one and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 163-166 .. code-block:: default process2 = ot.GaussianProcess(covarianceModel2, grid1D) sample2 = process2.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 167-168 and finally the third one and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 168-171 .. code-block:: default process3 = ot.GaussianProcess(covarianceModel3, grid1D) sample3 = process3.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 172-173 We draw the trajectories : .. GENERATED FROM PYTHON SOURCE LINES 173-182 .. 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 183-184 We present each covariance model and the corresponding tracjectory side by side. .. GENERATED FROM PYTHON SOURCE LINES 184-192 .. 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 193-194 We observe a smoother trajectory with a high correlation value. .. GENERATED FROM PYTHON SOURCE LINES 197-204 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 206-207 with correlation length :math:`\theta = 0.01` : .. GENERATED FROM PYTHON SOURCE LINES 207-209 .. code-block:: default covarianceModel = ot.GeneralizedExponential([0.01], 2.0) .. GENERATED FROM PYTHON SOURCE LINES 210-211 with correlation length :math:`\theta = 0.1` : .. GENERATED FROM PYTHON SOURCE LINES 211-213 .. code-block:: default covarianceModel2 = ot.GeneralizedExponential([0.1], 2.0) .. GENERATED FROM PYTHON SOURCE LINES 214-215 with correlation length :math:`\theta = 1.0` .. GENERATED FROM PYTHON SOURCE LINES 215-217 .. code-block:: default covarianceModel3 = ot.GeneralizedExponential([1.0], 2.0) .. GENERATED FROM PYTHON SOURCE LINES 218-219 We draw the covariance models : .. GENERATED FROM PYTHON SOURCE LINES 219-228 .. 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 229-232 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 232-238 .. 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 239-240 We define the first gaussian process and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 240-243 .. code-block:: default process = ot.GaussianProcess(covarianceModel, grid1D) sample = process.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 244-245 then the second one and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 245-248 .. code-block:: default process2 = ot.GaussianProcess(covarianceModel2, grid1D) sample2 = process2.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 249-250 and finally the third one and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 250-253 .. code-block:: default process3 = ot.GaussianProcess(covarianceModel3, grid1D) sample3 = process3.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 254-255 We draw the trajectories : .. GENERATED FROM PYTHON SOURCE LINES 255-264 .. 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 265-266 We present each covariance model and the corresponding tracjectory side by side. .. GENERATED FROM PYTHON SOURCE LINES 266-275 .. 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 276-278 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 281-287 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 289-296 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 298-299 We define the :math:`\nu = 0.5` Matern model : .. GENERATED FROM PYTHON SOURCE LINES 299-301 .. code-block:: default covarianceModel = ot.MaternModel([1.0], 0.5) .. GENERATED FROM PYTHON SOURCE LINES 302-303 We define the :math:`\nu = 1.5` Matern model : .. GENERATED FROM PYTHON SOURCE LINES 303-305 .. code-block:: default covarianceModel2 = ot.MaternModel([1.0], 1.5) .. GENERATED FROM PYTHON SOURCE LINES 306-307 We define the :math:`\nu = 2.5` Matern model : .. GENERATED FROM PYTHON SOURCE LINES 307-309 .. code-block:: default covarianceModel3 = ot.MaternModel([1.0], 2.5) .. GENERATED FROM PYTHON SOURCE LINES 310-311 We draw the covariance models : .. GENERATED FROM PYTHON SOURCE LINES 311-320 .. 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 321-324 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 324-330 .. 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 331-332 We define the first gaussian process and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 332-335 .. code-block:: default process = ot.GaussianProcess(covarianceModel, grid1D) sample = process.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 336-337 then the second one and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 337-340 .. code-block:: default process2 = ot.GaussianProcess(covarianceModel2, grid1D) sample2 = process2.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 341-342 and finally the third one and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 342-345 .. code-block:: default process3 = ot.GaussianProcess(covarianceModel3, grid1D) sample3 = process3.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 346-347 We draw the trajectories : .. GENERATED FROM PYTHON SOURCE LINES 347-356 .. 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 357-358 We present each covariance model and the corresponding tracjectory side by side. .. GENERATED FROM PYTHON SOURCE LINES 358-365 .. 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 366-368 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 371-379 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 381-382 We define the Matern model with :math:`\theta = 0.01` : .. GENERATED FROM PYTHON SOURCE LINES 382-384 .. code-block:: default covarianceModel = ot.MaternModel([0.01], 1.5) .. GENERATED FROM PYTHON SOURCE LINES 385-386 We define the Matern model with :math:`\theta = 0.1` : .. GENERATED FROM PYTHON SOURCE LINES 386-388 .. code-block:: default covarianceModel2 = ot.MaternModel([0.1], 1.5) .. GENERATED FROM PYTHON SOURCE LINES 389-390 We define the Matern model with :math:`\theta = 1.0` : .. GENERATED FROM PYTHON SOURCE LINES 390-392 .. code-block:: default covarianceModel3 = ot.MaternModel([1.0], 1.5) .. GENERATED FROM PYTHON SOURCE LINES 393-394 We draw the covariance models : .. GENERATED FROM PYTHON SOURCE LINES 394-404 .. 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 405-408 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 408-414 .. 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 415-416 We define the first gaussian process and its trajectory : .. GENERATED FROM PYTHON SOURCE LINES 416-419 .. code-block:: default process = ot.GaussianProcess(covarianceModel, grid1D) sample = process.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 420-421 then the second process : .. GENERATED FROM PYTHON SOURCE LINES 421-424 .. code-block:: default process2 = ot.GaussianProcess(covarianceModel2, grid1D) sample2 = process2.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 425-426 and the third one : .. GENERATED FROM PYTHON SOURCE LINES 426-429 .. code-block:: default process3 = ot.GaussianProcess(covarianceModel3, grid1D) sample3 = process3.getSample(nbTrajectories) .. GENERATED FROM PYTHON SOURCE LINES 430-431 We draw the trajectories : .. GENERATED FROM PYTHON SOURCE LINES 431-440 .. 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 441-442 We present each covariance model and the corresponding tracjectory side by side. .. GENERATED FROM PYTHON SOURCE LINES 442-449 .. 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 450-452 From the previous figure we see that the trajectory of the gaussian process is smoother with large correlation length. .. GENERATED FROM PYTHON SOURCE LINES 454-455 Display figures .. GENERATED FROM PYTHON SOURCE LINES 455-456 .. code-block:: default plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 2.067 seconds) .. _sphx_glr_download_auto_meta_modeling_kriging_metamodel_plot_draw_covariance_models.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_draw_covariance_models.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_draw_covariance_models.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_