diff --git a/README.rst b/README.rst index 797a2e9..47dc3da 100644 --- a/README.rst +++ b/README.rst @@ -112,10 +112,6 @@ OpenTURNS Presentations - `OTICSCREAM: A Python module (and a cooking recipe) for the identification of penalizing configurations in computer experiments `_ - `Uncertainty Propagation and Sensitivity Analysis in Additive Manufacturing Simulation `_ -- Uncecomp 2023 - - - `Slides `_ - - CHORUS - `Low rank tensor approximation `_ @@ -148,6 +144,8 @@ OpenTURNS Presentations - `SIAM-UQ 2022 `_ +- `Uncecomp 2023 `_ + - `Applibugs 2023 `_ - `SIAM-UQ 2024 `_ @@ -156,3 +154,5 @@ OpenTURNS Presentations - `OpenTURNS and Persalys Overview `_ - `Bayesian inference using MCMC in OpenTURNS `_ + +- `Uncecomp 2025 `_ diff --git a/uncecomp2025/figure/Persalys_GUI.png b/uncecomp2025/figure/Persalys_GUI.png new file mode 100644 index 0000000..21b32a4 Binary files /dev/null and b/uncecomp2025/figure/Persalys_GUI.png differ diff --git a/uncecomp2025/figure/Persalys_new_study.png b/uncecomp2025/figure/Persalys_new_study.png new file mode 100644 index 0000000..b4af827 Binary files /dev/null and b/uncecomp2025/figure/Persalys_new_study.png differ diff --git a/uncecomp2025/figure/StudyWorkflow.png b/uncecomp2025/figure/StudyWorkflow.png new file mode 100644 index 0000000..e0c99b7 Binary files /dev/null and b/uncecomp2025/figure/StudyWorkflow.png differ diff --git a/uncecomp2025/figure/model_definition.png b/uncecomp2025/figure/model_definition.png new file mode 100644 index 0000000..a51fadc Binary files /dev/null and b/uncecomp2025/figure/model_definition.png differ diff --git a/uncecomp2025/figure/overviewMetamodel.png b/uncecomp2025/figure/overviewMetamodel.png new file mode 100644 index 0000000..31508d9 Binary files /dev/null and b/uncecomp2025/figure/overviewMetamodel.png differ diff --git a/uncecomp2025/figure/overviewProbaModel.png b/uncecomp2025/figure/overviewProbaModel.png new file mode 100644 index 0000000..fa4ce22 Binary files /dev/null and b/uncecomp2025/figure/overviewProbaModel.png differ diff --git a/uncecomp2025/figures/CobwebOT.png b/uncecomp2025/figures/CobwebOT.png new file mode 100644 index 0000000..6e56fcd Binary files /dev/null and b/uncecomp2025/figures/CobwebOT.png differ diff --git a/uncecomp2025/figures/ComposedGumbel.pdf b/uncecomp2025/figures/ComposedGumbel.pdf new file mode 100644 index 0000000..b6c9878 Binary files /dev/null and b/uncecomp2025/figures/ComposedGumbel.pdf differ diff --git a/uncecomp2025/figures/ConditioningLine.pdf b/uncecomp2025/figures/ConditioningLine.pdf new file mode 100644 index 0000000..8a81b02 Binary files /dev/null and b/uncecomp2025/figures/ConditioningLine.pdf differ diff --git a/uncecomp2025/figures/Copula1.pdf b/uncecomp2025/figures/Copula1.pdf new file mode 100644 index 0000000..021d4f9 Binary files /dev/null and b/uncecomp2025/figures/Copula1.pdf differ diff --git a/uncecomp2025/figures/Copula2.pdf b/uncecomp2025/figures/Copula2.pdf new file mode 100644 index 0000000..a8f2a80 Binary files /dev/null and b/uncecomp2025/figures/Copula2.pdf differ diff --git a/uncecomp2025/figures/Copula3.pdf b/uncecomp2025/figures/Copula3.pdf new file mode 100644 index 0000000..baa9569 Binary files /dev/null and b/uncecomp2025/figures/Copula3.pdf differ diff --git a/uncecomp2025/figures/Copula4.pdf b/uncecomp2025/figures/Copula4.pdf new file mode 100644 index 0000000..e825dc1 Binary files /dev/null and b/uncecomp2025/figures/Copula4.pdf differ diff --git a/uncecomp2025/figures/Correlation.pdf b/uncecomp2025/figures/Correlation.pdf new file mode 100644 index 0000000..379f5c1 Binary files /dev/null and b/uncecomp2025/figures/Correlation.pdf differ diff --git a/uncecomp2025/figures/Covariance.pdf b/uncecomp2025/figures/Covariance.pdf new file mode 100644 index 0000000..a5c20f0 Binary files /dev/null and b/uncecomp2025/figures/Covariance.pdf differ diff --git a/uncecomp2025/figures/DOE.pdf b/uncecomp2025/figures/DOE.pdf new file mode 100644 index 0000000..3f7b23f Binary files /dev/null and b/uncecomp2025/figures/DOE.pdf differ diff --git a/uncecomp2025/figures/Deconditioned.pdf b/uncecomp2025/figures/Deconditioned.pdf new file mode 100644 index 0000000..51e5ba5 Binary files /dev/null and b/uncecomp2025/figures/Deconditioned.pdf differ diff --git a/uncecomp2025/figures/Dist.pdf b/uncecomp2025/figures/Dist.pdf new file mode 100644 index 0000000..46d5123 Binary files /dev/null and b/uncecomp2025/figures/Dist.pdf differ diff --git a/uncecomp2025/figures/EigenValues.pdf b/uncecomp2025/figures/EigenValues.pdf new file mode 100644 index 0000000..9fe92a3 Binary files /dev/null and b/uncecomp2025/figures/EigenValues.pdf differ diff --git a/uncecomp2025/figures/Expectation.png b/uncecomp2025/figures/Expectation.png new file mode 100644 index 0000000..57b4ba0 Binary files /dev/null and b/uncecomp2025/figures/Expectation.png differ diff --git a/uncecomp2025/figures/ExtractedCopula.pdf b/uncecomp2025/figures/ExtractedCopula.pdf new file mode 100644 index 0000000..da5ccd9 Binary files /dev/null and b/uncecomp2025/figures/ExtractedCopula.pdf differ diff --git a/uncecomp2025/figures/Inference.pdf b/uncecomp2025/figures/Inference.pdf new file mode 100644 index 0000000..183abbe Binary files /dev/null and b/uncecomp2025/figures/Inference.pdf differ diff --git a/uncecomp2025/figures/JointByConditioning.pdf b/uncecomp2025/figures/JointByConditioning.pdf new file mode 100644 index 0000000..9666595 Binary files /dev/null and b/uncecomp2025/figures/JointByConditioning.pdf differ diff --git a/uncecomp2025/figures/Kriging.pdf b/uncecomp2025/figures/Kriging.pdf new file mode 100644 index 0000000..e9756f7 Binary files /dev/null and b/uncecomp2025/figures/Kriging.pdf differ diff --git a/uncecomp2025/figures/Ks.png b/uncecomp2025/figures/Ks.png new file mode 100644 index 0000000..918737f Binary files /dev/null and b/uncecomp2025/figures/Ks.png differ diff --git a/uncecomp2025/figures/LogoAirbus.png b/uncecomp2025/figures/LogoAirbus.png new file mode 100644 index 0000000..b8ea064 Binary files /dev/null and b/uncecomp2025/figures/LogoAirbus.png differ diff --git a/uncecomp2025/figures/Marg1.pdf b/uncecomp2025/figures/Marg1.pdf new file mode 100644 index 0000000..badd18e Binary files /dev/null and b/uncecomp2025/figures/Marg1.pdf differ diff --git a/uncecomp2025/figures/Marg2.pdf b/uncecomp2025/figures/Marg2.pdf new file mode 100644 index 0000000..a6fdcde Binary files /dev/null and b/uncecomp2025/figures/Marg2.pdf differ diff --git a/uncecomp2025/figures/Modes.pdf b/uncecomp2025/figures/Modes.pdf new file mode 100644 index 0000000..408df47 Binary files /dev/null and b/uncecomp2025/figures/Modes.pdf differ diff --git a/uncecomp2025/figures/OT.pdf b/uncecomp2025/figures/OT.pdf new file mode 100644 index 0000000..74fd8c4 Binary files /dev/null and b/uncecomp2025/figures/OT.pdf differ diff --git a/uncecomp2025/figures/PERSALYS-LOGO.png b/uncecomp2025/figures/PERSALYS-LOGO.png new file mode 100644 index 0000000..ffc5054 Binary files /dev/null and b/uncecomp2025/figures/PERSALYS-LOGO.png differ diff --git a/uncecomp2025/figures/PointConditional.pdf b/uncecomp2025/figures/PointConditional.pdf new file mode 100644 index 0000000..cb315a1 Binary files /dev/null and b/uncecomp2025/figures/PointConditional.pdf differ diff --git a/uncecomp2025/figures/Posterior.pdf b/uncecomp2025/figures/Posterior.pdf new file mode 100644 index 0000000..3149409 Binary files /dev/null and b/uncecomp2025/figures/Posterior.pdf differ diff --git a/uncecomp2025/figures/Q.png b/uncecomp2025/figures/Q.png new file mode 100644 index 0000000..d935682 Binary files /dev/null and b/uncecomp2025/figures/Q.png differ diff --git a/uncecomp2025/figures/Reduced_Space.pdf b/uncecomp2025/figures/Reduced_Space.pdf new file mode 100644 index 0000000..646d018 Binary files /dev/null and b/uncecomp2025/figures/Reduced_Space.pdf differ diff --git a/uncecomp2025/figures/S.png b/uncecomp2025/figures/S.png new file mode 100644 index 0000000..1b4647b Binary files /dev/null and b/uncecomp2025/figures/S.png differ diff --git a/uncecomp2025/figures/SobolEx.png b/uncecomp2025/figures/SobolEx.png new file mode 100644 index 0000000..e2fd38d Binary files /dev/null and b/uncecomp2025/figures/SobolEx.png differ diff --git a/uncecomp2025/figures/Trajectories.pdf b/uncecomp2025/figures/Trajectories.pdf new file mode 100644 index 0000000..b2e7236 Binary files /dev/null and b/uncecomp2025/figures/Trajectories.pdf differ diff --git a/uncecomp2025/figures/edf.jpg b/uncecomp2025/figures/edf.jpg new file mode 100644 index 0000000..cf221fb Binary files /dev/null and b/uncecomp2025/figures/edf.jpg differ diff --git a/uncecomp2025/figures/exClasses.png b/uncecomp2025/figures/exClasses.png new file mode 100644 index 0000000..50a1ab1 Binary files /dev/null and b/uncecomp2025/figures/exClasses.png differ diff --git a/uncecomp2025/figures/logo-openturns.png b/uncecomp2025/figures/logo-openturns.png new file mode 100644 index 0000000..fd33928 Binary files /dev/null and b/uncecomp2025/figures/logo-openturns.png differ diff --git a/uncecomp2025/figures/logoEDF_Anne.png b/uncecomp2025/figures/logoEDF_Anne.png new file mode 100644 index 0000000..c28cae4 Binary files /dev/null and b/uncecomp2025/figures/logoEDF_Anne.png differ diff --git a/uncecomp2025/figures/logo_ONERA.jpg b/uncecomp2025/figures/logo_ONERA.jpg new file mode 100644 index 0000000..2cef409 Binary files /dev/null and b/uncecomp2025/figures/logo_ONERA.jpg differ diff --git a/uncecomp2025/figures/logo_phimeca.png b/uncecomp2025/figures/logo_phimeca.png new file mode 100644 index 0000000..061b647 Binary files /dev/null and b/uncecomp2025/figures/logo_phimeca.png differ diff --git a/uncecomp2025/figures/pce_conditional.png b/uncecomp2025/figures/pce_conditional.png new file mode 100644 index 0000000..c090668 Binary files /dev/null and b/uncecomp2025/figures/pce_conditional.png differ diff --git a/uncecomp2025/figures/plot_distribution_fitting.png b/uncecomp2025/figures/plot_distribution_fitting.png new file mode 100644 index 0000000..3541dbc Binary files /dev/null and b/uncecomp2025/figures/plot_distribution_fitting.png differ diff --git a/uncecomp2025/figures/plot_kriging.png b/uncecomp2025/figures/plot_kriging.png new file mode 100644 index 0000000..5705d37 Binary files /dev/null and b/uncecomp2025/figures/plot_kriging.png differ diff --git a/uncecomp2025/figures/plot_monte_carlo.png b/uncecomp2025/figures/plot_monte_carlo.png new file mode 100644 index 0000000..6524eaa Binary files /dev/null and b/uncecomp2025/figures/plot_monte_carlo.png differ diff --git a/uncecomp2025/figures/plot_pval_GSA_MDTE.pdf b/uncecomp2025/figures/plot_pval_GSA_MDTE.pdf new file mode 100644 index 0000000..34fb73c Binary files /dev/null and b/uncecomp2025/figures/plot_pval_GSA_MDTE.pdf differ diff --git a/uncecomp2025/figures/plot_pval_TSA_MDTE.pdf b/uncecomp2025/figures/plot_pval_TSA_MDTE.pdf new file mode 100644 index 0000000..4b26274 Binary files /dev/null and b/uncecomp2025/figures/plot_pval_TSA_MDTE.pdf differ diff --git a/uncecomp2025/figures/plot_random_walk.png b/uncecomp2025/figures/plot_random_walk.png new file mode 100644 index 0000000..4a77946 Binary files /dev/null and b/uncecomp2025/figures/plot_random_walk.png differ diff --git a/uncecomp2025/figures/plot_sobol_field.png b/uncecomp2025/figures/plot_sobol_field.png new file mode 100644 index 0000000..60577f9 Binary files /dev/null and b/uncecomp2025/figures/plot_sobol_field.png differ diff --git a/uncecomp2025/macros.tex b/uncecomp2025/macros.tex new file mode 100644 index 0000000..0d02b96 --- /dev/null +++ b/uncecomp2025/macros.tex @@ -0,0 +1,30 @@ +% Copyright (C) 2012 - EDF R&D - Michael Baudin + + +% To highlight source code +\usepackage{listings} +\definecolor{darkgreen}{rgb}{0,0.5,0} +\definecolor{violet}{rgb}{0.5,0,1} + +\usepackage{lmodern}% http://ctan.org/pkg/lm + + + +\usetheme{Montpellier} +\setbeamertemplate{navigation symbols}{} % Remove navigation +\useoutertheme{infolines} + +\usepackage[latin1]{inputenc} +\usepackage[T1]{fontenc} + + +%\usepackage[french]{babel} +%\uselanguage{French} +%\languagepath{French} + +\def\bx{{\bf x}} +\def\RR{\mathbb{R}} + +\newcommand{\pyvar}[1]{\texttt{#1}} + +\def \ot {OpenTURNS} diff --git a/uncecomp2025/scripts/illustration.py b/uncecomp2025/scripts/illustration.py new file mode 100644 index 0000000..6f3f048 --- /dev/null +++ b/uncecomp2025/scripts/illustration.py @@ -0,0 +1,185 @@ +# -*- coding: utf-8 -*- +""" +Spyder Editor + +This is a temporary script file. +""" +# %% +import openturns as ot +import numpy as np + +def free_fall(X): + g = 9.81 + z0,v0,m,c = X + tau=m/c + vinf=-m*g/c + t = np.array(mesh.getVertices().asPoint()) + z=z0+vinf*t+tau*(v0-vinf)*(1-np.exp(-t/tau)) + z=np.maximum(z,0.0) + return ot.Field(mesh, z.reshape(-1, 1)) + +tmin=0. +tmax=12. +gridsize=100 +mesh = ot.IntervalMesher([gridsize-1]).build( +ot.Interval(tmin, tmax)) + +alti = ot.PythonPointToFieldFunction(4, mesh, 1, free_fall) + +distZ0 = ot.Uniform(50.0, 200.0) +distV0 = ot.Normal(55.0, 10.0) +distM = ot.Normal(80.0, 8.0) +distC = ot.Uniform(0.0, 30.0) +distX = ot.ComposedDistribution([distZ0, distV0, + distM, distC]) + +size = 100 +inputSample = distX.getSample(size) +outputField = alti(inputSample) + + + +# %% +# Draw +from openturns.viewer import View + +graph = outputField.draw().getGraph(0,0) +graph.setTitle("Free fall in viscous fluid") +graph.setXTitle("t") +graph.setYTitle("z") +v= View(graph) +v.save("trajectories.pdf") +v.save("trajectories.png") + +# %% + +meanField = outputField.computeMean() +meanFunction = ot.P1LagrangeEvaluation( + meanField) +trend = ot.TrendTransform(meanFunction, mesh) +invTrend = trend.getInverse() +outputFieldCentered = invTrend(outputField) + +truncThreshold = 1.0e-5 +algo = ot.KarhunenLoeveSVDAlgorithm( + outputFieldCentered, truncThreshold) +algo.run() +KLResult = algo.getResult() + +eigenValues = KLResult.getEigenvalues() + +# %% +# Graphical +import matplotlib.pyplot as plt + +plt.plot(eigenValues) +plt.semilogy() +plt.xlabel("k") +plt.ylabel("$\lambda_k$") +plt.title("Fredholm problem eigenvalues") +plt.grid("both") + +# %% + +scaledModes = KLResult.getScaledModesAsProcessSample() +graph = scaledModes.drawMarginal(0) +graph.setTitle('Modes de KL, chute visqueuse') +graph.setXTitle(r'$t$') +graph.setYTitle(r'$\varphi_k$') +leg = ot.Description([ 'Mode '+str(i +1) for + i in range(eigenValues.getDimension()) ]) +graph.setLegends(leg) +graph.setLegendPosition('topleft') +view=View(graph) + +# %% + +projectionFunction = ot.KarhunenLoeveProjection(KLResult) +sampleKsi = projectionFunction(outputFieldCentered) +sampleKsi = sampleKsi[:,:2] +cloud = ot.Cloud(sampleKsi) +graph = ot.Graph("Trajectories in the reduced space", "$\\xi_1$", "$\\xi_2$", True) +graph.add(cloud) +v= View(graph) +v.save("Reduced_Space.pdf") + +# %% +ot.ResourceMap.SetAsString("Contour-DefaultColorMap", "viridis") +ot.ResourceMap.SetAsBool("Contour-DefaultIsFilled", True) +ot.ResourceMap.SetAsUnsignedInteger("Contour-DefaultLevelsNumber", 15) + + +cov = KLResult.getCovarianceModel() + +# As a covariance function +isStationary = False +asCorrelation = False +graph = cov.draw(0, 0, tmin, tmax, 128, isStationary, asCorrelation) +graph.setTitle("Viscous free fall covariance") +v = View(graph)#, contour_kw={"levels": 50}) +v.save("Covariance.pdf") + +# %% + +# As a correlation function +asCorrelation = True +graph = cov.draw(0, 0, tmin, tmax, 128, isStationary, asCorrelation) +graph.setTitle("Viscous free fall correlation") +v = View(graph)#, contour_kw={"levels": 50}) +v.save("Correlation.pdf") + +# %% +# Copulas + + +R = ot.CorrelationMatrix(2) +R[1, 0] = 0.2 +c = ot.NormalCopula(R).drawPDF() +c.setTitle("Normal copula") +v = View(c, contour_kw={"vmin": 0.4, "vmax": 1.4}) +v.save("Copula1.pdf") + +# %% + +c = ot.ClaytonCopula().drawPDF() +c.setTitle("Clayton copula") +v = View(c, contour_kw={"vmin": 0.0, "vmax": 2.6}) +v.save("Copula2.pdf") + +# %% + + +c = ot.AliMikhailHaqCopula().drawPDF() +c.setTitle("AliMikhailHaq copula") +v = View(c, contour_kw={"vmin": 0.5, "vmax": 1.4}) +v.save("Copula3.pdf") + +# %% + +c = ot.GumbelCopula().drawPDF() +c.setTitle("Gumbel copula") +v = View(c, contour_kw={"vmin": 0.0, "vmax": 2.6}) +v.save("Copula4.pdf") + +# %% + +marg1 = ot.Gumbel(1.0, 0.0) +marg2 = ot.TruncatedNormal(0.0, 1.0, -2.0, 2.0) +joint = ot.JointDistribution([marg1, marg2]) +g = joint.drawPDF() +v = View(g, contour_kw={"vmin": 0.0, "vmax": 0.13}) +v.save("Dist.pdf") + +# %% +marg1 = ot.Gumbel(1.0, 0.0) +marg2 = ot.TruncatedNormal(0.0, 1.0, -2.0, 2.0) +copula = ot.GumbelCopula() +joint = ot.JointDistribution([marg1, marg2], copula) +graph = joint.drawPDF() +title = "Joint distribution " +title += "from marginals and copula" +graph.setTitle(title) +v = View(graph) +v.save("ComposedGumbel.pdf") + +# %% diff --git a/uncecomp2025/scripts/plot_chaos_conditional_expectation.py b/uncecomp2025/scripts/plot_chaos_conditional_expectation.py new file mode 100644 index 0000000..9adeb8d --- /dev/null +++ b/uncecomp2025/scripts/plot_chaos_conditional_expectation.py @@ -0,0 +1,390 @@ +""" +Conditional expectation of a polynomial chaos expansion +======================================================= + +This script is adapted from the example, but produces a better picture for slides. +""" + +# %% +import openturns as ot +import openturns.viewer as otv +from openturns.usecases import ishigami_function +import matplotlib.pyplot as plt + +# %% +# The next function creates a parametric PCE based on a +# given PCE and a set of indices. + + +# %% +def meanParametricPCE(chaosResult, indices): + """ + Return the parametric PCE of Y with given input marginals set to the mean. + + All marginal inputs, except those in the conditioning indices + are set to the mean of the input random vector. + + The resulting function is : + + g(xu) = PCE(xu, xnotu = E[Xnotu]) + + where xu is the input vector of conditioning indices, + xnotu is the input vector fixed indices and + E[Xnotu] is the expectation of the random vector of the components + not in u. + + Parameters + ---------- + chaosResult: ot.FunctionalChaosResult(inputDimension) + The polynomial chaos expansion. + indices: ot.Indices() + The indices of the input variables which are set to constant values. + + Returns + ------- + parametricPCEFunction : ot.ParametricFunction(reducedInputDimension, outputDimension) + The parametric PCE. + The reducedInputDimension is equal to inputDimension - indices.getSize(). + """ + inputDistribution = chaosResult.getDistribution() + if not inputDistribution.hasIndependentCopula(): + raise ValueError( + "The input distribution has a copula" "which is not independent" + ) + # Create the parametric function + pceFunction = chaosResult.getMetaModel() + xMean = inputDistribution.getMean() + referencePoint = xMean[indices] + parametricPCEFunction = ot.ParametricFunction(pceFunction, indices, referencePoint) + return parametricPCEFunction + + +# %% +# The next function creates a sparse PCE using least squares. + + +# %% +def computeSparseLeastSquaresFunctionalChaos( + inputTrain, + outputTrain, + multivariateBasis, + basisSize, + distribution, + sparse=True, +): + """ + Create a sparse polynomial chaos based on least squares. + + * Uses the enumerate rule in multivariateBasis. + * Uses the LeastSquaresStrategy to compute the coefficients based on + least squares. + * Uses LeastSquaresMetaModelSelectionFactory to use the LARS selection method. + * Uses FixedStrategy in order to keep all the coefficients that the + LARS method selected. + + Parameters + ---------- + inputTrain : ot.Sample + The input design of experiments. + outputTrain : ot.Sample + The output design of experiments. + multivariateBasis : ot.Basis + The multivariate chaos basis. + basisSize : int + The size of the function basis. + distribution : ot.Distribution. + The distribution of the input variable. + sparse: bool + If True, create a sparse PCE. + + Returns + ------- + result : ot.PolynomialChaosResult + The estimated polynomial chaos. + """ + if sparse: + selectionAlgorithm = ot.LeastSquaresMetaModelSelectionFactory() + else: + selectionAlgorithm = ot.PenalizedLeastSquaresAlgorithmFactory() + projectionStrategy = ot.LeastSquaresStrategy( + inputTrain, outputTrain, selectionAlgorithm + ) + adaptiveStrategy = ot.FixedStrategy(multivariateBasis, basisSize) + chaosAlgorithm = ot.FunctionalChaosAlgorithm( + inputTrain, outputTrain, distribution, adaptiveStrategy, projectionStrategy + ) + chaosAlgorithm.run() + chaosResult = chaosAlgorithm.getResult() + return chaosResult + + +# %% +# In the next cell, we create a training sample from the +# Ishigami test function. +# We choose a sample size equal to 1000. + +# %% +ot.Log.Show(ot.Log.NONE) +ot.RandomGenerator.SetSeed(0) +im = ishigami_function.IshigamiModel() +input_names = im.inputDistribution.getDescription() +sampleSize = 1000 +inputSample = im.inputDistribution.getSample(sampleSize) +outputSample = im.model(inputSample) + + +# %% +# We then create a sparce PCE of the Ishigami function using +# a candidate basis up to the total degree equal to 12. +# This leads to 455 candidate coefficients. +# The coefficients are computed from least squares. + +# %% +multivariateBasis = ot.OrthogonalProductPolynomialFactory([im.X1, im.X2, im.X3]) +totalDegree = 12 +enumerateFunction = multivariateBasis.getEnumerateFunction() +basisSize = enumerateFunction.getBasisSizeFromTotalDegree(totalDegree) +print("Basis size = ", basisSize) + +# %% +# Finally, we create the PCE. +# Only 61 coefficients are selected by the :class:`~openturns.LARS` +# algorithm. + +# %% +chaosResult = computeSparseLeastSquaresFunctionalChaos( + inputSample, + outputSample, + multivariateBasis, + basisSize, + im.inputDistribution, +) +print("Selected basis size = ", chaosResult.getIndices().getSize()) +chaosResult + + +# %% +# In order to see the structure of the data, we create a grid of +# plots which shows all projections of :math:`Y` versus :math:`X_i` +# for :math:`i = 1, 2, 3`. +# We see that the Ishigami function is particularly non linear. + +# %% +grid = ot.VisualTest.DrawPairsXY(inputSample, outputSample) +grid.setTitle(f"n = {sampleSize}") +view = otv.View(grid, figure_kw={"figsize": (8.0, 3.0)}) +plt.subplots_adjust(wspace=0.4, bottom=0.25) + +# %% +# Parametric function +# ~~~~~~~~~~~~~~~~~~~ +# +# We now create the parametric function where :math:`X_i` is free +# and the other variables are set to their mean values. +# We can show that a parametric PCE is, again, a PCE. +# The library does not currently implement this feature. +# In the next cell, we create it from the `meanParametricPCE` we defined +# previously. + +# %% +# Create different parametric functions for the PCE. +# In the next cell, we create the parametric PCE function +# where :math:`X_1` is active while :math:`X_2` and :math:`X_3` are +# set to their mean values. +indices = [1, 2] +parametricPCEFunction = meanParametricPCE(chaosResult, indices) +print(parametricPCEFunction.getInputDimension()) + + +# %% +# Now that we know how the `meanParametricPCE` works, we loop over +# the input marginal indices and consider the three functions +# :math:`\widehat{\model}_1(\inputReal_1)`, +# :math:`\widehat{\model}_2(\inputReal_2)` and +# :math:`\widehat{\model}_3(\inputReal_3)`. +# For each marginal index `i`, we we plot the output :math:`Y` +# against the input marginal :math:`X_i` of the sample. +# Then we plot the parametric function depending on :math:`X_i`. + +# %% +inputDimension = im.inputDistribution.getDimension() +npPoints = 100 +inputRange = im.inputDistribution.getRange() +inputLowerBound = inputRange.getLowerBound() +inputUpperBound = inputRange.getUpperBound() +# Create the palette with transparency +palette = ot.Drawable().BuildDefaultPalette(2) +firstColor = palette[0] +r, g, b, a = ot.Drawable.ConvertToRGBA(firstColor) +newAlpha = 64 +newColor = ot.Drawable.ConvertFromRGBA(r, g, b, newAlpha) +palette[0] = newColor +grid = ot.VisualTest.DrawPairsXY(inputSample, outputSample) +reducedBasisSize = chaosResult.getCoefficients().getSize() +# grid.setTitle( +# f"n = {sampleSize}, total degree = {totalDegree}, " +# f"basis = {basisSize}, selected = {reducedBasisSize}" +# ) +for i in range(inputDimension): + graph = grid.getGraph(0, i) + graph.setLegends(["Data"]) + graph.setXTitle(f"$x_{1 + i}$") + graph.setYTitle("y") + graph.setTickLocation(2) + # Set all indices except i + indices = list(range(inputDimension)) + indices.pop(i) + parametricPCEFunction = meanParametricPCE(chaosResult, indices) + xiMin = inputLowerBound[i] + xiMax = inputUpperBound[i] + curve = parametricPCEFunction.draw(xiMin, xiMax, npPoints).getDrawable(0) + curve.setLineWidth(2.0) + curve.setLegend(r"$PCE(x_i, x_{-i} = \mathbb{E}[X_{-i}])$") + graph.add(curve) + if i < inputDimension - 1: + graph.setLegends([""]) + else: + graph.setLegends(["", r"$PCE(x_i, x_{-i} = \mathbb{E}[X_{-i}])$"]) + graph.setColors(palette) + grid.setGraph(0, i, graph) + +grid.setLayout(3, 1) +# graph = grid.getGraph(1, 1) +# graph.add(ot.Cloud([[0.0, 0.0]])) +# graph.add(ot.Curve([[0.0]], [[0.0]])) +# #graph.setLegends(["Data", r"$PCE(x_i, x_{-i} = \mathbb{E}[X_{-i}])$"]) +# graph.setLegendPosition("left") +# grid.setGraph(1, 1, graph) +grid.setLegendPosition("bottomright") + +view = otv.View( + grid, + figure_kw={"figsize": (6.5, 6.5)}, + # legend_kw={"bbox_to_anchor": (-0.85, -0.6)}, +) +view.save("pce_conditional.png") +# view = otv.View(grid) +# plt.subplots_adjust(wspace=0.4, right=0.7, bottom=0.6) +# plt.savefig("pce_conditional.png") +# %% +# We see that the parametric function is located within each cloud, but +# sometimes seems a little vertically on the edges of the data. +# More precisely, the function represents well how :math:`Y` depends +# on :math:`X_2`, but does not seem to represent well how :math:`Y` +# depends on :math:`X_1` or :math:`X_3`. + +# %% +# Conditional expectation +# ~~~~~~~~~~~~~~~~~~~~~~~ + +# %% +# In the next cell, we create the conditional expectation function +# :math:`\Expect{\model(\inputReal) \; | \; \inputRV_1 = \inputReal_1}`. + +# %% +conditionalPCE = chaosResult.getConditionalExpectation([0]) +conditionalPCE + +# %% +# On output, we see that the result is, again, a PCE. +# Moreover, a subset of the previous coefficients are presented in this +# conditional expectation: only multi-indices which involve +# :math:`X_1` are presented (and the other marginal components are removed). +# We observe that the value of the coefficients are unchanged with respect to the +# previous PCE. + +# %% +# In the next cell, we create the conditional expectation function +# :math:`\Expect{\model(\inputReal) \; | \; \inputRV_2 = \inputReal_2, \inputRV_3 = \inputReal_3}`. + +# %% +conditionalPCE = chaosResult.getConditionalExpectation([1, 2]) +conditionalPCE + +# %% +# We see that the conditional PCE has input dimension 2. + + +# %% +# In the next cell, we compare the parametric PCE and the conditional +# expectation of the PCE. + +# sphinx_gallery_thumbnail_number = 3 +inputDimension = im.inputDistribution.getDimension() +npPoints = 100 +inputRange = im.inputDistribution.getRange() +inputLowerBound = inputRange.getLowerBound() +inputUpperBound = inputRange.getUpperBound() +# Create the palette with transparency +palette = ot.Drawable().BuildDefaultPalette(3) +firstColor = palette[0] +r, g, b, a = ot.Drawable.ConvertToRGBA(firstColor) +newAlpha = 64 +newColor = ot.Drawable.ConvertFromRGBA(r, g, b, newAlpha) +palette[0] = newColor +grid = ot.VisualTest.DrawPairsXY(inputSample, outputSample) +grid.setTitle(f"n = {sampleSize}, total degree = {totalDegree}") +for i in range(inputDimension): + graph = grid.getGraph(0, i) + graph.setLegends(["Data"]) + graph.setXTitle(f"$x_{1 + i}$") + xiMin = inputLowerBound[i] + xiMax = inputUpperBound[i] + # Set all indices except i to the mean + indices = list(range(inputDimension)) + indices.pop(i) + parametricPCEFunction = meanParametricPCE(chaosResult, indices) + # Draw the parametric function + curve = parametricPCEFunction.draw(xiMin, xiMax, npPoints).getDrawable(0) + curve.setLineWidth(2.0) + curve.setLineStyle("dashed") + curve.setLegend(r"$PCE\left(x_i, x_{-i} = \mathbb{E}[X_{-i}]\right)$") + graph.add(curve) + # Compute conditional expectation given Xi + conditionalPCE = chaosResult.getConditionalExpectation([i]) + print(f"i = {i}") + print(conditionalPCE) + conditionalPCEFunction = conditionalPCE.getMetaModel() + curve = conditionalPCEFunction.draw(xiMin, xiMax, npPoints).getDrawable(0) + curve.setLineWidth(2.0) + curve.setLegend(r"$\mathbb{E}\left[PCE | X_i = x_i\right]$") + graph.add(curve) + if i < inputDimension - 1: + graph.setLegends([""]) + graph.setColors(palette) + # Set the graph into the grid + grid.setGraph(0, i, graph) + +grid.setLegendPosition("topright") +view = otv.View( + grid, + figure_kw={"figsize": (8.0, 3.0)}, + legend_kw={"bbox_to_anchor": (1.0, 1.0), "loc": "upper left"}, +) +plt.subplots_adjust(wspace=0.4, right=0.7, bottom=0.25) + +# %% +# We see that the conditional expectation of the PCE is a better +# approximation of the data set than the parametric PCE. + +# %% +# Conclusion +# ~~~~~~~~~~ +# +# In this example, we have seen how to compute the conditional +# expectation of a PCE. +# We have seen that this function is a good approximation of the Ishigami +# function when we reduce the input dimension. +# We have also seen that the parametric PCE might be a poor +# approximation of the Ishigami function. +# This is because the parametric PCE depends on the particular value +# that we have chosen to create the parametric function. +# +# The fact that the conditional expectation of the PCE is a +# good approximation of the function when we reduce the input dimension +# is a consequence of a theorem which states that the +# conditional expectation is the best approximation of the +# function in the least squares sense (see [girardin2018]_ page 79). + +# %% +otv.View.ShowAll() diff --git a/uncecomp2025/uncecomp-2025-slides-OpenTURNS.tex b/uncecomp2025/uncecomp-2025-slides-OpenTURNS.tex new file mode 100644 index 0000000..7ddace0 --- /dev/null +++ b/uncecomp2025/uncecomp-2025-slides-OpenTURNS.tex @@ -0,0 +1,1664 @@ +% Copyright (C) 2024 - Joseph Muré + +\documentclass{beamer} + +%\setbeameroption{hide notes} +%\setbeameroption{show notes} +%\setbeameroption{show only notes} + +\input{macros} + +\usepackage[ +backend=biber, +style=alphabetic, +sorting=ynt +]{biblatex} + +\usepackage{tikz} +\usetikzlibrary{positioning} + +\renewcommand{\footnotesize}{\tiny} + +%\addbibresource{something.bib} + +\title[OpenTURNS]{Overview of OpenTURNS and its graphical user interface Persalys} + +\author[Mur\'e et al.]{ +J. Mur\'e \inst{1} \and +M. Baudin \inst{1} \and +J. Pelamatti \inst{1} \and \\ +J. Schueller \inst{2} \and +A. Marion \inst{2} +} + +\institute[EDF-Phim\'eca]{ +\inst{1} EDF R\&D. 6, quai Watier, 78401, Chatou Cedex - France, joseph.mure@edf.fr \and % +\inst{2} Phimeca Engineering. 18/20 boulevard de Reuilly, 75012 Paris - France, schueller@phimeca.com +} + + +\date[]{June 17th 2025, BEPU 2025, Rhodes Island, Greece} + +\definecolor{codegreen}{rgb}{0,0.6,0} +\definecolor{codegray}{rgb}{0.5,0.5,0.5} +\definecolor{codepurple}{rgb}{0.58,0,0.82} +\definecolor{backcolour}{rgb}{0.95,0.95,0.92} +\lstdefinestyle{mystyle}{ + backgroundcolor=\color{backcolour}, commentstyle=\color{codegreen}, + keywordstyle=\color{magenta}, + numberstyle=\tiny\color{codegray}, + stringstyle=\color{codepurple}, + basicstyle=\ttfamily\tiny, + breakatwhitespace=false, + breaklines=true, + captionpos=b, + keepspaces=true, + numbers=left, + numbersep=5pt, + showspaces=false, + showstringspaces=false, + showtabs=false, + tabsize=1, + numbers=none +} + +\lstset{style=mystyle, language=python} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + \begin{document} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + \begin{frame} + \titlepage + + \begin{columns} + \column{0.45\textwidth} + \begin{center} +\includegraphics[height=0.15\textheight]{figures/edf.jpg} +\end{center} + \column{0.1\textwidth} + + \column{0.45\textwidth} + \begin{center} +\includegraphics[height=0.15\textheight]{figures/logo_phimeca.png} +\end{center} + \end{columns} + + \end{frame} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% \begin{frame} +% \frametitle{Contents} +% \tableofcontents +% \end{frame} + +\AtBeginSection[ ] +{ + \begin{frame} + \frametitle{Contents} + \tableofcontents[currentsection] + \end{frame} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{OpenTURNS Overview} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame} +\frametitle{OpenTURNS: \url{www.openturns.org}} + + + \begin{center} + \includegraphics[width=0.8\textwidth]{figures/OT.pdf} + \begin{tabular}{ccccc} + \includegraphics[width=0.10\textwidth]{figures/logoEDF_Anne.png}& + \includegraphics[width=0.12\textwidth]{figures/LogoAirbus.png}& + \includegraphics[width=0.12\textwidth]{figures/logo_phimeca.png}& + %\includegraphics[width=0.12\textwidth]{figures/logo_Imacs.png} + \includegraphics[width=0.25\textwidth]{figures/logo_ONERA.jpg}& + \end{tabular} + \end{center} + +\begin{itemize} +% \item Multivariate probabilistic modeling including dependence +% \item Numerical tools dedicated to the treatment of uncertainties +\item Generic coupling to any type of physical model +\item Open source, LGPL licensed, C++/Python library +\item Linux, Windows, macOS. First release : 2007 +\item on average 4 full time developers +\end{itemize} + + +\end{frame} + +\note{ +OpenTURNS is software for uncertainty quantification, uncertainty propagation, +sensitivity analysis and metamodeling. + +It is available with the open source LGPL licence on Linux, Windows and macOS. + +In order to use OpenTURNS, you can use directly the C++ library, or +program your Python scripts. +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] + \frametitle{OpenTURNS: content} + + \begin{scriptsize} + + \begin{minipage}[t]{0.33\textwidth} + \begin{itemize} + \item Data analysis + \begin{itemize} + \tiny + \item Distribution fitting + \item Statistical tests + \item Estimate dependency and copulas + \item Estimate stochastic processes + \end{itemize} + \end{itemize} + \end{minipage}% + \begin{minipage}[t]{0.33\textwidth} + \begin{itemize} + \item Probabilistic modeling + \begin{itemize} + \tiny + \item Dependence modeling + \item Univariate distributions + \item Multivariate distrbutions + \item Copulas + \item \textbf{Conditional distributions} + \item Processes + \item Covariance kernels + \end{itemize} + \end{itemize} + \end{minipage}% + \begin{minipage}[t]{0.33\textwidth} + \begin{itemize} + \item Surrogate models + \begin{itemize} + \tiny + \item Linear regression + \item Polynomial chaos expansion + \item Gaussian process regression + \item Spectral methods + \item Low rank tensors + \item Fields metamodel + \end{itemize} + \end{itemize} + \end{minipage} + + \vspace{20pt} + + \begin{minipage}[t]{0.33\textwidth} + \begin{itemize} + \item Reliability, sensitivity + \begin{itemize} + \tiny + \item Sampling methods + \item Approximation methods + \item Sensitivity analysis + \item Design of experiments + \end{itemize} + \end{itemize} + \end{minipage}% + \begin{minipage}[t]{0.33\textwidth} + \begin{itemize} + \item Calibration + \begin{itemize} + \tiny + \item Least squares calibration + \item Gaussian calibration + \item Bayesian calibration + \end{itemize} + \end{itemize} + \end{minipage}% + \begin{minipage}[t]{0.33\textwidth} + \begin{itemize} + \item Numerical methods + \begin{itemize} + \tiny + \item Optimization + \item Integration + \item Least squares + \item Meshing + \item Coupling with external codes + \end{itemize} + \end{itemize} + \end{minipage} + \end{scriptsize} + + \begin{tabular}{@{}c@{}c@{}c@{}c@{}c@{}} + \includegraphics[width=0.2\textwidth]{figures/plot_kriging.png}& + \includegraphics[width=0.2\textwidth]{figures/plot_random_walk.png}& + \includegraphics[width=0.2\textwidth]{figures/plot_sobol_field.png}& + \includegraphics[width=0.2\textwidth]{figures/plot_monte_carlo.png}& + \includegraphics[width=0.2\textwidth]{figures/plot_distribution_fitting.png} + \end{tabular} +\end{frame} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] + \frametitle{OpenTURNS: documentation} + + \small{ + + \begin{columns} + \column{0.5\textwidth} + + \begin{center} + \includegraphics[width=0.8\textwidth]{figures/exClasses.png} + \end{center} + + \column{0.5\textwidth} + + \begin{itemize} + \item \underline{Content}: + \begin{itemize} + \item Programming interface (API) + \item Examples + \item Theory + \end{itemize} + \item \emph{All} classes and methods + are documented, partly automatically. + \item Examples are automatically tested at \emph{each} update + of the code and outputs are checked. + \end{itemize} + + \end{columns} + + } +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] + \frametitle{OpenTURNS features} + + \small + \begin{itemize} + \item C++ and Python interface + \vspace{10pt} + \item Parallel computations with shared memory + \vspace{10pt} + \item Optimized linear algebra with LAPACK and BLAS + \vspace{10pt} + \item Possibility to interface with a SLURM-based HPC cluster now made easier with the helper library \emph{othpc} available at \url{https://github.com/openturns/othpc} (soon to be published as a pip/conda package) + \vspace{10pt} + % \item Focused towards handling numerical data + % \vspace{10pt} + \item Installation through conda, pip, packages for various Linux distributions and source code + \item + \begin{lstlisting}[language=Python, numbers = none] +import numpy as np +import openturns as ot +from openturns.viewer import View +ot.ResourceMap.SetAsString("Contour-DefaultColorMap", "viridis") +ot.ResourceMap.SetAsBool("Contour-DefaultIsFilled", True) +ot.ResourceMap.SetAsUnsignedInteger("Contour-DefaultLevelsNumber", 15) +\end{lstlisting} + \end{itemize} + + +\end{frame} + + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% \begin{frame}[containsverbatim] +% \frametitle{Coupling OpenTURNS with computer codes} + +% \small + +% OpenTURNS provides a text file exchange based interface in order to perform UQ analysis of complex computer codes. + +% \vspace{10pt} + +% \begin{columns} +% \column{0.6\textwidth} + +% \centering + +% \includegraphics[width=1.\textwidth]{figures/Coupling.pdf} + +% \column{0.4\textwidth} + +% \begin{itemize} +% \item Replaces the need for input/output text parsers +% \item Wraps a simulation model as a standard python function +% \item \href{https://openturns.github.io/otwrapy/master/index.html}{otwrapy}: interfacing tool to allow easy parallelization +% \item Allows to interface OpenTURNS with a cluster (now easier with \textit{othpc}) +% \end{itemize} + +% \end{columns} + +% \end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%% GENERAL OPENTURNS PRESENTATION %%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] +\frametitle{Probabilistic modeling} + + +% \underline{Random variables distributions}: + +\small + +\begin{minipage}[t]{0.47\textwidth} + +Gumbel(scale=558, mode=1013) + +truncated to $[0, +\infty)$ + + \hspace{-0.5cm}\includegraphics[width=\textwidth]{figures/Q.png} + +% \tiny +\begin{lstlisting}[language=Python] +d = ot.Gumbel(558.0, 1013.0) +tr = ot.TruncatedDistribution.LOWER +Q = ot.TruncatedDistribution(d, 0.0, tr) +\end{lstlisting} + +\end{minipage}% +\begin{minipage}[t]{0.47\textwidth} + +Normal(mean=30, std=7.5) + +truncated to $[0, +\infty)$ + + \hspace{-0.5cm}\includegraphics[width=\textwidth]{figures/Ks.png} + + % \tiny +\begin{lstlisting}[language=Python] +d = ot.Normal(30.,7.5) +tr = ot.TruncatedDistribution.LOWER +Ks = ot.TruncatedDistribution(d, 0.0, tr) + +\end{lstlisting} + +\end{minipage} +% \begin{minipage}[t]{0.5\textwidth} + +% Zv: Uniform(min=49, max=51) + +% \includegraphics[width=.45\textwidth]{figures/Zv.png} + +% % \end{minipage}% +% % \begin{minipage}[t]{0.5\textwidth} + +% Zm: Uniform(min=54, max=56) + +% \includegraphics[width=.45\textwidth]{figures/Zm.png} + +% \end{minipage}% + +\end{frame} + + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] +\frametitle{Probabilistic modeling} + +% \scriptsize{ + +% \begin{itemize} +% \item +We consider a 2-dimensional distribution with the following marginals: +\begin{itemize} +% \tiny +\item Gumbel(scale = 1, mode = 0) +\item Truncated normal (mean = 0, std = 1, min = -2, max = 2) +\end{itemize} +% \end{itemize} + +\begin{columns} + \column{0.35\textwidth} + +\underline{Marginals} + + \includegraphics[width=0.8\textwidth]{figures/Marg1.pdf} + + \includegraphics[width=0.8\textwidth]{figures/Marg2.pdf} + + + \column{0.6\textwidth} + +\underline{Joint distribution} + + \includegraphics[width=\textwidth]{figures/Dist.pdf} + + +\end{columns} + +% } + +\end{frame} + + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] +\frametitle{Beyond independent marginals: Copulas} + +\begin{minipage}[t]{0.5\textwidth} + \includegraphics[width=.85\textwidth]{figures/Copula1.pdf} + +\end{minipage}% +\begin{minipage}[t]{0.5\textwidth} + \includegraphics[width=.85\textwidth]{figures/Copula2.pdf} + +\end{minipage} +\begin{minipage}[t]{0.5\textwidth} + \includegraphics[width=.85\textwidth]{figures/Copula3.pdf} + +\end{minipage}% +\begin{minipage}[t]{0.5\textwidth} + \includegraphics[width=.85\textwidth]{figures/Copula4.pdf} + +\end{minipage} + +\end{frame} + + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] +\frametitle{Composing marginal distributions and copulas} + +\begin{columns} + \column{0.45\textwidth} + +\begin{minipage}[t]{1.\textwidth} + \includegraphics[width=.9\textwidth]{figures/Dist.pdf} + +\end{minipage} + +\begin{minipage}[t]{1.\textwidth} + \includegraphics[width=.9\textwidth]{figures/Copula4.pdf} + +\end{minipage} + + \column{0.55\textwidth} + +% \underline{We obtain:} + \includegraphics[width=\textwidth]{figures/ComposedGumbel.pdf} + + + +\tiny +\begin{lstlisting}[language=Python, numbers = none] +marg1 = ot.Gumbel(1.0, 0.0) +marg2 = ot.TruncatedNormal(0.0, 1.0, -2.0, 2.0) +copula = ot.GumbelCopula() +joint = ot.JointDistribution([marg1, marg2], copula) +graph = joint.drawPDF() +title = "Joint distribution " +title += "from marginals and copula" +graph.setTitle(title) +\end{lstlisting} + +\end{columns} + +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\begin{frame}[containsverbatim] +\frametitle{New feature: Joint distribution defined from conditionals} + +\begin{columns} + \column{0.32\textwidth} + +\begin{align} +Y | X &\sim \mathcal{N}(X, 0.1 + X^2) \nonumber \\ +X &\sim \mathcal{N}(0, 1) \nonumber +\end{align} + + + \column{0.65\textwidth} + + \includegraphics[width=\textwidth]{figures/JointByConditioning.pdf} + + + +\tiny + + +\end{columns} +\vspace{-0.3cm} +\begin{lstlisting}[language=Python, numbers = none] +Xdist = ot.Normal(0.0, 1.0) +f = ot.SymbolicFunction(["x"],["x", "0.1 + x^2"]) +Ycond = ot.Normal() +XYdist = ot.JointByConditioningDistribution(Ycond, Xdist, f) +ot.ResourceMap.SetAsString("Contour-DefaultColorMapNorm", "rank") +graph = XYdist.drawPDF() +graph.setTitle("") +graph.setXTitle("X") +graph.setYTitle("Y|X") +\end{lstlisting} + +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] +\frametitle{Extract the copula} + +\begin{columns} + \column{0.32\textwidth} + + \includegraphics[width=\textwidth]{figures/JointByConditioning.pdf} + + + + \column{0.65\textwidth} + + \includegraphics[width=\textwidth]{figures/ExtractedCopula.pdf} + + + +\tiny + + +\end{columns} +\vspace{-0.3cm} +\begin{lstlisting}[language=Python, numbers = none] +copula = XYdist.getCopula() +ot.ResourceMap.SetAsString("Contour-DefaultColorMapNorm", "linear") +graph = copula.drawPDF() +graph.setTitle("Extracted copula") +\end{lstlisting} + +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] +\frametitle{New feature: Conditional from joint distribution} + +\begin{columns} + \column{0.40\textwidth} + +\begin{align} +Y | X &\sim \mathcal{N}(X, 0.1 + X^2) \nonumber \\ +X &\sim \mathcal{N}(0, 1) \nonumber +\end{align} + + \includegraphics[width=\textwidth]{figures/ConditioningLine.pdf} + \column{0.56\textwidth} + + +$$ +X | Y \sim \; ? +$$ + + \includegraphics[width=\textwidth]{figures/PointConditional.pdf} + + + + +\end{columns} + +\begin{lstlisting}[language=Python, numbers = none] +from openturns.experimental import PointConditionalDistribution +cond_dist = PointConditionalDistribution(XYdist, [1], [-0.5]) # Y is set to -0.5 +graph = cond_dist.drawPDF(-4.0, 4.0) +graph.setXTitle(""); graph.setYTitle(""); graph.setLegends([""]) +graph.setTitle("PDF of X | Y = -0.5") +\end{lstlisting} + +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] +\frametitle{New feature: Compound distribution} + +\begin{columns} + \column{0.40\textwidth} + +\begin{align} +Y | X &\sim \mathcal{N}(X, 0.1 + X^2) \nonumber \\ +X &\sim \mathcal{N}(0, 1) \nonumber +\end{align} + + \includegraphics[width=\textwidth]{figures/JointByConditioning.pdf} + \column{0.56\textwidth} + + +$$ +Y \sim \; ? +$$ + + \includegraphics[width=\textwidth]{figures/Deconditioned.pdf} + + + + +\end{columns} + +\begin{lstlisting}[language=Python, numbers = none] +Ydist = ot.DeconditionedDistribution(Ycond, Xdist, f) # Compound distribution +graph = Ydist.drawPDF(-4.0, 4.0, 1000) # draw from -4 to 4 with 1000 points +graph.setLegends([""]); graph.setXTitle(""); graph.setYTitle(""); graph.setTitle("") +\end{lstlisting} + +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] +\frametitle{New feature: Posterior distribution} +\vspace{-0.5cm} +\begin{align} +Y_1,...,Y_n | X &\sim_{iid} \mathcal{N}(X, 0.1 + X^2) \tag{likelihood} \label{eq_likelihood}\\ +X &\sim \mathcal{N}(0, 1) \tag{prior} \\ +X | Y_1,...,Y_n &\sim \; ? \tag{posterior} \label{eq_posterior} +\end{align} +\begin{columns} + \column{0.45\textwidth} + +Setting $X=1$, sample $Y_1,...,Y_{20}$ according to \eqref{eq_likelihood}. + +\begin{lstlisting}[language=Python, numbers = none] +X = 1.0 +# for reproducibility +ot.RandomGenerator.SetSeed(0) + +Ysam=ot.Normal(X,0.1+X**2).getSample(20) +\end{lstlisting} + +Draw the PDF of \eqref{eq_posterior}. + +\begin{lstlisting}[language=Python, numbers = none] +from openturns.experimental import PosteriorDistribution +post = PosteriorDistribution(Ydist,Ysam) +graph = post.drawPDF(0.0, 2.0) +graph.setXTitle("");graph.setYTitle(""); +graph.setTitle("") +graph.setLegends([""]) +\end{lstlisting} +\column{0.55\textwidth} + + +% \begin{equation} +% X | Y_1,...,Y_n \sim \; ? \tag{posterior} \label{eq_posterior} +% \end{equation} + + \includegraphics[width=\textwidth]{figures/Posterior.pdf} + + + + +\end{columns} + +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] +\frametitle{Design of experiments} + +\scriptsize{ + +\begin{columns} + \column{0.5\textwidth} + + \includegraphics[width=1.\textwidth]{figures/DOE.pdf} + + \column{0.5\textwidth} + +\tiny + +\begin{lstlisting}[language=Python, numbers = none] +dim = 2 +X=[ot.Gumbel(),ot.TruncatedNormal(0,1,-2,2)] +dist = ot.JointDistribution(X) +bounds = dist.getRange() +sampleSize = 100 + +sample1 = dist.getSample(sampleSize) + +experiment = ot.LHSExperiment(dist, + sampleSize, False, False) +sample2 = experiment.generate() + +lhs = ot.LHSExperiment(dist, sampleSize) +lhs.setAlwaysShuffle(True) # randomized +space_filling = ot.SpaceFillingC2() +temperatureProfile = ot.GeometricProfile(10.0, 0.95, 1000) +algo = ot.SimulatedAnnealingLHS(lhs, + space_filling, temperatureProfile) +sample3 = algo.generate() + +sequence = ot.SobolSequence(dim) # or Halton +experiment = ot.LowDiscrepancyExperiment( + sequence, dist, sampleSize, False) +sample4 = experiment.generate() + +\end{lstlisting} + +\end{columns} + +} + +\end{frame} + + + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] +\frametitle{Monte-Carlo sampling} + +% \scriptsize{ + +\begin{columns} + \column{0.45\textwidth} + +\begin{itemize} +\item The input distribution and relative output value are evaluated 10000 times. +\item The output distribution can be infered as a parametric function or through histogram or kernel smoothing methods. +\end{itemize} + + \includegraphics[width=1.\textwidth]{figures/S.png} + + \column{0.55\textwidth} + +\tiny +\begin{lstlisting}[language=Python, numbers = none] +distribution = ot.JointDistribution([Q,Ks,Zv,Zm]) + +#Python model +def floodFunction(X): + Q, Ks, Zv, Zm = X + alpha = (Zm - Zv)/5.0e3 + H = (Q/(300.0*Ks*np.sqrt(alpha)))**0.6 + S = [H + Zv - 58.5] + return S + +fun = ot.PythonFunction(4,1,floodFunction) + +#We define the output as a random vector +inputVector = ot.RandomVector(distribution) +outputVector = ot.CompositeRandomVector(fun, inputVector) + +#We sample and infere the output distribution +size = 10000 +sampleY = outputVector.getSample(size) +hist = ot.HistogramFactory().build(sampleY) +graph = hist.drawPDF() +distKS = ot.KernelSmoothing().build(sampleY) +graph2 = distKS.drawPDF() + +\end{lstlisting} + + +\end{columns} + + +% } + + + +\end{frame} + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] +\frametitle{New feature: Quantile confidence intervals} + + +Let $(X^{(1)} \dots, X^{(N)})$ be order statistics of +a random variable $X$: $X^{(1)} \leq \dots \leq X^{(N)}$. + +Given the quantile level $\alpha \in [0,1]$ and the confidence level +$\beta \in [0,1]$, we seek ranks $1 \leq k \leq k' \leq N$ such that the quantile $x_\alpha$ of $X$ verifies: +$$ + \mathbb{P}\left(X^{(k)} \leq x_{\alpha} \leq X^{(k')}\right) \geq \beta. +$$ + +Bilateral quantile confidence interval: +\begin{lstlisting}[language=Python, numbers = none] +from openturns.experimental import QuantileConfidence +n = 400; alpha = 0.05; beta = 0.95 +q = QuantileConfidence(alpha, beta) +i_n, j_n = q.computeBilateralRank(n) +ot.RandomGenerator.SetSeed(0) +sam = ot.Gumbel().getSample(n) +bci = q.computeBilateralConfidenceInterval(sam) +print(f"ranks={[i_n, j_n]} CI={bci}") + +Out: ranks=[11, 28] CI=[-1.36431, -0.981749] +\end{lstlisting} + +Unilateral quantile confidence interval: +\begin{lstlisting}[language=Python, numbers = none] +k_n = q.computeUnilateralRank(n, True) # True means we want a finite lower bound +uci = q.computeUnilateralConfidenceInterval(sam, True) +print(f"rank={k_n} CI={uci}") + +Out: rank=12 CI=[-1.35859, (1.79769e+308) +inf[ +\end{lstlisting} + +\end{frame} + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\begin{frame}[containsverbatim] +\frametitle{Distribution and dependence inference} + +% \scriptsize{ + +\begin{columns} + \column{0.5\textwidth} + + \includegraphics[width=\textwidth]{figures/Inference.pdf} + + + + \column{0.5\textwidth} + +\vspace{-0.5cm} +% \scriptsize + + + \begin{itemize} + \item Parametric ($1d - Nd$) distribution inference + \item Non-parametric ($1d - Nd$) distribution inference + \item Parametric copula inference + \item Non-parametric copula inference (Bernstein copula) + \item Resampling from inferred distributions + \end{itemize} + +\end{columns} + + +% } + +\begin{lstlisting}[language=Python, numbers = none] +samY = outputVector.getSample(100) +graph=ot.KernelSmoothing(ot.Normal()).build(samY).drawPDF() +distKS = ot.KernelSmoothing(ot.Triangular()).build(samY) +graph2 = distKS.drawPDF() +graph.add(graph2) +distKS = ot.KernelSmoothing(ot.Epanechnikov()).build(samY) +graph2 = distKS.drawPDF() +graph.add(graph2) +distKS = ot.KernelSmoothing(ot.Uniform()).build(samY) +graph2 = distKS.drawPDF() + +\end{lstlisting} +\end{frame} + +% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% \begin{frame}[containsverbatim] +% \frametitle{Iterative Monte-Carlo: Central tendency anaysis} + +% \scriptsize{ + +% \begin{columns} +% \column{0.44\textwidth} + +% \begin{itemize} +% \item The expected value and associated standard deviation are computed iteratively +% \item Different stopping criteria can be used +% \item Batch computation can be used +% \end{itemize} + +% \includegraphics[width=.95\textwidth]{figures/Expectation.png} + +% \column{0.56\textwidth} + +% \footnotesize +% \begin{eqnarray*} +% \widehat{m}_y & = & \frac{1}{N}\sum_1^N G(\mathbf{X}_i) \\ +% \widehat{\sigma}_y & = & \sqrt{\frac{1}{N}\sum_1^N (G(\mathbf{X}_i)-\hat{m}_y)^2} \\ +% \widehat{\sigma}_{m_y} & = & \widehat{\sigma}_y / \sqrt{N} +% \end{eqnarray*} + + +% \tiny +% \begin{lstlisting}[language=Python, numbers = none] +% algo = ot.ExpectationSimulationAlgorithm(outputVector) +% algo.setMaximumOuterSampling(100000) +% algo.setBlockSize(1) +% algo.setCoefficientOfVariationCriterionType("MAX") +% algo.setMaximumCoefficientOfVariation(0.01) +% algo.run() +% graph = algo.drawExpectationConvergence() +% \end{lstlisting} + + +% \end{columns} + +% } + +% \end{frame} + +% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% \begin{frame}[containsverbatim] +% \frametitle{Iterative Monte-Carlo: Reliability analysis} + +% \scriptsize{ + +% \begin{columns} +% \column{0.5\textwidth} + +% \begin{itemize} +% \item We now consider the probability of flooding: ($P(S>0.)$) +% \item Same as before, but the function $\mathbb{I}_{G(\mathbf{X}_i)>0} $ is considered +% \end{itemize} + +% \includegraphics[width=1.\textwidth]{figures/Probability.png} + +% \column{0.5\textwidth} + + +% \footnotesize +% \begin{eqnarray*} +% \widehat{p}_y & = & \frac{1}{N}\sum_1^N \mathbb{I}_{G(\mathbf{X}_i)>0} \\ +% \widehat{\sigma} & = & \sqrt{\frac{1}{N}\sum_1^N (\mathbb{I}_{G(\mathbf{X}_i)>0}-\hat{p}_y)^2} \\ +% \widehat{\sigma}_{p_y} & = & \widehat{\sigma} / \sqrt{N} +% \end{eqnarray*} + +% \tiny +% \begin{lstlisting}[language=Python, numbers = none] + +% eventF = ot.ThresholdEvent(outputVector, ot.GreaterOrEqual(), 0.0) +% exp = ot.MonteCarloExperiment() +% algo = ot.ProbabilitySimulationAlgorithm(eventF, exp) +% algo.setMaximumOuterSampling(100000) +% algo.setMaximumCoefficientOfVariation(0.01) +% algo.setBlockSize(10) +% algo.run() + + +% \end{lstlisting} + + +% \end{columns} + +% } + +% \end{frame} + + +% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% \begin{frame}[containsverbatim] +% \frametitle{FORM/SORM reliability analysis} + +% \scriptsize{ + +% \begin{columns} +% \column{0.5\textwidth} + +% \begin{itemize} + +% \item We estimate the probability of flooding through FORM/SORM procedures + +% \vspace{10pt} + +% \item MC estimation requires $\simeq$ 1500 function evaluations +% \item FORM and SORM only use $\simeq 150$ +% \end{itemize} + +% \begin{block}{} +% \begin{itemize} +% \item Estimated probability: +% \begin{itemize} +% \tiny +% \item MC: 5.09999999999998 1e-4 +% \item FORM: 5.340929030055227 1e-4 +% \item SORM: 6.793780433482759 1e-4 +% \end{itemize} +% \end{itemize} +% \end{block} + +% \column{0.5\textwidth} + +% \tiny +% \begin{lstlisting}[language=Python, numbers = none] +% #FORM +% OptAlgo = ot.Cobyla() +% startingPoint = Distribution.getMean() +% algoFORM = ot.FORM(OptAlgo, eventF, +% startingPoint) +% algoFORM.run() + +% #SORM +% OptAlgo = ot.Cobyla() +% startingPoint = Distribution.getMean() +% algoSORM = ot.SORM(OptAlgo, eventF, +% startingPoint) +% algoSORM.run() +% \end{lstlisting} + +% \scriptsize + +% \vspace{20pt} + +% \textcolor{red}{Different types and parameterizations of finite difference gradient computation are available} + +% \end{columns} + +% \textbf{Also:} + +% \begin{itemize} +% \item Directional sampling +% \item Importance sampling (FORM-IS, NAIS, Adaptive IS-Cross-entropy) +% \item Subset sampling +% \end{itemize} +% } + +% \end{frame} + + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +\begin{frame} +\frametitle{Sensitivity analysis} + +\begin{minipage}[c]{0.6\textwidth} + + +Various sensitivity analysis methods are available +\begin{itemize} +\item Graphical analysis +\begin{itemize} +\item Pair plots +\item Parallel coordinates plots +\item Cross-cuts +\end{itemize} +\vspace{15pt} +\item Quantitative indices +\begin{itemize} +\item SRC, SRRC, PRC, PRCC +\item Sobol' indices (multiple estimators) +\item FAST indices +\item ANCOVA indices +\item HSIC indices +\item Shapley Indices (available as a separate library: \emph{otshapley}) + +\end{itemize} +\end{itemize} + +\end{minipage}% +\begin{minipage}[c]{0.45\textwidth} +\includegraphics[width=1.\textwidth]{figures/SobolEx.png} +\end{minipage} + +\end{frame} + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +\begin{frame} +\frametitle{Sensitivity analysis: Parallel coordinates plot} + +\centering +\includegraphics[width=.8\textwidth]{figures/CobwebOT.png} + + +\end{frame} + +%********************************************************************% +\begin{frame} +\frametitle{Sensitivity analysis: HSIC indices and associated p-values} + + + \begin{columns} + \column{0.49\textwidth} + +\includegraphics[width=.9\textwidth]{figures/plot_pval_GSA_MDTE.pdf} + +\centering +\small GSA-oriented screening. + + \column{0.49\textwidth} + +\includegraphics[width=.9\textwidth]{figures/plot_pval_TSA_MDTE.pdf} + +\centering +\small TSA-oriented screening. + +\end{columns} + + +\end{frame} + +%********************************************************************% + + + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] +\frametitle{Surrogate models} + +\begin{minipage}[t]{0.5\textwidth} + +\small +\begin{itemize} + +% \item Different surrogate modeling methods are available +% \begin{itemize} +% \tiny +% \item Gaussian process regression +% \item Polynomial chaos expansion +% \item Linear regression \& step-wise basis selection +% \item Low rank tensors +% \item automatic validation tools +% \end{itemize} + +\item Polynomial chaos expansion +% \begin{itemize} +% \small +% \item +% \end{itemize} +\vspace{0.5cm} +\hspace{-1.2cm} \includegraphics[width=\textwidth]{figures/pce_conditional.png} + +\item PCE highlight: extract the conditional expectation with respect to any variables + +\end{itemize} + +\end{minipage}% +\begin{minipage}[t]{0.5\textwidth} + +\small +\begin{itemize} +\item Gaussian process regression + +\hspace{-1cm} \includegraphics[width=\textwidth]{figures/Kriging.pdf} +% \begin{itemize} +% \tiny +% \item Different types of covariance functions and function basis can be used +% \item User-defined options are also available +% \item MLE optimization can be parameterized +% \item Large number of optimization algorithms available +% \end{itemize} +\end{itemize} + +\tiny +\begin{lstlisting}[language=Python, numbers = none] +import openturns.experimental as exp +inputSample = Distribution.getSample(100) +outputSample = fun(inputSample) +basis = ot.ConstantBasisFactory(1).build() +covarianceModel = ot.MaternModel() + +fit = exp.GaussianProcessFitter(inputSample, outputSample, covarianceModel, basis) +fit.run() +fitted = fit.getResult() +algo = exp.GaussianProcessRegression(fitted) +algo.run() +result = algo.getResult() +surrogate = result.getMetaModel() +\end{lstlisting} + +\end{minipage} + +\end{frame} + + + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] +\frametitle{Optimization} + + +\begin{itemize} +\item OpenTURNS provides an interface with several optimization libraries +\begin{itemize} +\item Bonmin +\item NLopt +\item dlib +\item pagmo +\end{itemize} + +%\item Ad-hoc implementation of the COBYLA algorithm + +\vspace{6pt} + + +\item Constrained and unconstrained optimization +\item Gradient-based and derivative-free optimizaiton +\item Bounded and unbounded optimization +\item Single and multi-objective optimization +\item Multi-start wrapper + + +\end{itemize} + + +\end{frame} + + + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] +\frametitle{Field function modeling} + +\scriptsize +\begin{columns} + \column{0.45\textwidth} + + \includegraphics[width=1.\textwidth]{figures/Trajectories.pdf} + +\column{0.55\textwidth} + +\tiny +\begin{lstlisting}[language=Python, numbers = none] +def free_fall(X): + g = 9.81 + z0,v0,m,c = X + tau=m/c + vinf=-m*g/c + t = np.array(mesh.getVertices().asPoint()) + z=z0+vinf*t+tau*(v0-vinf)*(1-np.exp(-t/tau)) + z=np.maximum(z,0.0) + return ot.Field(mesh, z.reshape(-1, 1)) + +tmin=0. +tmax=12. +gridsize=100 +mesh = ot.IntervalMesher([gridsize-1]).build( +ot.Interval(tmin, tmax)) + +alti = ot.PythonPointToFieldFunction(4, mesh, 1, free_fall) + +distZ0 = ot.Uniform(50.0, 200.0) +distV0 = ot.Normal(55.0, 10.0) +distM = ot.Normal(80.0, 8.0) +distC = ot.Uniform(0.0, 30.0) +distX = ot.JointDistribution([distZ0, distV0, + distM, distC]) + +size = 100 +inputSample = distX.getSample(size) +outputField = alti(inputSample) +\end{lstlisting} + +\end{columns} +\end{frame} + + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] +\frametitle{Dimension reduction: Karhunen-Loeve decomposition} + +\small +\begin{itemize} +\item We wish to reduce the dimension of the problem from a infinite dimensional output to a finite dimensional one. +\item We can perform a Karhunen-Loeve decomposition with finite truncature. +\item This requires to solve a Fredholm's problem in order to identify the eigenfunctions and associated eigenvalues of the considered process. +\end{itemize} + +\vspace{-0.3cm} +\begin{equation*} +% Y(\omega, \underline{t}) = \sum_{k=1}^{\infty} \sqrt{\lambda_k} \xi_k(\omega)\underline{\varphi}_k(\underline{t}) \rightarrow +\tilde{Y}(\omega, \underline{t}) = \sum_{k=1}^{p} \sqrt{\lambda_k} \xi_k(\omega)\underline{\varphi}_k(\underline{t}) +\end{equation*} + +\begin{columns} + \column{0.48\textwidth} + + \includegraphics[width=\textwidth]{figures/EigenValues.pdf} + +\column{0.52\textwidth} + +\tiny +\begin{lstlisting}[language=Python, numbers = none] +meanField = outputField.computeMean() +meanFunc = ot.P1LagrangeEvaluation(meanField) +trend = ot.TrendTransform(meanFunc, mesh) +invTrend = trend.getInverse() +outputFieldCentered = invTrend(outputField) + +truncThreshold = 1.0e-5 +algo = ot.KarhunenLoeveSVDAlgorithm(outputFieldCentered, truncThreshold) +algo.run() +KLResult = algo.getResult() + +eigenValues = KLResult.getEigenvalues() +\end{lstlisting} + +\end{columns} + + +\end{frame} + + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] +\frametitle{Dimension reduction: Karhunen-Loeve decomposition} + +\scriptsize + +\begin{equation*} +\tilde{Y}(\omega, \underline{t}) = \sum_{k=1}^{p} \sqrt{\lambda_k} \xi_k(\omega)\underline{\varphi}_k(\underline{t}) +\end{equation*} + +Main modes: + +\begin{columns} + \column{0.5\textwidth} + + \includegraphics[width=1.\textwidth]{figures/Modes.pdf} + +\column{0.5\textwidth} + +\tiny +\begin{lstlisting}[language=Python, numbers = none] +scaledModes = + KLResult.getScaledModesAsProcessSample() +graph = scaledModes.drawMarginal(0) +graph.setTitle('Modes de KL, chute visqueuse') +graph.setXTitle(r'$t$') +graph.setYTitle(r'$\varphi_k$') +leg = ot.Description([ 'Mode '+str(i +1) for + i in range(eigenValues.getDimension()) ]) +graph.setLegends(leg) +graph.setLegendPosition('topleft') +view=View(graph) +\end{lstlisting} + +\end{columns} + + +\end{frame} + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] +\frametitle{Dimension reduction: Karhunen-Loeve decomposition} + + +We only consider the first 2 terms of the decomposition: + +\centering +\includegraphics[width=.7\textwidth]{figures/Reduced_Space.pdf} + +\begin{lstlisting}[language=Python, numbers = none] +projectionFunction = ot.KarhunenLoeveProjection(KLResult) +sampleKsi = projectionFunction(outputFieldCentered) +sampleKsi = sampleKsi[:,:2] +\end{lstlisting} + +\end{frame} + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame}[containsverbatim] +\frametitle{Field function analysis} + +\scriptsize + +We center the trajectories with respect to the mean field: + +\begin{minipage}[t]{0.5\textwidth} + \includegraphics[width=\textwidth]{figures/Covariance.pdf} +\end{minipage}% +\begin{minipage}[t]{0.5\textwidth} + \includegraphics[width=\textwidth]{figures/Correlation.pdf} +\end{minipage} + + +\begin{lstlisting}[language=Python, numbers = none] +cov = KLResult.getCovarianceModel() + +# As a covariance function +isStationary = False +asCorrelation = False +graph = cov.draw(0, 0, tmin, tmax, 128, isStationary, asCorrelation) + +# As a correlation function +asCorrelation = True +graph = cov.draw(0, 0, tmin, tmax, 128, isStationary, asCorrelation) +\end{lstlisting} +\end{frame} + + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%% PERSALYS %%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Persalys Overview} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{frame}{Project overview} + \begin{itemize} + \item + Partnership between EDF and Phimeca since 2015 + + \begin{itemize} + \item + Developed in C++ using Qt + \item + Aiming at maximizing the use of OpenTURNS - through a dedicated GUI + - for engineers/researchers without a strong coding experience + \item + As easy to use as possible while providing the user with help and + guidelines + \item + Benefit from the advanced visualization capability of + Paraview + \end{itemize} + \end{itemize} + \end{frame} + + \begin{frame}{} + \protect\hypertarget{section}{} + \begin{itemize} + + \item + Features: + + \begin{itemize} + + \item + Uncertainty quantification: + \item + Probabilistic model definition + \item + Distribution fitting + \item + Probability estimate + \item + Metamodeling + \item + Screening + \item + Optimization + \item + Design of experiments + \item + As generic as possible + + + \item + Allows for a wide variety of models + \item + Can be coupled to external code + \item + GUI language in both English and French + \end{itemize} + \item + LGPL license + \item + Two releases per year, follows OpenTURNS development + \item + Available for free on demand at + \url{https://persalys.fr} + + \end{itemize} + \end{frame} + + \begin{frame}{Persalys installation} + \protect\hypertarget{persalys-installation}{} + \begin{itemize} + + \item + Github: sources + \item + You can request executables at + \url{https://persalys.fr/obtenir.php?la=en} + \item + Depending on your OS + + \begin{itemize} + + \item + \href{https://openturns.github.io/openturns/1.22/usecases/use_case_logistic.html}{Linux} $\rightarrow$ .AppImage (600 Mo) + \item + Windows $\rightarrow$ .exe will create a shortcut on your Desktop + (program is 1.45 Go) + \end{itemize} + \item Also distributed by Debian-based GNU/Linux distributions (e.g. Debian, Ubuntu...) + \end{itemize} + \end{frame} + + \begin{frame}{Open Persalys and click on ``New study''} + \centering + \includegraphics[width=.89\textwidth]{figure/Persalys_GUI.png} + \end{frame} + + \begin{frame}{Create a study} + + \includegraphics[width=\textwidth]{figure/Persalys_new_study.png} + \end{frame} + + \begin{frame}{Definition/Evaluation} + \protect\hypertarget{definitionevaluation}{} + Models are viewed as ``black boxes'' with specific inputs and outputs. + Persalys supports two model categories: + + \begin{itemize} + \item + vector to vector (\(X_i \rightarrow Y_i\), emphasized here) + \item + vector to 1D field (\(X_i \rightarrow Y_i(t)\)) + \end{itemize} + + \medskip + + Vector to vector models can be of the following type: + + \begin{itemize} + + \item + Symbolic model (i.e. a mathematical formula) + \item + Python model (i.e. a Python function) + \item + FMI model + \item + Coupling model (an executable command which reads/writes input/output must be provided) + files + \end{itemize} + \end{frame} + + \begin{frame}{Coupling model definition} + + \centering + + \includegraphics[width=0.97\textwidth]{figure/model_definition.png} + + \end{frame} + + \begin{frame}{Study workflow} + \centering + + \includegraphics[width=0.7\textwidth]{figure/StudyWorkflow.png} + + \small + Blocks become available as study content grows and prerequisites are fulfilled. + \end{frame} + +\begin{frame}{Probabilistic models} + \small + Each input variable can be associated to a distribution. + + Dependencies + between variables are specified as copulas. + + \centering + + \includegraphics[width=0.63\textwidth]{figure/overviewProbaModel.png} + + \end{frame} + + \begin{frame}{Surrogate model creation} + \small + Using an evaluated design of experiments, the user can build a surrogate model (linear + regression, functional chaos or Gaussian process regression). Validation + tests are run to check the approximation. + + \centering + + \includegraphics[width=0.59\textwidth]{figure/overviewMetamodel.png} + + \end{frame} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + + +\begin{frame} + +\begin{block}{OpenTURNS resources} +\begin{itemize} + \item Website and documentation: \url{www.openturns.org} + \item GitHub: \url{https://github.com/openturns/openturns} + \item Forum: \url{https://openturns.discourse.group} +\end{itemize} +\end{block} + +\begin{block}{Persalys resources} +\begin{itemize} + \item Website and documentation: \url{https://persalys.fr/?la=en} + \item GitHub: \url{https://github.com/persalys/persalys} + \item Forum: \url{https://persalys.discourse.group} +\end{itemize} +\end{block} + +\begin{columns} +\column{0.5\textwidth} +\centering +\includegraphics[width=0.5\textwidth]{figures/logo-openturns.png} +\column{0.5\textwidth} + +\includegraphics[width=0.8\textwidth]{figures/PERSALYS-LOGO.png} + +\end{columns} + +\end{frame} + +\end{document} \ No newline at end of file