.. 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-39 .. code-block:: Python import openturns as ot import openturns.experimental as otexp import openturns.viewer as otv from openturns.usecases.wingweight_function import WingWeightModel from matplotlib import pylab as plt ot.Log.Show(ot.Log.NONE) m = WingWeightModel() .. GENERATED FROM PYTHON SOURCE LINES 40-47 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 47-88 .. 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.png :alt: plot sensitivity wingweight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 89-90 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 92-96 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 96-103 .. code-block:: Python inputNames = m.inputDistribution.getDescription() size = 500 inputDesign = m.inputDistribution.getSample(size) outputDesign = m.model(inputDesign) .. GENERATED FROM PYTHON SOURCE LINES 104-106 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 106-109 .. code-block:: Python corr_analysis = ot.CorrelationAnalysis(inputDesign, outputDesign) .. GENERATED FROM PYTHON SOURCE LINES 110-113 PCC coefficients ---------------- We compute here PCC coefficients using the :class:`~openturns.CorrelationAnalysis`. .. GENERATED FROM PYTHON SOURCE LINES 115-118 .. code-block:: Python pcc_indices = corr_analysis.computePCC() print(pcc_indices) .. rst-class:: sphx-glr-script-out .. code-block:: none [0.942801,0.0146971,0.963954,0.0471221,-0.0171501,0.319334,-0.944516,0.979952,0.907646,0.435131]#10 .. GENERATED FROM PYTHON SOURCE LINES 122-127 .. 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.png :alt: PCC coefficients - Wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 128-131 PRCC coefficients ----------------- We compute here PRCC coefficients using the :class:`~openturns.CorrelationAnalysis`. .. GENERATED FROM PYTHON SOURCE LINES 133-136 .. code-block:: Python prcc_indices = corr_analysis.computePRCC() print(prcc_indices) .. rst-class:: sphx-glr-script-out .. code-block:: none [0.887607,0.0149862,0.927025,0.0148019,0.0955716,0.240199,-0.889329,0.959604,0.824026,0.274503]#10 .. GENERATED FROM PYTHON SOURCE LINES 137-142 .. 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.png :alt: PRCC coefficients - Wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 143-146 SRC coefficients ------------------- We compute here SRC coefficients using the :class:`~openturns.CorrelationAnalysis`. .. GENERATED FROM PYTHON SOURCE LINES 148-151 .. code-block:: Python src_indices = corr_analysis.computeSRC() print(src_indices) .. rst-class:: sphx-glr-script-out .. code-block:: none [0.369054,0.00191698,0.474967,0.00613359,-0.00223852,0.0443933,-0.375146,0.643262,0.28408,0.0631151]#10 .. GENERATED FROM PYTHON SOURCE LINES 152-157 .. 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.png :alt: SRC coefficients - Wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_004.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 158-159 Normalized squared SRC coefficients (coefficients are made to sum to 1) : .. GENERATED FROM PYTHON SOURCE LINES 161-164 .. code-block:: Python squared_src_indices = corr_analysis.computeSquaredSRC(True) print(squared_src_indices) .. rst-class:: sphx-glr-script-out .. code-block:: none [0.135791,3.66377e-06,0.224915,3.75077e-05,4.99592e-06,0.00196484,0.140311,0.412542,0.0804589,0.00397154]#10 .. GENERATED FROM PYTHON SOURCE LINES 165-166 And their associated graph: .. GENERATED FROM PYTHON SOURCE LINES 168-173 .. 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.png :alt: Squared SRC coefficients - Wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_005.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 177-180 SRRC coefficients -------------------- We compute here SRRC coefficients using the :class:`~openturns.CorrelationAnalysis`. .. GENERATED FROM PYTHON SOURCE LINES 182-185 .. code-block:: Python srrc_indices = corr_analysis.computeSRRC() print(srrc_indices) .. rst-class:: sphx-glr-script-out .. code-block:: none [0.362864,0.00281988,0.467839,0.00277594,0.0180698,0.047034,-0.366132,0.642975,0.275605,0.0537757]#10 .. GENERATED FROM PYTHON SOURCE LINES 186-191 .. 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.png :alt: SRRC coefficients - Wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_006.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 192-195 Pearson coefficients ----------------------- We compute here the Pearson :math:`\rho` coefficients using the :class:`~openturns.CorrelationAnalysis`. .. GENERATED FROM PYTHON SOURCE LINES 197-200 .. code-block:: Python pearson_correlation = corr_analysis.computeLinearCorrelation() print(pearson_correlation) .. rst-class:: sphx-glr-script-out .. code-block:: none [0.343082,0.0393668,0.503811,-0.0214446,0.0565804,0.0676019,-0.33644,0.610386,0.298603,0.172064]#10 .. GENERATED FROM PYTHON SOURCE LINES 201-207 .. 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.png :alt: Pearson correlation coefficients - Wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_007.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 208-211 Spearman coefficients ----------------------- We compute here the Spearman :math:`\rho_s` coefficients using the :class:`~openturns.CorrelationAnalysis`. .. GENERATED FROM PYTHON SOURCE LINES 213-216 .. code-block:: Python spearman_correlation = corr_analysis.computeSpearmanCorrelation() print(spearman_correlation) .. rst-class:: sphx-glr-script-out .. code-block:: none [0.335585,0.0370791,0.50151,-0.0208144,0.0746623,0.0683962,-0.327675,0.613847,0.293277,0.161524]#10 .. GENERATED FROM PYTHON SOURCE LINES 217-224 .. 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) plt.show() .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_008.png :alt: Spearman correlation coefficients - Wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_008.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 225-228 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 232-235 Taylor expansion importance factors ----------------------------------- We compute here the Taylor expansion importance factors using :class:`~openturns.TaylorExpansionMoments`. .. GENERATED FROM PYTHON SOURCE LINES 239-240 We create a distribution-based RandomVector. .. GENERATED FROM PYTHON SOURCE LINES 240-242 .. code-block:: Python X = ot.RandomVector(m.inputDistribution) .. GENERATED FROM PYTHON SOURCE LINES 243-244 We create a composite RandomVector Y from X and m.model. .. GENERATED FROM PYTHON SOURCE LINES 244-246 .. code-block:: Python Y = ot.CompositeRandomVector(m.model, X) .. GENERATED FROM PYTHON SOURCE LINES 247-248 We create a Taylor expansion method to approximate moments. .. GENERATED FROM PYTHON SOURCE LINES 248-250 .. code-block:: Python taylor = ot.TaylorExpansionMoments(Y) .. GENERATED FROM PYTHON SOURCE LINES 251-252 We get the importance factors. .. GENERATED FROM PYTHON SOURCE LINES 252-254 .. 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 255-256 We draw the importance factors .. GENERATED FROM PYTHON SOURCE LINES 256-260 .. 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.png :alt: Taylor expansion imporfance factors - Wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_009.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 261-263 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 266-269 Sobol' indices -------------- We compute the Sobol' indices from both sampling approach and Polynomial Chaos Expansion. .. GENERATED FROM PYTHON SOURCE LINES 271-278 .. 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 279-280 We see that 12000 function evaluations are required to estimate the first order and total Sobol' indices. .. GENERATED FROM PYTHON SOURCE LINES 282-283 Then, we evaluate the outputs corresponding to this design of experiments. .. GENERATED FROM PYTHON SOURCE LINES 285-287 .. code-block:: Python outputDesignSobol = m.model(inputDesignSobol) .. GENERATED FROM PYTHON SOURCE LINES 288-289 We estimate the Sobol' indices with the :class:`~openturns.SaltelliSensitivityAlgorithm`. .. GENERATED FROM PYTHON SOURCE LINES 291-295 .. code-block:: Python sensitivityAnalysis = ot.SaltelliSensitivityAlgorithm( inputDesignSobol, outputDesignSobol, sizeSobol ) .. GENERATED FROM PYTHON SOURCE LINES 296-297 The `getFirstOrderIndices` and `getTotalOrderIndices` methods respectively return estimates of all first order and total Sobol' indices. .. GENERATED FROM PYTHON SOURCE LINES 299-301 .. code-block:: Python print("First order indices:", sensitivityAnalysis.getFirstOrderIndices()) .. rst-class:: sphx-glr-script-out .. code-block:: none First order indices: [0.104592,-0.0127142,0.195142,-0.0129334,-0.0121335,-0.012292,0.111261,0.359861,0.0613847,-0.00973436]#10 .. GENERATED FROM PYTHON SOURCE LINES 302-305 .. code-block:: Python print("Total order indices:", sensitivityAnalysis.getTotalOrderIndices()) .. rst-class:: sphx-glr-script-out .. code-block:: none Total order indices: [0.16211,6.69558e-07,0.234316,0.0012256,-0.000845109,0.000685252,0.150425,0.384081,0.0848994,0.000413006]#10 .. GENERATED FROM PYTHON SOURCE LINES 306-307 The `draw` method produces the following graph. The vertical bars represent the 95% confidence intervals of the estimates. .. GENERATED FROM PYTHON SOURCE LINES 309-313 .. 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.png :alt: Sobol indices with Saltelli - wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_010.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 314-315 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 315-334 .. 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.png :alt: Sobol indices with Saltelli - wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_011.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 335-336 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 338-340 Now, we estimate the Sobol' indices using Polynomial Chaos Expansion. We create a Functional Chaos Expansion. .. GENERATED FROM PYTHON SOURCE LINES 340-351 .. 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() print(result.getResiduals()) print(result.getRelativeErrors()) .. rst-class:: sphx-glr-script-out .. code-block:: none [0.000332456] [3.71763e-08] .. GENERATED FROM PYTHON SOURCE LINES 352-354 The relative errors are low : this indicates that the PCE model has good accuracy. Then, we exploit the surrogate model to compute the Sobol' indices. .. GENERATED FROM PYTHON SOURCE LINES 354-357 .. 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.0678]
Input Variable Sobol' index Total index
0 Sw 0.124414 0.127831
1 Wfw 0.000003 0.000006
2 A 0.220250 0.226008
3 Lambda 0.000485 0.000504
4 q 0.000086 0.000092
5 l 0.001819 0.001882
6 tc 0.141007 0.145091
7 Nz 0.411636 0.419615
8 Wdg 0.084983 0.087607
9 Wp 0.003362 0.003389
Index Multi-index Part of variance
8 [0,0,0,0,0,0,0,1,0,0]#10 0.410339
3 [0,0,1,0,0,0,0,0,0,0]#10 0.220105
7 [0,0,0,0,0,0,1,0,0,0]#10 0.138464
1 [1,0,0,0,0,0,0,0,0,0]#10 0.124406
9 [0,0,0,0,0,0,0,0,1,0]#10 0.084929


.. GENERATED FROM PYTHON SOURCE LINES 358-365 .. 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.png :alt: Sobol indices by Polynomial Chaos Expansion - wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_012.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 366-368 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 368-380 .. 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.png :alt: Sobol indices by rank-based estimation - wing weight :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_013.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none First order indices: [0.219707,0.056403,0.180796,0.0263883,0.0380841,-0.00340235,0.107226,0.44097,0.0450809,0.0523331]#10 .. GENERATED FROM PYTHON SOURCE LINES 381-387 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 391-393 HSIC indices ------------ .. GENERATED FROM PYTHON SOURCE LINES 395-396 We then estimate the HSIC indices using a data-driven approach. .. GENERATED FROM PYTHON SOURCE LINES 396-402 .. code-block:: Python sizeHSIC = 250 inputDesignHSIC = m.inputDistribution.getSample(sizeHSIC) outputDesignHSIC = m.model(inputDesignHSIC) covarianceModelCollection = [] .. GENERATED FROM PYTHON SOURCE LINES 403-409 .. 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 410-411 We define a covariance kernel associated to the output variable. .. GENERATED FROM PYTHON SOURCE LINES 411-415 .. code-block:: Python outputCovariance = ot.SquaredExponential(1) outputCovariance.setScale(outputDesignHSIC.computeStandardDeviation()) covarianceModelCollection.append(outputCovariance) .. GENERATED FROM PYTHON SOURCE LINES 416-418 In this paragraph, we perform the analysis on the raw data: that is the global HSIC estimator. .. GENERATED FROM PYTHON SOURCE LINES 418-420 .. code-block:: Python estimatorType = ot.HSICUStat() .. GENERATED FROM PYTHON SOURCE LINES 421-422 We now build the HSIC estimator: .. GENERATED FROM PYTHON SOURCE LINES 422-426 .. code-block:: Python globHSIC = ot.HSICEstimatorGlobalSensitivity( covarianceModelCollection, inputDesignHSIC, outputDesignHSIC, estimatorType ) .. GENERATED FROM PYTHON SOURCE LINES 427-428 We get the R2-HSIC indices: .. GENERATED FROM PYTHON SOURCE LINES 428-432 .. 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.082831,-0.00416762,0.192346,-0.00515997,-0.00166083,8.15814e-05,0.0818061,0.353705,0.0493093,-0.00190752]#10 .. GENERATED FROM PYTHON SOURCE LINES 433-434 and the HSIC indices: .. GENERATED FROM PYTHON SOURCE LINES 434-437 .. code-block:: Python HSICIndices = globHSIC.getHSICIndices() print("HSIC Indices: ", HSICIndices) .. rst-class:: sphx-glr-script-out .. code-block:: none HSIC Indices: [0.00721601,-0.000366066,0.0171733,-0.000465613,-0.000149481,7.08356e-06,0.00737526,0.0316188,0.00441525,-0.00017465]#10 .. GENERATED FROM PYTHON SOURCE LINES 438-439 The p-value by permutation. .. GENERATED FROM PYTHON SOURCE LINES 439-442 .. 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.772277,0,0.881188,0.485149,0.267327,0,0,0,0.584158]#10 .. GENERATED FROM PYTHON SOURCE LINES 443-444 We have an asymptotic estimate of the value for this estimator. .. GENERATED FROM PYTHON SOURCE LINES 444-447 .. code-block:: Python pvas = globHSIC.getPValuesAsymptotic() print("p-value (asymptotic): ", pvas) .. rst-class:: sphx-glr-script-out .. code-block:: none p-value (asymptotic): [1.54432e-09,0.761116,6.48955e-21,0.848855,0.54071,0.409683,4.4423e-09,6.40633e-32,5.97639e-06,0.562308]#10 .. GENERATED FROM PYTHON SOURCE LINES 448-449 We vizualise the results. .. GENERATED FROM PYTHON SOURCE LINES 449-461 .. 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.png :alt: HSIC indices :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_014.png :class: sphx-glr-multi-img * .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_015.png :alt: Asymptotic p-values :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_015.png :class: sphx-glr-multi-img * .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_016.png :alt: R2-HSIC indices :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_016.png :class: sphx-glr-multi-img * .. image-sg:: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_017.png :alt: p-values by permutation :srcset: /auto_reliability_sensitivity/sensitivity_analysis/images/sphx_glr_plot_sensitivity_wingweight_017.png :class: sphx-glr-multi-img .. GENERATED FROM PYTHON SOURCE LINES 462-465 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 467-468 Reset default settings .. GENERATED FROM PYTHON SOURCE LINES 468-469 .. code-block:: Python ot.ResourceMap.Reload() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 18.001 seconds) .. _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 `