sobol.setReplicationSize(200) sobol.setMaximumCalls(1000) myStudy.add(sobol) sobol.run() sobolResult = sobol.getResult() # Comparaison firstOrderIndicesValues = [[0.643987, 0.0183602, 0.255834]] totalIndicesValues = [[0.610267, 0.0494237, 0.280706]] openturns.testing.assert_almost_equal(firstOrderIndicesValues, sobolResult.getFirstOrderIndices(), 1e-6) openturns.testing.assert_almost_equal(totalIndicesValues, sobolResult.getTotalIndices(), 1e-6) # SRC ## src = persalys.SRCAnalysis('mySRC', model) myStudy.add(src) src.run() srcResult = src.getResult() # Comparaison openturns.testing.assert_almost_equal(0.628946, srcResult.getIndices()[0][0], 1e-5) openturns.testing.assert_almost_equal(0.0476118, srcResult.getIndices()[0][1], 1e-5) openturns.testing.assert_almost_equal(0.318226, srcResult.getIndices()[0][2], 1e-5) # Chaos ## values = [[ 10035.5, 10072.1, 10108.6, 10145.2, 10181.7, 10218.3, 10254.8, 10291.4,
# Model x0 = persalys.Input('x0', ot.Normal()) x1 = persalys.Input('x1', ot.Normal()) y00 = persalys.Output('fake_y0') y00.setIsSelected(False) y0 = persalys.Output('y0') formula_y00 = 'x0' formula_y0 = '10+3*x0+x1' model = persalys.SymbolicPhysicalModel('aModel', [x0, x1], [y00, y0], [formula_y00, formula_y0]) myStudy.add(model) # SRC ## analysis = persalys.SRCAnalysis('aSRC', model) analysis.setSimulationsNumber(1000) analysis.setSeed(2) myStudy.add(analysis) print(analysis) analysis.run() print("result=", analysis.getResult()) # SRC ## X2 = persalys.Input('x2', 10) model.addInput(X2) model.addOutput(persalys.Output('y1')) model.setFormula('y1', '3*x0 + x1 + x2')
# 4- sensitivity ## # 4-a Sobol ## sobol = persalys.SobolAnalysis('Sobol', model1) sobol.setMaximumConfidenceIntervalLength(-1) sobol.setMaximumElapsedTime(1000) sobol.setMaximumCalls(20) sobol.setReplicationSize(3) sobol.setBlockSize(1) sobol.setSeed(2) sobol.setInterestVariables(['y0', 'y1']) myStudy.add(sobol) # 4-b SRC ## src = persalys.SRCAnalysis('SRC', model1) src.setSimulationsNumber(20) src.setSeed(2) src.setInterestVariables(['y0', 'y1']) myStudy.add(src) # 7- data analysis ## dataAnalysis = persalys.DataAnalysis('DataAnalysis', model3) myStudy.add(dataAnalysis) # 8- Marginals inference ## inference = persalys.InferenceAnalysis('inference', model3) inference.setInterestVariables(['x_0', 'x_3']) factories = [ot.NormalFactory(), ot.GumbelFactory()] inference.setDistributionsFactories('x_3', factories) inference.setLevel(0.1)