The NISP Module
In this page, we present the Non Intrusive Spectral Projection (NISP) module available in Scilab since the 29th of September 2009.
Introduction
This toolbox allows to approximate a given model, which is associated with input random variables.
The module provides the following components :
- “nisp” provides function to configure the global behaviour of the toolbox. This allows to startup and shutdown the library, configure and quiery the verbose level or initialize the seed of the random number generator.
- “randvar” is the class which allows to manage a random variable. Various types of random variables are available, including uniform, normal, exponential, etc...
- “setrandvar”, is the class which allows to manage a set of random variables. Several methods are available to build a sampling from a set of random variables. We can use, for example, a Monte-Carlo sampling or a Sobol low discrepancy sequence. This feature allows to use the class as Design of Experiment tool (DOE).
- “polychaos” is the class which allows to manage a polynomial chaos expansion. The coefficients of the expansion are computed based on given numerical experiments which creates the association between the inputs and the outputs. Once computed, the expansion can be used as a regular function. The mean, standard deviation or quantile can also be directly retrieved.
The current toolbox provides an object-oriented approach of the C++ NISP library.
This toolbox has been created in the context of the OPUS project :
within the workpackage 2.1.1 "Construction de méta-modèles".
This project has received funding by Agence Nationale de la recherche :
http://www.agence-nationale-recherche.fr/
How to get the module
Forge
The Scilab Forge hosts the sources of the module:
http://forge.scilab.org/index.php/p/nisp/
How to install the module
The module is available under ATOMS :
http://atoms.scilab.org/toolboxes/NISP
To install it, type the following statement in the Scilab console (Scilab version >= 5.1):
atomsInstall("NISP")
Documentation
With the toolbox
To see an overview of the toolbox, type :
help
and search for the "NISP" section in the help browser. From there, the "Overview" section gives a global overview of the toolbox and a brief example.
See in the help provided in the help/en_US directory of the toolbox for more information about its use. Use cases are presented in the demos directory.
Manual and tutorial
The main reference is "NISP User's manual" :
Manual, v0.3, 2012 (59 pages) : http://forge.scilab.org/index.php/p/nisp/downloads/370/
Manual, v0.2, 2011 (101 pages) : nisp_toolbox_manual_v0.2.pdf
Manual, v0.1, 2009 (51 pages) : nisp_toolbox_manual.pdf
The "Introduction to sensitivity analysis with NISP" is a tutorial for S.A. with Scilab :
Introduction to sensitivity analysis with NISP, v0.3, 2012 : http://forge.scilab.org/index.php/p/nisp/downloads/369/
Short reports and Slides
This module has been presented at the "42èmes Journées de Statistique", du 24 au 28 mai 2010 - Marseille, France. The title was "Polynômes de chaos sous Scilab via la librairie NISP", Michaël Baudin, Jean-Marc Martinez, 2010 and the talk has been given the 28th of May 2010.
Slides (25 pages) : NispScilab-slides-Baudin-Martinez-2010.pdf
Paper (6 pages) : NispScilab-paper-Baudin-Martinez-2010.pdf
The NISP module for Scilab has been presented at the OPUS Final workshop, "Computer experiments and uncertainty analysis" Friday, October 21, 2011 Henri Poincaré Institute, France. The title was "Polynômes du chaos et analyse de sensibilité : zoom sur les outils disponibles dans Scilab", Michaël Baudin, Jean-Marc Martinez, 2011
Slides (26 pages) : slides-workshopOPUS-October2011.pdf
Authors using the NISP module
"Sensitivity study of dynamic systems using polynomial chaos", Eduardo Haro Sandovala, Floriane Anstett-Collinb, Michel Bassetc, Reliability Engineering & System Safety, Volume 104, August 2012, Pages 15–26 (HTML)
"Global sensitivity analysis in a Multi-state Physics Model of Component Degradation based on a hybrid State-Space Enrichment and Polynomial Chaos Expansion approach", Claudio M. Rocco S., Enrico Zio, "IEEE Transactions on Reliability 62, 4 (2013) 781-788", (PDF)
"Global Sensitivity Analysis of Multi-State Markov Reliability Models of Power Equipment Approximated by Polynomial Chaos Expansion", Claudio M Rocco, Enrico Zio, Journal of KONBiN. Volume 23, Issue 1, Pages 59–70, ISSN (Online) 2083-4608, ISSN (Print) 1895-8281, DOI: 10.2478/jok-2013-0038, November 2013, (HTML)
"Robust performance assessment for an oscillating airfoil combining the Time Spectral Method and a semi-intrusive uncertainty propagation approach", P.M. Congedo, C. Corre and R. Abgrall, Seventh International Conference on Computational Fluid Dynamics (ICCFD7), Big Island, Hawaii, July 9-13, 2012
* "Methods for Sensitivity and Uncertainty Analysis of Computer Intensive Simulation Models", P Janssen, J Barkmeijer, T Aldenberg, H Visser, 2012 (PDF)
Teaching
The NISP module is used to teach sensitivity analysis to Master's students at INSTN. The master is "Master de Modélisation et Simulation" (M2S) :
http://www.maisondelasimulation.fr/m2s/
This session is within the course "Calcul hautes performances", Informatique scientifique approfondie (I1), Traitement des incertitudes (I1c).
Présentation du Cours
- Introduction: Analyse d'incertitude, analyse de sensibilité
- modèle probabiliste, variable aléatoire, vecteurs aléatoires, corrélations
- méthodes d'échantillonnage, plans expériences numériques
- analyse statistique, estimation ponctuelle et par intervalle de confiance
- analyse de sensibilité par décomposition de la variance
- modèle de régression linéaire : calibration des codes de calcul, approches bayésiennes
- approches fonctionnelles par développement en polynôme de chaos
- Cours 1 : Probabilités
- Variables aléatoires
- Quelques exemples
- Variables aléatoires multidimensionnelles (covariance, corrélation, espérance conditionnelle, interprétation géométrique via les espaces de Hilbert)
- Génération d'échantillons (générateur de nombres pseudo-aléatoires, inversion de la CDF, Simple Random Sampling, Latin Hypercube Sampling, Quasi-Monte Carlo)
- Estimation ponctuelle (principes, moyenne, variance, estimation par maximum de vraisemblance)
- Estimation par intervalle (intervalle de confiance de la moyenne, proportion)
- Estimation d'un quantile
- Bootstrap (méthode de ré-échantillonnage, principe, algorithme)
- Références
- Cours 2 : Régression et plans optimaux
- Introduction
- Exemple du plan de pesée
- Formalisation mathématique
- Modélisation linéaire
- Approximation moindres carrés
- Hypotheses probabilistes
- Hypothèses gaussiennes
- Plans optimaux
- Interprétation géométrique
- Région de confiance
- Variance connue
- Variance inconnue
- Synthèse
- Références
- Cours 3 : Analyse de sensibilité et polynômes de chaos
- Introduction
- Polynômes orthogonaux
- Polynômes de chaos
- Quadrature-Cubature
- Analyse de sensibilité : analyse de la variance, rapport de corrélation et indices SRC, exemple
- Librairie NISP
- Références
Session 2009-2010
TP du 30 Novembre 2009 (PDF)
Examen du 17/12/2009 - Sujet : (PDF)
Examen du 17/12/2009 - Script Exercice 1 : examen_2009_sujet_ex1.sce
Examen du 17/12/2009 - Script Exercice 2 : examen_2009_sujet_ex2.sce
Session 2010-2011
Examen du 14/02/2011 - Sujet : (PDF)
Examen du 14/02/2011 - Script Exercice 1 : examen_2011_sujet_ex1.sce
Examen du 14/02/2011 - Script Exercice 2 : examen_2011_sujet_ex2.sce
Session 2011-2012
Session 2012-2013
- TP du 21 Février 2013 : Probabilités - Statistiques avec Scilab
Sujet : tp_Probas-Stats-2013 - Sujet.pdf
Solutions : tp_Probas-Stats-2013 - Solution.pdf
Exercices Probabilités : TP2013-exercices-probas.sce
Exercices Statistiques : TP2013-exercices-stats.sce
Fichier de données : TP2013-normtemp.dat.txt, TP2013-normtemp.txt
- TP du 28 Février 2013 : Analyse de sensibilité - Polynômes de chaos avec Scilab
Toolkit : TP-28-02-2013.zip
Sujet : tp_nisp_2013_roadmap.pdf
Session 2013-2014
- TP Probabilités - Statistiques
Sujet : tp_Probas-Stats-2014-sujet.pdf
Solution : tp_Probas-Stats-2014-solution.pdf
Scripts : tp_Proba-Stats-2014-scripts.zip
- TP Analyse de Sensibilité - Polynômes de Chaos :
Sujet : tp_nisp-2014-sujet.pdf
Solution : tp_nisp-2014-solution.pdf
Scripts : tp_nisp-2014.zip
Session 2014-2015
- TP Probabilités - Statistiques
Sujet : tp_Probas-Stats-2015-sujet.pdf
Solution : tp_Probas-Stats-2015-solution.pdf
Scripts : tp-probas-stats-2015-scripts.zip
- TP Analyse de Sensibilité - Polynômes de Chaos
Sujet : tp_nisp_roadmap-2015-sujet.pdf
Solution : tp_nisp_roadmap-2015-solution.pdf
Scripts : tp-SAPC-2015-scripts.zip
Examples
In this section, we present two simple examples of use of this module.
The product function
In the following example, we compute the polynomial chaos expansion of a very simple function, taking two input variables and returning one output variable. The output result is computed by the Exemple function as the product of the two inputs. The first variable is associated with a Normal law, while the second is associated with a Uniform law.
// Copyright (C) 2009 - CEA - Jean-Marc Martinez // Copyright (C) 2008-2009 - INRIA - Michael Baudin // // This file must be used under the terms of the GNU Lesser General Public License license : // http://www.gnu.org/copyleft/lesser.html // // Test the chaos polynomial decomposition on the product x1*x2 function. // Two random variables: // * a normal random variable with mu=1.0 and sigma=0.5, // * a uniform random variable in [1,2.5]. // Create a Quadrature sampling and compute the coefficients of the polynomial // by integration. // Use a degree 2 polynomial. function y = Exemple (x) // Returns the output y of the product x1 * x2. // Parameters // x: a np-by-nx matrix of doubles, where np is the number of experiments, and nx=2. // y: a np-by-1 matrix of doubles y(:,1) = x(:,1).* x(:,2) endfunction // 1. Two stochastic (normalized) variables vx1 = randvar_new("Normale"); vx2 = randvar_new("Uniforme"); // 2. A collection of stoch. variables. srvx = setrandvar_new(); setrandvar_addrandvar ( srvx,vx1); setrandvar_addrandvar ( srvx,vx2); // 3. Two uncertain parameters vu1 = randvar_new("Normale",1.0,0.5); vu2 = randvar_new("Uniforme",1.0,2.5); // 4. A collection of uncertain parameters srvu = setrandvar_new(); setrandvar_addrandvar ( srvu,vu1); setrandvar_addrandvar ( srvu,vu2); // 5. Create the Design Of Experiments degre = 2; setrandvar_buildsample(srvx,"Quadrature",degre); setrandvar_buildsample( srvu , srvx ); // 6. Create the polynomial ny = 1; pc = polychaos_new ( srvx , ny ); np = setrandvar_getsize(srvx); polychaos_setsizetarget(pc,np); // 7. Perform the DOE inputdata = setrandvar_getsample(srvu); outputdata = Exemple(inputdata); polychaos_settarget(pc,outputdata); // 8. Compute the coefficients of the polynomial expansion polychaos_setdegree(pc,degre); polychaos_computeexp(pc,srvx,"Integration"); // 9. Get the sensitivity indices average = polychaos_getmean(pc); var = polychaos_getvariance(pc); mprintf("Mean = %f\n",average); mprintf("Variance = %f\n",var); S = polychaos_getindexfirst(pc); mprintf("S1 = %f\n",S(1)); mprintf("S2 = %f\n",S(2)); ST = polychaos_getindextotal(pc); mprintf("ST1 = %f\n",ST(1)); mprintf("ST2 = %f\n",ST(2)); // Clean-up polychaos_destroy(pc); randvar_destroy(vu1); randvar_destroy(vu2); randvar_destroy(vx1); randvar_destroy(vx2); setrandvar_destroy(srvu); setrandvar_destroy(srvx);
The previous script produces the following output.
Mean = 1.750000 Variance = 1.000000 S1 = 0.765625 S2 = 0.187500 ST1 = 0.812500 ST2 = 0.234375
The Ishigami function
In the following example, we compute the polynomial chaos expansion of the Ishigami function, which has 3 inputs and 1 output. The three input variables are uniform random variables in the interval [-Pi,Pi].
// Copyright (C) 2009 - CEA - Jean-Marc Martinez // Copyright (C) 2009-2011 - INRIA - Michael Baudin // // This file must be used under the terms of the GNU Lesser General Public License license : // http://www.gnu.org/copyleft/lesser.html // // Test the chaos polynomial decomposition on the Ishigami function. // Three uniform variables in [-pi,pi]. // Create a Petras sampling and compute the coefficients of the polynomial // by integration. // // 3 random variable uniform in [-pi,pi] a=7.; b=0.1; exact = nisp_ishigamisa ( a , b ); // 1. Create a group of stochastic variables nx = 3; srvx = setrandvar_new( nx ); // 2. Create a group of uncertain variables rvu1 = randvar_new("Uniforme",-%pi,%pi); rvu2 = randvar_new("Uniforme",-%pi,%pi); rvu3 = randvar_new("Uniforme",-%pi,%pi); srvu = setrandvar_new(); setrandvar_addrandvar ( srvu, rvu1); setrandvar_addrandvar ( srvu, rvu2); setrandvar_addrandvar ( srvu, rvu3); // 3. Create a Petras sampling degre = 9; setrandvar_buildsample(srvx,"Petras",degre); setrandvar_buildsample( srvu , srvx ); // 4. Create the chaos polynomial pc = polychaos_new ( srvx , 1 ); polychaos_setdegree(pc,degre); // 5. Perform the experiments np = setrandvar_getsize(srvu); mprintf("Number of experiments = %d\n",np); polychaos_setsizetarget(pc,np); inputdata = setrandvar_getsample(srvu); outputdata = nisp_ishigami(inputdata,a,b); polychaos_settarget(pc,outputdata); // 6. Compute the coefficients by integration polychaos_computeexp(pc,srvx,"Integration"); // 7. Get the sensitivity indices average = polychaos_getmean(pc); var = polychaos_getvariance(pc); mprintf("Mean = %f (expected=%f)\n",average,exact.expectation); mprintf("Variance = %f (expected=%f)\n",var,exact.var); S = polychaos_getindexfirst (pc); mprintf("S1 = %f (expected=%f)\n",S(1),exact.S1); mprintf("S2 = %f (expected=%f)\n",S(2),exact.S2); mprintf("S3 = %f (expected=%f)\n",S(3),exact.S3); ST = polychaos_getindextotal (pc); mprintf("ST1 = %f (expected=%f)\n",ST(1),exact.ST1); mprintf("ST2 = %f (expected=%f)\n",ST(2),exact.ST2); mprintf("ST3 = %f (expected=%f)\n",ST(3),exact.ST3); // Consider the group {X1,X2} groupe = [1 3]; polychaos_setgroupempty ( pc ); polychaos_setgroupaddvar ( pc , groupe(1) ); polychaos_setgroupaddvar ( pc , groupe(2) ); mprintf("Group {X1,X3}\n"); ST13=exact.S1+exact.S3+exact.S13; mprintf(" ST13 =%f (expected=%f)\n",polychaos_getgroupind(pc),ST13); mprintf(" S13 =%f (expected=%f)\n",polychaos_getgroupinter(pc),exact.S13); // Compute all sensitivity indices. // The line [1 0 1] is associated with the group {X1,X3}. // The sum of all sensitivity indices is equal to 1. mprintf("Anova decomposition of the normalized variance.\n"); polychaos_getanova(pc); // Compute the histogram of the output of the chaos polynomial. polychaos_buildsample(pc,"Lhs",10000,0); sample_output = polychaos_getsample(pc); my_handle = scf(10001); histplot(50,sample_output) xtitle("Ishigami - Histogram"); // Plot the sensitivity indices. for i=1:nx indexfirst(i)=polychaos_getindexfirst(pc,i); indextotal(i)=polychaos_getindextotal(pc,i); end my_handle = scf(10002); bar(indextotal,0.2,'blue'); bar(indexfirst,0.15,'yellow'); legend(["Total" "First order"],pos=1); xtitle("Ishigami - Sensitivity index"); // // Clean-up // randvar_destroy ( rvu1 ); randvar_destroy ( rvu2 ); randvar_destroy ( rvu3 ); setrandvar_destroy ( srvu ); polychaos_destroy ( pc ); setrandvar_destroy ( srvx );
The previous script produces the following output.
Number of experiments = 751 Mean = 3.500000 (expected=3.500000) Variance = 13.842473 (expected=13.844588) S1 = 0.313953 (expected=0.313905) S2 = 0.442325 (expected=0.442411) S3 = 0.000000 (expected=0.000000) ST1 = 0.557675 (expected=0.557589) ST2 = 0.442326 (expected=0.442411) ST3 = 0.243721 (expected=0.243684) Group {X1,X3} ST13 =0.557674 (expected=0.557589) S13 =0.243721 (expected=0.243684) Anova decomposition of the normalized variance. 1 0 0 : 0.313953 0 1 0 : 0.442325 1 1 0 : 1.55229e-009 0 0 1 : 8.08718e-031 1 0 1 : 0.243721 0 1 1 : 8.43733e-031 1 1 1 : 1.6007e-007
The previous script produces the following plots.
Authors
- Copyright (C) 2008 - 2009 - INRIA - Michaël Baudin
- Copyright (C) 2009 - 2011 - DIGITEO - Michaël Baudin
- Copyright (C) 2009 - CEA-Saclay, DEN, DM2S, SFME - Jean-Marc Martinez
- Copyright (C) 2012 - 2015 - Michael Baudin