.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_reliability_sensitivity/sensitivity_analysis/plot_sensitivity_wingweight.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_reliability_sensitivity_sensitivity_analysis_plot_sensitivity_wingweight.py: Example of sensitivity analyses on the wing weight model ========================================================= .. GENERATED FROM PYTHON SOURCE LINES 7-21 This example is a brief overview of the use of the most usual sensitivity analysis techniques and how to call them: - PCC: Partial Correlation Coefficients - PRCC: Partial Rank Correlation Coefficients - SRC: Standard Regression Coefficients - SRRC: Standard Rank Regression Coefficients - Pearson coefficients - Spearman coefficients - Taylor expansion importance factors - Sobol' indices - Rank-based estimation of Sobol' indices - HSIC : Hilbert-Schmidt Independence Criterion We present the methods on the :ref:`WingWeight function` and use the same notations. .. GENERATED FROM PYTHON SOURCE LINES 24-30 Definition of the model ----------------------- We load the model from the usecases module. .. GENERATED FROM PYTHON SOURCE LINES 30-37 .. code-block:: Python import openturns as ot import openturns.experimental as otexp import openturns.viewer as otv from openturns.usecases.wingweight_function import WingWeightModel m = WingWeightModel() .. GENERATED FROM PYTHON SOURCE LINES 38-45 Cross cuts of the function -------------------------- Let's have a look on 2D cross cuts of the wing weight function. For each 2D cross cut, the other variables are fixed to the input distribution mean values. This graph allows one to have a first idea of the variations of the function in pair of dimensions. The colors of each contour plot are comparable. .. GENERATED FROM PYTHON SOURCE LINES 45-86 .. code-block:: Python lowerBound = m.inputDistribution.getRange().getLowerBound() upperBound = m.inputDistribution.getRange().getUpperBound() nX = ot.ResourceMap.GetAsUnsignedInteger("Evaluation-DefaultPointNumber") description = m.inputDistribution.getDescription() description.add("") m.model.setDescription(description) m.model.setName("wing weight model") grid = m.model.drawCrossCuts( m.inputDistribution.getMean(), lowerBound, upperBound, [nX] * m.model.getInputDimension(), False, True, 176.0, 363.0, ) grid.setTitle("") # Get View object to manipulate the underlying figure # Here we decide the colormap and the number of levels used for all contours view = otv.View(grid, contour_kw={"cmap": "hsv", "levels": 55}) axes = view.getAxes() fig = view.getFigure() fig.set_size_inches(12, 12) # reduce the size # Setup a large colorbar fig.colorbar( view.getSubviews()[1][0].getContourSets()[0], ax=axes[:-2, -1], fraction=0.3 ) # Hide unwanted axes labels for i in range(len(axes)): for j in range(i + 1): if i < len(axes) - 1: axes[i][j].xaxis.set_ticklabels([]) if j > 0: axes[i][j].yaxis.set_ticklabels([]) fig.subplots_adjust(top=0.99, bottom=0.05, left=0.06, right=0.99) .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_001.svg :alt: plot sensitivity wingweight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_001.svg :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 87-88 We can see that the variables :math:`t_c, N_z, A, W_{dg}` seem to be influent on the wing weight whereas :math:`\Lambda, \ell, q, W_p, W_{fw}` have less influence on the function. .. GENERATED FROM PYTHON SOURCE LINES 90-94 Data generation --------------- We create the input and output data for the estimation of the different sensitivity coefficients and we get the input variables description: .. GENERATED FROM PYTHON SOURCE LINES 94-101 .. code-block:: Python inputNames = m.inputDistribution.getDescription() size = 500 inputDesign = m.inputDistribution.getSample(size) outputDesign = m.model(inputDesign) .. GENERATED FROM PYTHON SOURCE LINES 102-104 Let's estimate the PCC, PRCC, SRC, SRRC, Pearson and Spearman coefficients, display and analyze them. We create a :class:`~openturns.CorrelationAnalysis` model. .. GENERATED FROM PYTHON SOURCE LINES 104-107 .. code-block:: Python corr_analysis = ot.CorrelationAnalysis(inputDesign, outputDesign) .. GENERATED FROM PYTHON SOURCE LINES 108-111 PCC coefficients ---------------- We compute here PCC coefficients using the :class:`~openturns.CorrelationAnalysis`. .. GENERATED FROM PYTHON SOURCE LINES 113-116 .. code-block:: Python pcc_indices = corr_analysis.computePCC() print(pcc_indices) .. rst-class:: sphx-glr-script-out .. code-block:: none [0.935621,0.0162693,0.960722,0.0190557,0.104993,0.316626,-0.937934,0.977742,0.901198,0.393856]#10 .. GENERATED FROM PYTHON SOURCE LINES 120-125 .. code-block:: Python graph = ot.SobolIndicesAlgorithm.DrawCorrelationCoefficients( pcc_indices, inputNames, "PCC coefficients - Wing weight" ) view = otv.View(graph) .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_002.svg :alt: PCC coefficients - Wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_002.svg :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 126-129 PRCC coefficients ----------------- We compute here PRCC coefficients using the :class:`~openturns.CorrelationAnalysis`. .. GENERATED FROM PYTHON SOURCE LINES 131-134 .. code-block:: Python prcc_indices = corr_analysis.computePRCC() print(prcc_indices) .. rst-class:: sphx-glr-script-out .. code-block:: none [0.835669,0.0179569,0.891497,-0.0245634,0.0465254,0.149125,-0.836508,0.939886,0.756455,0.240063]#10 .. GENERATED FROM PYTHON SOURCE LINES 135-140 .. code-block:: Python graph = ot.SobolIndicesAlgorithm.DrawCorrelationCoefficients( prcc_indices, inputNames, "PRCC coefficients - Wing weight" ) view = otv.View(graph) .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_003.svg :alt: PRCC coefficients - Wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_003.svg :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 141-144 SRC coefficients ------------------- We compute here SRC coefficients using the :class:`~openturns.CorrelationAnalysis`. .. GENERATED FROM PYTHON SOURCE LINES 146-149 .. code-block:: Python src_indices = corr_analysis.computeSRC() print(src_indices) .. rst-class:: sphx-glr-script-out .. code-block:: none [0.356019,0.00219694,0.465469,0.00257789,0.0141461,0.0452397,-0.364839,0.630624,0.278983,0.0574538]#10 .. GENERATED FROM PYTHON SOURCE LINES 150-155 .. code-block:: Python graph = ot.SobolIndicesAlgorithm.DrawCorrelationCoefficients( src_indices, inputNames, "SRC coefficients - Wing weight" ) view = otv.View(graph) .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_004.svg :alt: SRC coefficients - Wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_004.svg :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 156-157 Normalized squared SRC coefficients (coefficients are made to sum to 1) : .. GENERATED FROM PYTHON SOURCE LINES 159-162 .. code-block:: Python squared_src_indices = corr_analysis.computeSquaredSRC(True) print(squared_src_indices) .. rst-class:: sphx-glr-script-out .. code-block:: none [0.132363,5.04029e-06,0.226255,6.9398e-06,0.000208972,0.00213726,0.139002,0.415297,0.0812779,0.00344711]#10 .. GENERATED FROM PYTHON SOURCE LINES 163-164 And their associated graph: .. GENERATED FROM PYTHON SOURCE LINES 166-171 .. code-block:: Python graph = ot.SobolIndicesAlgorithm.DrawCorrelationCoefficients( squared_src_indices, inputNames, "Squared SRC coefficients - Wing weight" ) view = otv.View(graph) .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_005.svg :alt: Squared SRC coefficients - Wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_005.svg :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 175-178 SRRC coefficients -------------------- We compute here SRRC coefficients using the :class:`~openturns.CorrelationAnalysis`. .. GENERATED FROM PYTHON SOURCE LINES 180-183 .. code-block:: Python srrc_indices = corr_analysis.computeSRRC() print(srrc_indices) .. rst-class:: sphx-glr-script-out .. code-block:: none [0.348313,0.0041313,0.450607,-0.00566494,0.0106347,0.0348243,-0.350926,0.634484,0.264415,0.0564672]#10 .. GENERATED FROM PYTHON SOURCE LINES 184-189 .. code-block:: Python graph = ot.SobolIndicesAlgorithm.DrawCorrelationCoefficients( srrc_indices, inputNames, "SRRC coefficients - Wing weight" ) view = otv.View(graph) .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_006.svg :alt: SRRC coefficients - Wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_006.svg :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 190-193 Pearson coefficients ----------------------- We compute here the Pearson :math:`\rho` coefficients using the :class:`~openturns.CorrelationAnalysis`. .. GENERATED FROM PYTHON SOURCE LINES 195-198 .. code-block:: Python pearson_correlation = corr_analysis.computeLinearCorrelation() print(pearson_correlation) .. rst-class:: sphx-glr-script-out .. code-block:: none [0.406027,-0.0618226,0.434929,-0.0140118,0.019329,0.162599,-0.417202,0.618386,0.279206,0.133176]#10 .. GENERATED FROM PYTHON SOURCE LINES 199-205 .. code-block:: Python title_pearson_graph = "Pearson correlation coefficients - Wing weight" graph = ot.SobolIndicesAlgorithm.DrawCorrelationCoefficients( pearson_correlation, inputNames, title_pearson_graph ) view = otv.View(graph) .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_007.svg :alt: Pearson correlation coefficients - Wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_007.svg :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 206-209 Spearman coefficients ----------------------- We compute here the Spearman :math:`\rho_s` coefficients using the :class:`~openturns.CorrelationAnalysis`. .. GENERATED FROM PYTHON SOURCE LINES 211-214 .. code-block:: Python spearman_correlation = corr_analysis.computeSpearmanCorrelation() print(spearman_correlation) .. rst-class:: sphx-glr-script-out .. code-block:: none [0.399219,-0.0583024,0.422034,-0.0218708,0.0167429,0.150902,-0.405743,0.621177,0.265084,0.126477]#10 .. GENERATED FROM PYTHON SOURCE LINES 215-221 .. code-block:: Python title_spearman_graph = "Spearman correlation coefficients - Wing weight" graph = ot.SobolIndicesAlgorithm.DrawCorrelationCoefficients( spearman_correlation, inputNames, title_spearman_graph ) view = otv.View(graph) .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_008.svg :alt: Spearman correlation coefficients - Wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_008.svg :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 222-225 The different computed correlation estimators show that the variables :math:`S_w, A, N_z, t_c` seem to be the most correlated with the wing weight in absolute value. Pearson and Spearman coefficients do not reveal any linear nor monotonic correlation as no coefficients are equal to +/- 1. Coefficients about :math:`t_c` are negative revealing a negative correlation with the wing weight, that is consistent with the model expression. .. GENERATED FROM PYTHON SOURCE LINES 229-232 Taylor expansion importance factors ----------------------------------- We compute here the Taylor expansion importance factors using :class:`~openturns.TaylorExpansionMoments`. .. GENERATED FROM PYTHON SOURCE LINES 236-237 We create a distribution-based RandomVector. .. GENERATED FROM PYTHON SOURCE LINES 237-239 .. code-block:: Python X = ot.RandomVector(m.inputDistribution) .. GENERATED FROM PYTHON SOURCE LINES 240-241 We create a composite RandomVector Y from X and m.model. .. GENERATED FROM PYTHON SOURCE LINES 241-243 .. code-block:: Python Y = ot.CompositeRandomVector(m.model, X) .. GENERATED FROM PYTHON SOURCE LINES 244-245 We create a Taylor expansion method to approximate moments. .. GENERATED FROM PYTHON SOURCE LINES 245-247 .. code-block:: Python taylor = ot.TaylorExpansionMoments(Y) .. GENERATED FROM PYTHON SOURCE LINES 248-249 We get the importance factors. .. GENERATED FROM PYTHON SOURCE LINES 249-251 .. code-block:: Python print(taylor.getImportanceFactors()) .. rst-class:: sphx-glr-script-out .. code-block:: none [Sw : 0.130315, Wfw : 2.94004e-06, A : 0.228153, Lambda : 0, q : 8.25053e-05, l : 0.00180269, tc : 0.135002, Nz : 0.412794, Wdg : 0.0883317, Wp : 0.00351621] .. GENERATED FROM PYTHON SOURCE LINES 252-253 We draw the importance factors .. GENERATED FROM PYTHON SOURCE LINES 253-257 .. code-block:: Python graph = taylor.drawImportanceFactors() graph.setTitle("Taylor expansion imporfance factors - Wing weight") view = otv.View(graph) .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_009.svg :alt: Taylor expansion imporfance factors - Wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_009.svg :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 258-260 The Taylor expansion importance factors is consistent with the previous estimators as :math:`S_w, A, N_z, t_c` seem to be the most influent variables. To analyze the relevance of the previous indices, a Sobol' analysis is now carried out. .. GENERATED FROM PYTHON SOURCE LINES 263-266 Sobol' indices -------------- We compute the Sobol' indices from both sampling approach and Polynomial Chaos Expansion. .. GENERATED FROM PYTHON SOURCE LINES 268-275 .. code-block:: Python sizeSobol = 1000 sie = ot.SobolIndicesExperiment(m.inputDistribution, sizeSobol) inputDesignSobol = sie.generate() inputNames = m.inputDistribution.getDescription() inputDesignSobol.setDescription(inputNames) inputDesignSobol.getSize() .. rst-class:: sphx-glr-script-out .. code-block:: none 12000 .. GENERATED FROM PYTHON SOURCE LINES 276-277 We see that 12000 function evaluations are required to estimate the first order and total Sobol' indices. .. GENERATED FROM PYTHON SOURCE LINES 279-280 Then, we evaluate the outputs corresponding to this design of experiments. .. GENERATED FROM PYTHON SOURCE LINES 282-284 .. code-block:: Python outputDesignSobol = m.model(inputDesignSobol) .. GENERATED FROM PYTHON SOURCE LINES 285-286 We estimate the Sobol' indices with the :class:`~openturns.SaltelliSensitivityAlgorithm`. .. GENERATED FROM PYTHON SOURCE LINES 288-292 .. code-block:: Python sensitivityAnalysis = ot.SaltelliSensitivityAlgorithm( inputDesignSobol, outputDesignSobol, sizeSobol ) .. GENERATED FROM PYTHON SOURCE LINES 293-294 The `getFirstOrderIndices` and `getTotalOrderIndices` methods respectively return estimates of all first order and total Sobol' indices. .. GENERATED FROM PYTHON SOURCE LINES 296-298 .. code-block:: Python print("First order indices:", sensitivityAnalysis.getFirstOrderIndices()) .. rst-class:: sphx-glr-script-out .. code-block:: none First order indices: [0.156759,0.0290035,0.214508,0.0286627,0.0284787,0.0317074,0.183241,0.435572,0.105108,0.0332948]#10 .. GENERATED FROM PYTHON SOURCE LINES 299-302 .. code-block:: Python print("Total order indices:", sensitivityAnalysis.getTotalOrderIndices()) .. rst-class:: sphx-glr-script-out .. code-block:: none Total order indices: [0.101709,-2.77254e-05,0.209056,0.00230855,0.00088888,-0.000335256,0.155822,0.41227,0.100738,0.000190837]#10 .. GENERATED FROM PYTHON SOURCE LINES 303-304 The `draw` method produces the following graph. The vertical bars represent the 95% confidence intervals of the estimates. .. GENERATED FROM PYTHON SOURCE LINES 306-310 .. code-block:: Python graph = sensitivityAnalysis.draw() graph.setTitle("Sobol indices with Saltelli - wing weight") view = otv.View(graph) .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_010.svg :alt: Sobol indices with Saltelli - wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_010.svg :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 311-312 We see that several Sobol' indices are negative, that is inconsistent with the theory. Therefore, a larger number of samples is required to get consistent indices .. GENERATED FROM PYTHON SOURCE LINES 312-331 .. code-block:: Python sizeSobol = 10000 sie = ot.SobolIndicesExperiment(m.inputDistribution, sizeSobol) inputDesignSobol = sie.generate() inputNames = m.inputDistribution.getDescription() inputDesignSobol.setDescription(inputNames) inputDesignSobol.getSize() outputDesignSobol = m.model(inputDesignSobol) sensitivityAnalysis = ot.SaltelliSensitivityAlgorithm( inputDesignSobol, outputDesignSobol, sizeSobol ) sensitivityAnalysis.getFirstOrderIndices() sensitivityAnalysis.getTotalOrderIndices() graph = sensitivityAnalysis.draw() graph.setTitle("Sobol indices with Saltelli - wing weight") view = otv.View(graph) .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_011.svg :alt: Sobol indices with Saltelli - wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_011.svg :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 332-333 It improves the accuracy of the estimation but, for very low indices, Saltelli scheme is not accurate since several confidence intervals provide negative lower bounds. .. GENERATED FROM PYTHON SOURCE LINES 335-337 Now, we estimate the Sobol' indices using Polynomial Chaos Expansion. We create a Functional Chaos Expansion. .. GENERATED FROM PYTHON SOURCE LINES 337-346 .. code-block:: Python sizePCE = 800 inputDesignPCE = m.inputDistribution.getSample(sizePCE) outputDesignPCE = m.model(inputDesignPCE) algo = ot.FunctionalChaosAlgorithm(inputDesignPCE, outputDesignPCE, m.inputDistribution) algo.run() result = algo.getResult() .. GENERATED FROM PYTHON SOURCE LINES 347-348 Then, we exploit the surrogate model to compute the Sobol' indices. .. GENERATED FROM PYTHON SOURCE LINES 348-351 .. code-block:: Python sensitivityAnalysis = ot.FunctionalChaosSobolIndices(result) sensitivityAnalysis .. raw:: html
FunctionalChaosSobolIndices
  • input dimension: 10
  • output dimension: 1
  • basis size: 761
  • mean: [268.076]
  • std-dev: [48.0926]
Input Variable Sobol' index Total index
0 Sw 0.124610 0.128020
1 Wfw 0.000002 0.000006
2 A 0.220301 0.226096
3 Lambda 0.000496 0.000515
4 q 0.000082 0.000089
5 l 0.001810 0.001873
6 tc 0.140783 0.144862
7 Nz 0.411639 0.419673
8 Wdg 0.084892 0.087560
9 Wp 0.003368 0.003393
Index Multi-index Part of variance
8 [0,0,0,0,0,0,0,1,0,0]#10 0.410306
3 [0,0,1,0,0,0,0,0,0,0]#10 0.220156
7 [0,0,0,0,0,0,1,0,0,0]#10 0.138197
1 [1,0,0,0,0,0,0,0,0,0]#10 0.124601
9 [0,0,0,0,0,0,0,0,1,0]#10 0.084838


.. GENERATED FROM PYTHON SOURCE LINES 352-359 .. code-block:: Python firstOrder = [sensitivityAnalysis.getSobolIndex(i) for i in range(m.dim)] totalOrder = [sensitivityAnalysis.getSobolTotalIndex(i) for i in range(m.dim)] graph = ot.SobolIndicesAlgorithm.DrawSobolIndices(inputNames, firstOrder, totalOrder) graph.setTitle("Sobol indices by Polynomial Chaos Expansion - wing weight") view = otv.View(graph) .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_012.svg :alt: Sobol indices by Polynomial Chaos Expansion - wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_012.svg :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 360-362 Furthermore, first order Sobol' indices can also been estimated in a data-driven way using a rank-based sensitivity algorithm. In such a way, the estimation of sensitivity indices does not involve any surrogate model. .. GENERATED FROM PYTHON SOURCE LINES 362-374 .. code-block:: Python sizeRankSobol = 800 inputDesignRankSobol = m.inputDistribution.getSample(sizeRankSobol) outputDesignankSobol = m.model(inputDesignRankSobol) myRankSobol = otexp.RankSobolSensitivityAlgorithm( inputDesignRankSobol, outputDesignankSobol ) indicesrankSobol = myRankSobol.getFirstOrderIndices() print("First order indices:", indicesrankSobol) graph = myRankSobol.draw() graph.setTitle("Sobol indices by rank-based estimation - wing weight") view = otv.View(graph) .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_013.svg :alt: Sobol indices by rank-based estimation - wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_013.svg :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none First order indices: [0.110075,-0.0332963,0.273983,0.0474846,-0.0277481,-0.0349598,0.13214,0.400101,0.126718,-0.0497129]#10 .. GENERATED FROM PYTHON SOURCE LINES 375-381 The Sobol' indices confirm the previous analyses, in terms of ranking of the most influent variables. We also see that five variables have a quasi null total Sobol' indices, that indicates almost no influence on the wing weight. There is no discrepancy between first order and total Sobol' indices, that indicates no or very low interaction between the variables in the variance of the output. As the most important variables act only through decoupled first degree contributions, the hypothesis of a linear dependence between the input variables and the weight is legitimate. This explains why both squared SRC and Taylor give the exact same results even if the first one is based on a :math:`\mathcal{L}^2` linear approximation and the second one is based on a linear expansion around the mean value of the input variables. .. GENERATED FROM PYTHON SOURCE LINES 385-387 HSIC indices ------------ .. GENERATED FROM PYTHON SOURCE LINES 389-390 We then estimate the HSIC indices using a data-driven approach. .. GENERATED FROM PYTHON SOURCE LINES 390-396 .. code-block:: Python sizeHSIC = 250 inputDesignHSIC = m.inputDistribution.getSample(sizeHSIC) outputDesignHSIC = m.model(inputDesignHSIC) covarianceModelCollection = [] .. GENERATED FROM PYTHON SOURCE LINES 397-403 .. code-block:: Python for i in range(m.dim): Xi = inputDesignHSIC.getMarginal(i) inputCovariance = ot.SquaredExponential(1) inputCovariance.setScale(Xi.computeStandardDeviation()) covarianceModelCollection.append(inputCovariance) .. GENERATED FROM PYTHON SOURCE LINES 404-405 We define a covariance kernel associated to the output variable. .. GENERATED FROM PYTHON SOURCE LINES 405-409 .. code-block:: Python outputCovariance = ot.SquaredExponential(1) outputCovariance.setScale(outputDesignHSIC.computeStandardDeviation()) covarianceModelCollection.append(outputCovariance) .. GENERATED FROM PYTHON SOURCE LINES 410-412 In this paragraph, we perform the analysis on the raw data: that is the global HSIC estimator. .. GENERATED FROM PYTHON SOURCE LINES 412-414 .. code-block:: Python estimatorType = ot.HSICUStat() .. GENERATED FROM PYTHON SOURCE LINES 415-416 We now build the HSIC estimator: .. GENERATED FROM PYTHON SOURCE LINES 416-420 .. code-block:: Python globHSIC = ot.HSICEstimatorGlobalSensitivity( covarianceModelCollection, inputDesignHSIC, outputDesignHSIC, estimatorType ) .. GENERATED FROM PYTHON SOURCE LINES 421-422 We get the R2-HSIC indices: .. GENERATED FROM PYTHON SOURCE LINES 422-426 .. code-block:: Python R2HSICIndices = globHSIC.getR2HSICIndices() print("\n Global HSIC analysis") print("R2-HSIC Indices: ", R2HSICIndices) .. rst-class:: sphx-glr-script-out .. code-block:: none Global HSIC analysis R2-HSIC Indices: [0.159251,-0.000378845,0.208172,-0.00618487,-0.000766091,0.00490199,0.105402,0.312238,0.0807705,0.0253583]#10 .. GENERATED FROM PYTHON SOURCE LINES 427-428 and the HSIC indices: .. GENERATED FROM PYTHON SOURCE LINES 428-431 .. code-block:: Python HSICIndices = globHSIC.getHSICIndices() print("HSIC Indices: ", HSICIndices) .. rst-class:: sphx-glr-script-out .. code-block:: none HSIC Indices: [0.0132701,-3.22614e-05,0.0180983,-0.000512499,-6.31575e-05,0.00043174,0.00913392,0.0265314,0.00707718,0.00210602]#10 .. GENERATED FROM PYTHON SOURCE LINES 432-433 The p-value by permutation. .. GENERATED FROM PYTHON SOURCE LINES 433-436 .. code-block:: Python pvperm = globHSIC.getPValuesPermutation() print("p-value (permutation): ", pvperm) .. rst-class:: sphx-glr-script-out .. code-block:: none p-value (permutation): [0,0.405941,0,0.940594,0.485149,0.118812,0,0,0,0]#10 .. GENERATED FROM PYTHON SOURCE LINES 437-438 We have an asymptotic estimate of the value for this estimator. .. GENERATED FROM PYTHON SOURCE LINES 438-441 .. code-block:: Python pvas = globHSIC.getPValuesAsymptotic() print("p-value (asymptotic): ", pvas) .. rst-class:: sphx-glr-script-out .. code-block:: none p-value (asymptotic): [7.51146e-16,0.443168,7.04234e-22,0.916533,0.473858,0.167259,1.41574e-11,6.51232e-31,1.84557e-09,0.00176887]#10 .. GENERATED FROM PYTHON SOURCE LINES 442-443 We vizualise the results. .. GENERATED FROM PYTHON SOURCE LINES 443-455 .. code-block:: Python graph1 = globHSIC.drawHSICIndices() view1 = otv.View(graph1) graph2 = globHSIC.drawPValuesAsymptotic() view2 = otv.View(graph2) graph3 = globHSIC.drawR2HSICIndices() view3 = otv.View(graph3) graph4 = globHSIC.drawPValuesPermutation() view4 = otv.View(graph4) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_014.svg :alt: HSIC indices :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_014.svg :class: sphx-glr-multi-img * .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_015.svg :alt: Asymptotic p-values :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_015.svg :class: sphx-glr-multi-img * .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_016.svg :alt: R2-HSIC indices :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_016.svg :class: sphx-glr-multi-img * .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_017.svg :alt: p-values by permutation :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_017.svg :class: sphx-glr-multi-img .. GENERATED FROM PYTHON SOURCE LINES 456-459 The HSIC indices go in the same way as the other estimators in terms the most influent variables. The variables :math:`W_{fw}, q, l, W_p` seem to be independent to the output as the corresponding p-values are high. We can also see that the asymptotic p-values and p-values estimated by permutation are quite similar. .. GENERATED FROM PYTHON SOURCE LINES 461-462 .. code-block:: Python otv.View.ShowAll() .. _sphx_glr_download_auto_reliability_sensitivity_sensitivity_analysis_plot_sensitivity_wingweight.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_sensitivity_wingweight.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_sensitivity_wingweight.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_sensitivity_wingweight.zip `