-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GitHub Actions build openturns/otbenchmark 10943979829
- Loading branch information
GitHub Actions
committed
Sep 19, 2024
1 parent
7cbb5c7
commit ff52c6f
Showing
210 changed files
with
13,052 additions
and
576 deletions.
There are no files selected for viewing
235 changes: 235 additions & 0 deletions
235
...hmark/master/_downloads/018bebf23004eb4c852157b01b94c189/plot_borgonovo_sensitivity.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,235 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n# Benchmark the Borgonovo test function\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import openturns as ot\nimport otbenchmark as otb\nimport openturns.viewer as otv" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"problem = otb.BorgonovoSensitivity()\nprint(problem)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"distribution = problem.getInputDistribution()\nmodel = problem.getFunction()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Exact first and total order\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"exact_first_order = problem.getFirstOrderIndices()\nexact_first_order" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"exact_total_order = problem.getTotalOrderIndices()\nexact_total_order" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Plot the function\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Create X/Y data\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"ot.RandomGenerator.SetSeed(0)\nsize = 200\ninputDesign = ot.MonteCarloExperiment(distribution, size).generate()\noutputDesign = model(inputDesign)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"dimension = distribution.getDimension()\nfull_sample = ot.Sample(size, 1 + dimension)\nfull_sample[:, range(dimension)] = inputDesign\nfull_sample[:, dimension] = outputDesign\nfull_description = list(inputDesign.getDescription())\nfull_description.append(outputDesign.getDescription()[0])\nfull_sample.setDescription(full_description)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"marginal_distribution = ot.ComposedDistribution(\n [\n ot.KernelSmoothing().build(full_sample.getMarginal(i))\n for i in range(1 + dimension)\n ]\n)\nclouds = ot.VisualTest.DrawPairsMarginals(full_sample, marginal_distribution)\n_ = otv.View(clouds, figure_kw={\"figsize\": (6.0, 6.0)})" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"output_distribution = ot.KernelSmoothing().build(outputDesign)\n_ = otv.View(output_distribution.drawPDF())" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Perform sensitivity analysis\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Create X/Y data\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"ot.RandomGenerator.SetSeed(0)\nsize = 10000\ninputDesign = ot.SobolIndicesExperiment(distribution, size).generate()\noutputDesign = model(inputDesign)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Compute first order indices using the Saltelli estimator\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"sensitivityAnalysis = ot.SaltelliSensitivityAlgorithm(inputDesign, outputDesign, size)\ncomputed_first_order = sensitivityAnalysis.getFirstOrderIndices()\ncomputed_total_order = sensitivityAnalysis.getTotalOrderIndices()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Compare with exact results\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"print(\"Sample size : \", size)\n# First order\n# Compute absolute error (the LRE cannot be computed,\n# because S can be zero)\nprint(\"Computed first order = \", computed_first_order)\nprint(\"Exact first order = \", exact_first_order)\n# Total order\nprint(\"Computed total order = \", computed_total_order)\nprint(\"Exact total order = \", exact_total_order)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"_ = otv.View(sensitivityAnalysis.draw())" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"otv.View.ShowAll()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.20" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
Binary file added
BIN
+8.75 KB
...mark/master/_downloads/02ebaaff0fbfc2d6c398818b1ca6b2f8/plot_nloscillator_sensitivity.zip
Binary file not shown.
Binary file modified
BIN
+33.9 KB
(270%)
otbenchmark/master/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip
Binary file not shown.
Binary file added
BIN
+8.72 KB
...nchmark/master/_downloads/09a8c2ecba196a7145cf5887e3bfbf39/plot_dirichlet_sensitivity.zip
Binary file not shown.
Binary file added
BIN
+8.73 KB
otbenchmark/master/_downloads/0b4d0577810c77038fc3a798767a76ea/plot_flood_sensitivity.zip
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...mark/master/_downloads/0ee134db52089df8699dbb596527cd27/plot_crosscut_distribution_2d.zip
Binary file not shown.
Oops, something went wrong.