From 8106503899ef7f4435894a91a2acaf7c67842acc Mon Sep 17 00:00:00 2001 From: farid <farid.mohammadi@iws.uni-stuttgart.de> Date: Mon, 10 May 2021 15:39:24 +0200 Subject: [PATCH] [PA-A] activated PCA options. --- .../tests/PA-A/ffpm_validation_stokesdarcy.py | 23 ++++--------------- .../tests/PA-A/ffpm_validation_stokespnm.py | 22 ++++-------------- 2 files changed, 9 insertions(+), 36 deletions(-) diff --git a/BayesValidRox/tests/PA-A/ffpm_validation_stokesdarcy.py b/BayesValidRox/tests/PA-A/ffpm_validation_stokesdarcy.py index 529c55d6a..d474def76 100644 --- a/BayesValidRox/tests/PA-A/ffpm_validation_stokesdarcy.py +++ b/BayesValidRox/tests/PA-A/ffpm_validation_stokesdarcy.py @@ -15,19 +15,6 @@ try: except ModuleNotFoundError: import pickle -# import matplotlib.pyplot as plt -# plt.rcParams.update({'font.size': 24}) -# plt.rc('figure', figsize = (24, 16)) -# plt.rc('font', family='serif', serif='Arial') -# plt.rc('axes', grid = True) -# plt.rc('text', usetex=True) -# plt.rc('xtick', labelsize=24) -# plt.rc('ytick', labelsize=24) -# plt.rc('axes', labelsize=24) -# plt.rc('axes', linewidth=2) -# plt.rc('axes', grid=True) -# plt.rc('grid', linestyle="-") - import matplotlib matplotlib.use('agg') @@ -143,7 +130,7 @@ def run(params, couplingcond='BJ', PCEEDMethod='normal'): MetaModelOpts = Metamodel(Inputs) # Select if you want to preserve the spatial/temporal depencencies - # MetaModelOpts.DimRedMethod = 'PCA' + MetaModelOpts.DimRedMethod = 'PCA' # MetaModelOpts.varPCAThreshold = 99.99 # Select your metamodel method @@ -193,7 +180,7 @@ def run(params, couplingcond='BJ', PCEEDMethod='normal'): MetaModelOpts.ExpDesign.SamplingMethod = 'latin_hypercube' # Provide the experimental design object with a hdf5 file - # MetaModelOpts.ExpDesign.hdf5File = "ExpDesign_ffpm-stokesdarcyBJ.hdf5" + # MetaModelOpts.ExpDesign.hdf5File = "ExpDesign_ffpm-stokesdarcy{}.hdf5".format(couplingcond) # Sequential experimental design (needed only for sequential ExpDesign) MetaModelOpts.ExpDesign.NrofNewSample = 1 @@ -291,7 +278,7 @@ def run(params, couplingcond='BJ', PCEEDMethod='normal'): # Compute and print RMSE error PostPCE.accuracyCheckMetaModel(Samples=MetaModelOpts.validSamples, validOutputsDict=validModelRuns) - + #===================================================== #========= Bayesian inference (Calibration) ======== #===================================================== @@ -564,7 +551,7 @@ def run(params, couplingcond='BJ', PCEEDMethod='normal'): # ---------- set BayesValidRox params ---------- # PCEExpDesignMethod = 'normal' # 'normal' or 'sequential' -# nInitSamples = 400 #50 Initial No. of orig. Model runs for surrogate training +# nInitSamples = 300 #50 Initial No. of orig. Model runs for surrogate training # nTotalSamples = 75 #100 Total No. of orig. Model runs for surrogate training # nBootstrapItr = 100 # No. of bootstraping iterations for Bayesian analysis # BootstrapNoise = 0.005 # Noise amount for bootstraping in Bayesian analysis @@ -576,4 +563,4 @@ def run(params, couplingcond='BJ', PCEEDMethod='normal'): #==================== Run main scripts for PA-B ======================= #========================================================================== # PCEModel, BayesCalib, BayesValid = run(params,couplingcond='BJ', PCEEDMethod=PCEExpDesignMethod) -# PCEModel = run(params,couplingcond='BJ', PCEEDMethod=PCEExpDesignMethod) \ No newline at end of file +# PCEModel = run(params,couplingcond='ER', PCEEDMethod=PCEExpDesignMethod) \ No newline at end of file diff --git a/BayesValidRox/tests/PA-A/ffpm_validation_stokespnm.py b/BayesValidRox/tests/PA-A/ffpm_validation_stokespnm.py index b22439d6f..ef794af1e 100755 --- a/BayesValidRox/tests/PA-A/ffpm_validation_stokespnm.py +++ b/BayesValidRox/tests/PA-A/ffpm_validation_stokespnm.py @@ -8,7 +8,6 @@ Created on Thu Aug 13 09:53:11 2020 import sys, os import numpy as np import scipy.stats as stats -from itertools import cycle import pandas as pd import shutil try: @@ -16,19 +15,6 @@ try: except ModuleNotFoundError: import pickle -from matplotlib.backends.backend_pdf import PdfPages -import matplotlib.pyplot as plt -plt.rcParams.update({'font.size': 24}) -plt.rc('figure', figsize = (24, 16)) -plt.rc('font', family='serif', serif='Arial') -plt.rc('axes', grid = True) -plt.rc('text', usetex=True) -plt.rc('xtick', labelsize=24) -plt.rc('ytick', labelsize=24) -plt.rc('axes', labelsize=24) -plt.rc('axes', linewidth=2) -plt.rc('axes', grid=True) -plt.rc('grid', linestyle="-") import matplotlib matplotlib.use('agg') @@ -138,7 +124,7 @@ def run(params, PCEEDMethod='normal'): MetaModelOpts = Metamodel(Inputs) # Select if you want to preserve the spatial/temporal depencencies - # MetaModelOpts.DimRedMethod = 'PCA' + MetaModelOpts.DimRedMethod = 'PCA' # MetaModelOpts.varPCAThreshold = 99.99 # Select your metamodel method @@ -185,10 +171,10 @@ def run(params, PCEEDMethod='normal'): # Sampling methods # 1) random 2) latin_hypercube 3) sobol 4) halton 5) hammersley 6) chebyshev(FT) # 7) korobov 8) grid(FT) 9) nested_grid(FT) 10)user - MetaModelOpts.ExpDesign.SamplingMethod = 'latin_hypercube' + MetaModelOpts.ExpDesign.SamplingMethod = 'user' # Provide the experimental design object with a hdf5 file - # MetaModelOpts.ExpDesign.hdf5File = "ExpDesign_ffpm-stokespnm.hdf5" + MetaModelOpts.ExpDesign.hdf5File = "ExpDesign_ffpm-stokespnm.hdf5" # Sequential experimental design (needed only for sequential ExpDesign) MetaModelOpts.ExpDesign.NrofNewSample = 1 @@ -555,7 +541,7 @@ def run(params, PCEEDMethod='normal'): #========================================================================== # ---------- set BayesValidRox params ---------- # PCEExpDesignMethod = 'normal' # 'normal' or 'sequential' -# nInitSamples = 400 #50 Initial No. of orig. Model runs for surrogate training +# nInitSamples = 300 #50 Initial No. of orig. Model runs for surrogate training # nTotalSamples = 200 #100 Total No. of orig. Model runs for surrogate training # nBootstrapItr = 100 # No. of bootstraping iterations for Bayesian analysis # BootstrapNoise = 0.005 # Noise amount for bootstraping in Bayesian analysis -- GitLab