This file contains hidden or 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
| """ | |
| Let d be the dimension of the input vector. | |
| Let n be the sample size. | |
| Let alpha in [0, 1] a proportion of the sample size. | |
| Compute the largest polynomial degree p such that the | |
| number of coefficients of the polynomial chaos expansion is lower or | |
| equal to alpha * n. | |
| For example, the next table presents the number of coefficients | |
| of the PCE of the Ishigami function, which has dimension 3. |
This file contains hidden or 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
| """ | |
| Estimate the expected value of the test functions using quasi-Monte Carlo. | |
| See the effect of: | |
| - scrambling the Sobol' sequence, | |
| - including or excluding the first Sobol' point (zero). | |
| See: | |
| - The first zero point should be moved back into the low discrepancy sequences |
This file contains hidden or 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
| """ | |
| Michaël Baudin, 2025 | |
| Benchmark the elapsed time of the cross-validation of a PCE. | |
| Compare two methods for cross-validation: | |
| - leave-one-out, | |
| - K-fold. | |
| Compare two methods for performing the CV: | |
| - classical cross-validation, using MetaModelValidation, |
This file contains hidden or 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
| """ | |
| Michaël Baudin, 2025 | |
| Benchmark the elapsed time of solving a linear least squares problem using OpenTURNS. | |
| Uses the Ishigami function. | |
| Compute its polynomial chaos expansion. | |
| """ | |
| # %% | |
| import openturns as ot | |
| import time |
This file contains hidden or 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
| """ | |
| Get the (output) marginal of a PCE. | |
| There is no FunctionalChaosResult.getMarginal() | |
| https://github.com/openturns/openturns/issues/2985 | |
| Limitation | |
| ---------- | |
| This script involves more PCE indices than necessary i.e. the number |
This file contains hidden or 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
| """ | |
| Smallest possible script to create a FunctionalChaosResult. | |
| Uses the Ishigami function. | |
| """ | |
| # %% | |
| from openturns.usecases import ishigami_function | |
| import openturns as ot | |
| # %% |
This file contains hidden or 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
| """Implements the selection method of a polynomial chaos expansion algorithm in Python. | |
| This implements 2 algorithms: | |
| - Algorithm B.1 page 628 of (Lüthen, et al., 2021), | |
| - Algorithm B.1 with with CV using Corrected Leave-One-Out or K-Fold. | |
| TODO-List | |
| --------- | |
| - Extend the code to multiple output dimensions. | |
| - Early stopping of the algorithm using the K-Fold or Corrected LOO score. |
This file contains hidden or 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
| """ | |
| This script uses SALib to estimate Sobol' indices from the Beam model. | |
| The beam model is implemented as a Python function. | |
| Moreover, we measure the time necessary to evaluate the model and estimate | |
| the Sobol' indices. | |
| Output | |
| ------ | |
| N = 100000 | |
| Elapsed = 218.30088353157043 (s) |
This file contains hidden or 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
| """ | |
| This script uses OpenTURNS to estimate Sobol' indices from the Beam model implemented as an OpenTURNS's function. | |
| Moreover, we measure the time necessary to evaluate the model and estimate the Sobol' indices. | |
| Output | |
| ------ | |
| Elapsed = 1.0558149814605713 (s) | |
| References | |
| ---------- |
This file contains hidden or 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
| """ | |
| Create a polynomial chaos for the Ishigami function and export | |
| it as a standalone Python code. | |
| See https://github.com/openturns/openturns/blob/master/lib/src/Uncertainty/Algorithm/MetaModel/FunctionalChaos/FunctionalChaosResult.cxx | |
| This code produces a file which content is: | |
| from openturns import * | |
| def pceModel(X): |
NewerOlder