UQPyL 2.0.5__tar.gz → 2.0.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- UQPyL-2.0.7/PKG-INFO +196 -0
- UQPyL-2.0.7/README.md +179 -0
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL/DoE/__init__.py +1 -1
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL/DoE/fast_sequence.py +24 -12
- UQPyL-2.0.7/UQPyL/DoE/full_fact.py +68 -0
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL/DoE/lhs.py +19 -23
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL/DoE/morris_sequence.py +27 -9
- UQPyL-2.0.7/UQPyL/DoE/random.py +43 -0
- UQPyL-2.0.7/UQPyL/DoE/samplerABC.py +50 -0
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL/DoE/sobol_sequence.py +20 -13
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL/__init__.py +1 -1
- UQPyL-2.0.7/UQPyL/optimization/__init__.py +4 -0
- UQPyL-2.0.7/UQPyL/optimization/algorithmABC.py +119 -0
- UQPyL-2.0.7/UQPyL/optimization/mathematics/__init__.py +2 -0
- {UQPyL-2.0.5/UQPyL/optimization → UQPyL-2.0.7/UQPyL/optimization/mathematics}/boxmin.py +30 -17
- UQPyL-2.0.7/UQPyL/optimization/metric/__init__.py +3 -0
- UQPyL-2.0.7/UQPyL/optimization/metric/gd.py +12 -0
- UQPyL-2.0.7/UQPyL/optimization/metric/hv.py +119 -0
- UQPyL-2.0.7/UQPyL/optimization/metric/igd.py +14 -0
- UQPyL-2.0.7/UQPyL/optimization/multi_objective/__init__.py +5 -0
- UQPyL-2.0.5/UQPyL/optimization/mo_asmo.py → UQPyL-2.0.7/UQPyL/optimization/multi_objective/moasmo.py +5 -5
- UQPyL-2.0.7/UQPyL/optimization/multi_objective/moea_d.py +128 -0
- UQPyL-2.0.7/UQPyL/optimization/multi_objective/nsga_ii.py +129 -0
- UQPyL-2.0.7/UQPyL/optimization/multi_objective/rvea.py +114 -0
- UQPyL-2.0.7/UQPyL/optimization/population.py +156 -0
- UQPyL-2.0.7/UQPyL/optimization/result.py +125 -0
- UQPyL-2.0.7/UQPyL/optimization/single_objective/__init__.py +11 -0
- UQPyL-2.0.7/UQPyL/optimization/single_objective/abc.py +175 -0
- UQPyL-2.0.7/UQPyL/optimization/single_objective/asmo.py +99 -0
- UQPyL-2.0.7/UQPyL/optimization/single_objective/csa.py +154 -0
- UQPyL-2.0.7/UQPyL/optimization/single_objective/de.py +85 -0
- UQPyL-2.0.7/UQPyL/optimization/single_objective/ego.py +85 -0
- UQPyL-2.0.7/UQPyL/optimization/single_objective/ga.py +168 -0
- UQPyL-2.0.7/UQPyL/optimization/single_objective/ml_sce_ua.py +135 -0
- UQPyL-2.0.7/UQPyL/optimization/single_objective/pso.py +145 -0
- UQPyL-2.0.7/UQPyL/optimization/single_objective/sce_ua.py +171 -0
- UQPyL-2.0.7/UQPyL/optimization/utility_functions/__init__.py +5 -0
- UQPyL-2.0.7/UQPyL/optimization/utility_functions/crowding_distance.py +31 -0
- UQPyL-2.0.7/UQPyL/optimization/utility_functions/ndsort.py +36 -0
- UQPyL-2.0.7/UQPyL/optimization/utility_functions/operationGA.py +81 -0
- UQPyL-2.0.7/UQPyL/optimization/utility_functions/tournament_selection.py +32 -0
- UQPyL-2.0.5/UQPyL/optimization/utility_functions/_uniformPoint.py → UQPyL-2.0.7/UQPyL/optimization/utility_functions/uniform_point.py +7 -4
- UQPyL-2.0.7/UQPyL/problems/__init__.py +22 -0
- UQPyL-2.0.5/UQPyL/problems/multi_DTLZ.py → UQPyL-2.0.7/UQPyL/problems/multi_objective/DTLZ.py +13 -6
- UQPyL-2.0.5/UQPyL/problems/multi_ZDT.py → UQPyL-2.0.7/UQPyL/problems/multi_objective/ZDT.py +43 -42
- UQPyL-2.0.7/UQPyL/problems/multi_objective/__init__.py +2 -0
- UQPyL-2.0.7/UQPyL/problems/pratical_problem.py +16 -0
- UQPyL-2.0.7/UQPyL/problems/problemABC.py +90 -0
- UQPyL-2.0.7/UQPyL/problems/single_objective/__init__.py +3 -0
- UQPyL-2.0.5/UQPyL/problems/single_Benchmarks.py → UQPyL-2.0.7/UQPyL/problems/single_objective/single_base_problem.py +59 -43
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL/sensibility/__init__.py +2 -1
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL/sensibility/delta_test.py +5 -5
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL/sensibility/fast.py +59 -80
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL/sensibility/mars_sa.py +1 -1
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL/sensibility/morris.py +55 -27
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL/sensibility/rbd_fast.py +44 -45
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL/sensibility/rsa.py +37 -38
- UQPyL-2.0.7/UQPyL/sensibility/saABC.py +151 -0
- UQPyL-2.0.7/UQPyL/sensibility/sobol.py +252 -0
- UQPyL-2.0.7/UQPyL/surrogates/__init__.py +9 -0
- UQPyL-2.0.7/UQPyL/surrogates/fnn/__init__.py +1 -0
- {UQPyL-2.0.5/UQPyL/surrogates → UQPyL-2.0.7/UQPyL/surrogates/fnn}/fully_connect_neural_network.py +53 -51
- UQPyL-2.0.7/UQPyL/surrogates/gp/__init__.py +2 -0
- UQPyL-2.0.7/UQPyL/surrogates/gp/gaussian_process.py +233 -0
- UQPyL-2.0.7/UQPyL/surrogates/gp/kernel/__init__.py +6 -0
- {UQPyL-2.0.5/UQPyL/surrogates/gp_kernels → UQPyL-2.0.7/UQPyL/surrogates/gp/kernel}/base_kernel.py +14 -6
- UQPyL-2.0.5/UQPyL/surrogates/gp_kernels/c_kernel.py → UQPyL-2.0.7/UQPyL/surrogates/gp/kernel/c_kernel_.py +3 -2
- UQPyL-2.0.7/UQPyL/surrogates/gp/kernel/dot_kernel_.py +27 -0
- UQPyL-2.0.7/UQPyL/surrogates/gp/kernel/matern_kernel.py +76 -0
- UQPyL-2.0.7/UQPyL/surrogates/gp/kernel/rbf_kernel.py +61 -0
- UQPyL-2.0.7/UQPyL/surrogates/gp/kernel/rq_kernel.py +42 -0
- UQPyL-2.0.7/UQPyL/surrogates/kriging/__init__.py +2 -0
- UQPyL-2.0.7/UQPyL/surrogates/kriging/kernel/__init__.py +4 -0
- UQPyL-2.0.7/UQPyL/surrogates/kriging/kernel/base_kernel.py +53 -0
- UQPyL-2.0.7/UQPyL/surrogates/kriging/kernel/cubic_kernel.py +28 -0
- {UQPyL-2.0.5/UQPyL/surrogates/krg_kernels → UQPyL-2.0.7/UQPyL/surrogates/kriging/kernel}/exp_kernel.py +9 -8
- {UQPyL-2.0.5/UQPyL/surrogates/krg_kernels → UQPyL-2.0.7/UQPyL/surrogates/kriging/kernel}/guass_kernel.py +9 -8
- UQPyL-2.0.7/UQPyL/surrogates/kriging/kriging.py +331 -0
- UQPyL-2.0.7/UQPyL/surrogates/mars/__init__.py +1 -0
- {UQPyL-2.0.5/UQPyL/surrogates/mars_ → UQPyL-2.0.7/UQPyL/surrogates/mars/core}/_basis.c +6527 -5875
- {UQPyL-2.0.5/UQPyL/surrogates/mars_ → UQPyL-2.0.7/UQPyL/surrogates/mars/core}/_forward.c +4500 -3879
- {UQPyL-2.0.5/UQPyL/surrogates/mars_ → UQPyL-2.0.7/UQPyL/surrogates/mars/core}/_knot_search.c +5072 -4427
- {UQPyL-2.0.5/UQPyL/surrogates/mars_ → UQPyL-2.0.7/UQPyL/surrogates/mars/core}/_pruning.c +2782 -2179
- {UQPyL-2.0.5/UQPyL/surrogates/mars_ → UQPyL-2.0.7/UQPyL/surrogates/mars/core}/_qr.c +3232 -2607
- {UQPyL-2.0.5/UQPyL/surrogates/mars_ → UQPyL-2.0.7/UQPyL/surrogates/mars/core}/_record.c +3898 -3265
- {UQPyL-2.0.5/UQPyL/surrogates/mars_ → UQPyL-2.0.7/UQPyL/surrogates/mars/core}/_types.c +1594 -991
- {UQPyL-2.0.5/UQPyL/surrogates/mars_ → UQPyL-2.0.7/UQPyL/surrogates/mars/core}/_util.c +2060 -1461
- {UQPyL-2.0.5/UQPyL/surrogates → UQPyL-2.0.7/UQPyL/surrogates/mars}/mars.py +9 -9
- UQPyL-2.0.7/UQPyL/surrogates/rbf/__init__.py +2 -0
- {UQPyL-2.0.5/UQPyL/surrogates/rbf_kernels → UQPyL-2.0.7/UQPyL/surrogates/rbf/kernel}/__init__.py +4 -4
- UQPyL-2.0.7/UQPyL/surrogates/rbf/kernel/base_kernel.py +82 -0
- UQPyL-2.0.7/UQPyL/surrogates/rbf/kernel/cubic_kernel.py +26 -0
- UQPyL-2.0.7/UQPyL/surrogates/rbf/kernel/gaussian_kernel.py +17 -0
- UQPyL-2.0.7/UQPyL/surrogates/rbf/kernel/linear_kernel.py +25 -0
- UQPyL-2.0.7/UQPyL/surrogates/rbf/kernel/multiquadric_kernel.py +25 -0
- UQPyL-2.0.7/UQPyL/surrogates/rbf/kernel/thin_plate_spline_kernel.py +32 -0
- UQPyL-2.0.7/UQPyL/surrogates/rbf/radial_basis_function.py +97 -0
- UQPyL-2.0.7/UQPyL/surrogates/regression/__init__.py +2 -0
- {UQPyL-2.0.5/UQPyL/surrogates/lasso_ → UQPyL-2.0.7/UQPyL/surrogates/regression/lasso}/__init__.py +1 -1
- {UQPyL-2.0.5/UQPyL/surrogates/lasso_ → UQPyL-2.0.7/UQPyL/surrogates/regression/lasso}/lasso_fast.c +4367 -3820
- UQPyL-2.0.7/UQPyL/surrogates/regression/linear_regression.py +183 -0
- UQPyL-2.0.7/UQPyL/surrogates/regression/polynomial_regression.py +107 -0
- UQPyL-2.0.7/UQPyL/surrogates/setting.py +90 -0
- UQPyL-2.0.7/UQPyL/surrogates/surrogateABC.py +133 -0
- UQPyL-2.0.7/UQPyL/surrogates/svr/__init__.py +1 -0
- {UQPyL-2.0.5/UQPyL/surrogates/svr_ → UQPyL-2.0.7/UQPyL/surrogates/svr/core}/libsvm_interface.cpp +1 -1
- UQPyL-2.0.7/UQPyL/surrogates/svr/support_vector_machine.py +69 -0
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL/utility/__init__.py +4 -3
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL/utility/grid_search.py +0 -1
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL/utility/metrics.py +2 -3
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL/utility/model_selections.py +10 -8
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL/utility/polynomial_features.py +2 -0
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL/utility/scalers.py +1 -1
- UQPyL-2.0.7/UQPyL/utility/verbose.py +354 -0
- UQPyL-2.0.7/UQPyL.egg-info/PKG-INFO +196 -0
- UQPyL-2.0.7/UQPyL.egg-info/SOURCES.txt +131 -0
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL.egg-info/requires.txt +1 -0
- {UQPyL-2.0.5 → UQPyL-2.0.7}/pyproject.toml +2 -2
- UQPyL-2.0.7/setup.py +54 -0
- UQPyL-2.0.5/PKG-INFO +0 -96
- UQPyL-2.0.5/README.md +0 -78
- UQPyL-2.0.5/UQPyL/DoE/full_fact.py +0 -57
- UQPyL-2.0.5/UQPyL/DoE/random.py +0 -28
- UQPyL-2.0.5/UQPyL/DoE/sampler_ABC.py +0 -26
- UQPyL-2.0.5/UQPyL/optimization/__init__.py +0 -25
- UQPyL-2.0.5/UQPyL/optimization/asmo.py +0 -123
- UQPyL-2.0.5/UQPyL/optimization/ga.py +0 -190
- UQPyL-2.0.5/UQPyL/optimization/moea_d.py +0 -241
- UQPyL-2.0.5/UQPyL/optimization/nsga_ii.py +0 -297
- UQPyL-2.0.5/UQPyL/optimization/pso.py +0 -162
- UQPyL-2.0.5/UQPyL/optimization/sce_ua.py +0 -232
- UQPyL-2.0.5/UQPyL/problems/__init__.py +0 -22
- UQPyL-2.0.5/UQPyL/problems/pratical_problem.py +0 -27
- UQPyL-2.0.5/UQPyL/problems/problem_ABC.py +0 -54
- UQPyL-2.0.5/UQPyL/problems/utility_functions/_NDsort.py +0 -34
- UQPyL-2.0.5/UQPyL/problems/utility_functions/__init__.py +0 -0
- UQPyL-2.0.5/UQPyL/sensibility/sa_ABC.py +0 -92
- UQPyL-2.0.5/UQPyL/sensibility/sobol.py +0 -245
- UQPyL-2.0.5/UQPyL/surrogates/BaggingEnsemble.py +0 -1
- UQPyL-2.0.5/UQPyL/surrogates/BootstrapEnsemble.py +0 -1
- UQPyL-2.0.5/UQPyL/surrogates/__init__.py +0 -22
- UQPyL-2.0.5/UQPyL/surrogates/gaussian_process.py +0 -194
- UQPyL-2.0.5/UQPyL/surrogates/gp_kernels/__init__.py +0 -16
- UQPyL-2.0.5/UQPyL/surrogates/gp_kernels/dot_kernel.py +0 -82
- UQPyL-2.0.5/UQPyL/surrogates/gp_kernels/matern_kernel.py +0 -119
- UQPyL-2.0.5/UQPyL/surrogates/gp_kernels/rbf_kernel.py +0 -93
- UQPyL-2.0.5/UQPyL/surrogates/gp_kernels/rq_kernel.py +0 -132
- UQPyL-2.0.5/UQPyL/surrogates/krg_kernels/__init__.py +0 -8
- UQPyL-2.0.5/UQPyL/surrogates/krg_kernels/base_kernel.py +0 -77
- UQPyL-2.0.5/UQPyL/surrogates/krg_kernels/cubic_kernel.py +0 -60
- UQPyL-2.0.5/UQPyL/surrogates/kriging.py +0 -332
- UQPyL-2.0.5/UQPyL/surrogates/linear_regression.py +0 -225
- UQPyL-2.0.5/UQPyL/surrogates/mars_/pyearth/__init__.py +0 -4
- UQPyL-2.0.5/UQPyL/surrogates/mlp_utility/__init__.py +0 -9
- UQPyL-2.0.5/UQPyL/surrogates/polynomial_regression.py +0 -113
- UQPyL-2.0.5/UQPyL/surrogates/radial_basis_function.py +0 -93
- UQPyL-2.0.5/UQPyL/surrogates/rbf_kernels/base_kernel.py +0 -447
- UQPyL-2.0.5/UQPyL/surrogates/rbf_kernels/cubic_kernel.py +0 -14
- UQPyL-2.0.5/UQPyL/surrogates/rbf_kernels/gaussian_kernel.py +0 -9
- UQPyL-2.0.5/UQPyL/surrogates/rbf_kernels/linear_kernel.py +0 -15
- UQPyL-2.0.5/UQPyL/surrogates/rbf_kernels/multiquadric_kernel.py +0 -18
- UQPyL-2.0.5/UQPyL/surrogates/rbf_kernels/thin_plate_spline_kernel.py +0 -20
- UQPyL-2.0.5/UQPyL/surrogates/support_vector_machine.py +0 -106
- UQPyL-2.0.5/UQPyL/surrogates/surrogate_ABC.py +0 -150
- UQPyL-2.0.5/UQPyL.egg-info/PKG-INFO +0 -96
- UQPyL-2.0.5/UQPyL.egg-info/SOURCES.txt +0 -105
- UQPyL-2.0.5/setup.py +0 -64
- {UQPyL-2.0.5 → UQPyL-2.0.7}/LICENSE.md +0 -0
- {UQPyL-2.0.5/UQPyL/optimization → UQPyL-2.0.7/UQPyL/optimization/mathematics}/adam.py +0 -0
- {UQPyL-2.0.5/UQPyL/optimization → UQPyL-2.0.7/UQPyL/optimization/single_objective}/_binary_ga.py +0 -0
- /UQPyL-2.0.5/UQPyL/optimization/utility_functions/_NDsort.py → /UQPyL-2.0.7/UQPyL/problems/utility_functions/NDsort.py +0 -0
- {UQPyL-2.0.5/UQPyL/optimization → UQPyL-2.0.7/UQPyL/problems}/utility_functions/__init__.py +0 -0
- /UQPyL-2.0.5/UQPyL/problems/utility_functions/_uniformPoint.py → /UQPyL-2.0.7/UQPyL/problems/utility_functions/uniformPoint.py +0 -0
- {UQPyL-2.0.5/UQPyL/surrogates/mlp_utility → UQPyL-2.0.7/UQPyL/surrogates/fnn}/_activation_funcs.py +0 -0
- {UQPyL-2.0.5/UQPyL/surrogates/mlp_utility → UQPyL-2.0.7/UQPyL/surrogates/fnn}/base.py +0 -0
- {UQPyL-2.0.5/UQPyL/surrogates/mars_ → UQPyL-2.0.7/UQPyL/surrogates/mars/core}/__init__.py +0 -0
- {UQPyL-2.0.5/UQPyL/surrogates/svr_ → UQPyL-2.0.7/UQPyL/surrogates/svr/core}/__init__.py +0 -0
- {UQPyL-2.0.5/UQPyL/surrogates/svr_ → UQPyL-2.0.7/UQPyL/surrogates/svr/core}/svm.cpp +0 -0
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL.egg-info/dependency_links.txt +0 -0
- {UQPyL-2.0.5 → UQPyL-2.0.7}/UQPyL.egg-info/top_level.txt +0 -0
- {UQPyL-2.0.5 → UQPyL-2.0.7}/setup.cfg +0 -0
UQPyL-2.0.7/PKG-INFO
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: UQPyL
|
|
3
|
+
Version: 2.0.7
|
|
4
|
+
Summary: A python package for parameter uncertainty quantification and optimization
|
|
5
|
+
Author: wmtSky
|
|
6
|
+
Author-email: wmtSky <wmtsky@hhu.edu.cn>
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE.md
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# Uncertainty Quantification Python Laboratory (UQPyL)
|
|
20
|
+
|
|
21
|
+
**UQPyL:** The **Uncertainty Quantification Python Laboratory** provides comprehensive workflows tailored for **Uncertainty Quantification** and **Optimization** of computational models and their associated applications (e.g., model calibration, resource scheduling, product design).
|
|
22
|
+
|
|
23
|
+
## Main Characteristics
|
|
24
|
+
|
|
25
|
+
1. **Comprehensive Sensitivity Analysis and Optimization Algorithm**: Implements widely used sensitivity analysis methodologies and optimization algorithms.
|
|
26
|
+
2. **Advanced Surrogate Modeling**: Integrates diverse surrogate models equipped to solve computationally expensive problems.
|
|
27
|
+
3. **Rich Application Resources**: Provides a comprehensive suite of benchmark problems and practical case studies, enabling users to get started quickly.
|
|
28
|
+
4. **Modular and Extensible Architecture**: Encourages and facilitates the development of novel methods or algorithms by users, aligning with our commitment to openness and collaboration. (**We appreciate and welcome contributions**)
|
|
29
|
+
|
|
30
|
+
## Quick Links
|
|
31
|
+
|
|
32
|
+
- **Website**: [UQPyL Official Site](http://www.uq-pyl.com) (**#TODO**: Needs update)
|
|
33
|
+
- **Source Code**: [GitHub Repository](https://github.com/smasky/UQPyL/)
|
|
34
|
+
- **Documentation**: [ReadTheDocs](https://uqpyl.readthedocs.io/en/latest/)(**#TODO**: Being updating )
|
|
35
|
+
- **Citation Info**: [UQPyL 2.0](**#TODO**: Needs update), [UQPyL 1.0](https://www.sciencedirect.com/science/article/pii/S1364815215300955)
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Included Methods and Algorithms
|
|
40
|
+
|
|
41
|
+
### Sensitivity Analysis
|
|
42
|
+
|
|
43
|
+
(All methods support surrogate models)
|
|
44
|
+
- Sobol'
|
|
45
|
+
- Delta Test (DT)
|
|
46
|
+
- Extended Fourier Amplitude Sensitivity Test (eFAST)
|
|
47
|
+
- Random Balance Designs - Fourier Amplitude Sensitivity Test (RBD-FAST)
|
|
48
|
+
- Multivariate Adaptive Regression Splines-Sensitivity Analysis (MARS-SA)
|
|
49
|
+
- Morris
|
|
50
|
+
- Regional Sensitivity Analysis (RSA)
|
|
51
|
+
|
|
52
|
+
### Optimization Algorithms
|
|
53
|
+
|
|
54
|
+
(* indicates solving computational expensive optimization problem)
|
|
55
|
+
- **Single Objective Optimization**: SCE-UA, ML-SCE-UA, GA, CSA, PSO, DE, ABC, ASMO*, EGO*
|
|
56
|
+
- **Multi-Objective Optimization**: MOEA/D, NSGA-II, RVEA, MOASMO*
|
|
57
|
+
|
|
58
|
+
*Note: The library is still being updated. If you need other algorithms, please contact us.*
|
|
59
|
+
|
|
60
|
+
### Surrogate Models
|
|
61
|
+
|
|
62
|
+
- Fully Connected Neural Network (FCNN)
|
|
63
|
+
- Kriging (KRG)
|
|
64
|
+
- Gaussian Process (GP)
|
|
65
|
+
- Linear Regression (LR)
|
|
66
|
+
- Polynomial Regression (PR)
|
|
67
|
+
- Radial Basis Function (RBF)
|
|
68
|
+
- Support Vector Machine (SVM)
|
|
69
|
+
- Multivariate Adaptive Regression Splines (MARS)
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Installation
|
|
74
|
+
|
|
75
|
+
Recommended (PyPi or Conda):
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install UQPyL
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
conda install UQPyL
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Alternatively:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
git clone https://github.com/smasky/UQPyL.git
|
|
89
|
+
cd UQPyL
|
|
90
|
+
pip install .
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Quick Start
|
|
96
|
+
|
|
97
|
+
To use UQPyL, define the problem you want to solve. The problem usually contains three important properties:
|
|
98
|
+
1. `func` (the mapping from X to Y)
|
|
99
|
+
2. The dimensions of decisions and outputs
|
|
100
|
+
3. The bounds of decisions (ub, lb)
|
|
101
|
+
|
|
102
|
+
### Benchmark Problems
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from UQPyL.problems.single_objective import Sphere
|
|
106
|
+
|
|
107
|
+
problem = Sphere(nInput=10, ub=100, lb=-100)
|
|
108
|
+
problem = Sphere(nInput=10, ub=np.ones(10)*100, lb=np.ones(10)*-100)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Practical Problems
|
|
112
|
+
|
|
113
|
+
Define the evaluation function:
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
from UQPyL.problems import PracticalProblem
|
|
117
|
+
|
|
118
|
+
def func(X):
|
|
119
|
+
Y = np.sum(X, axis=1).reshape(-1, 1)
|
|
120
|
+
return Y
|
|
121
|
+
|
|
122
|
+
problem = PracticalProblem(func=func, nInput=10, nOutput=1, ub=100, lb=-100, name="Sphere")
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Note:** The `func` needs to accept a matrix of X and return a matrix of Y, with columns equal to dimensions and rows equal to samples. X and Y should be np.ndarray.
|
|
126
|
+
|
|
127
|
+
After defining the problem, you can use any methods in UQPyL.
|
|
128
|
+
|
|
129
|
+
### Sensitivity Analysis
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
from UQPyL.sensibility import Sobol
|
|
133
|
+
|
|
134
|
+
sobol = Sobol() # Instantiate and set hyper-parameters
|
|
135
|
+
sobol.analyze(problem)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Optimization
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
from UQPyL.optimization.single_objective import SCE_UA
|
|
142
|
+
|
|
143
|
+
sce = SCE_UA()
|
|
144
|
+
res = sce.run(problem)
|
|
145
|
+
bestDec = res.bestDec
|
|
146
|
+
bestObj = res.bestObj
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Surrogate Modeling
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
from UQPyL.DoE import LHS
|
|
153
|
+
|
|
154
|
+
lhs = LHS(problem)
|
|
155
|
+
xTrain = lhs.sample(200, problem.nInput)
|
|
156
|
+
yTrain = problem.evaluate(xTrain)
|
|
157
|
+
|
|
158
|
+
xTest = lhs.sample(50, problem.nInput)
|
|
159
|
+
yTest = problem.evaluate(xTest)
|
|
160
|
+
|
|
161
|
+
from UQPyL.surrogate.rbf import RBF
|
|
162
|
+
|
|
163
|
+
rbf = RBF()
|
|
164
|
+
rbf.fit(xTrain, yTrain)
|
|
165
|
+
yPred = rbf.predict(xTest)
|
|
166
|
+
|
|
167
|
+
from UQPyL.utility.metric import r_square
|
|
168
|
+
r2 = r_square(yTest, yPred)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
For more advanced usage, please refer to the documentation (**#TODO**).
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Call for Contributions
|
|
176
|
+
|
|
177
|
+
We welcome contributions to expand our library with more sophisticated UQ methods, optimization algorithms and engineering problems.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Contact
|
|
182
|
+
|
|
183
|
+
For any inquiries or contributions, please contact:
|
|
184
|
+
|
|
185
|
+
**wmtSky**
|
|
186
|
+
Email: [wmtsky@hhu.edu.cn](mailto:wmtsky@hhu.edu.cn), [wmtsmasky@gmail.com](mailto:wmtsmasky@gmail.com)
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
*This project is licensed under the MIT License - see the [LICENSE](https://github.com/smasky/UQPyL/LICENSE) file for details.*
|
|
191
|
+
|
|
192
|
+

|
|
193
|
+

|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
UQPyL-2.0.7/README.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
|
|
2
|
+
# Uncertainty Quantification Python Laboratory (UQPyL)
|
|
3
|
+
|
|
4
|
+
**UQPyL:** The **Uncertainty Quantification Python Laboratory** provides comprehensive workflows tailored for **Uncertainty Quantification** and **Optimization** of computational models and their associated applications (e.g., model calibration, resource scheduling, product design).
|
|
5
|
+
|
|
6
|
+
## Main Characteristics
|
|
7
|
+
|
|
8
|
+
1. **Comprehensive Sensitivity Analysis and Optimization Algorithm**: Implements widely used sensitivity analysis methodologies and optimization algorithms.
|
|
9
|
+
2. **Advanced Surrogate Modeling**: Integrates diverse surrogate models equipped to solve computationally expensive problems.
|
|
10
|
+
3. **Rich Application Resources**: Provides a comprehensive suite of benchmark problems and practical case studies, enabling users to get started quickly.
|
|
11
|
+
4. **Modular and Extensible Architecture**: Encourages and facilitates the development of novel methods or algorithms by users, aligning with our commitment to openness and collaboration. (**We appreciate and welcome contributions**)
|
|
12
|
+
|
|
13
|
+
## Quick Links
|
|
14
|
+
|
|
15
|
+
- **Website**: [UQPyL Official Site](http://www.uq-pyl.com) (**#TODO**: Needs update)
|
|
16
|
+
- **Source Code**: [GitHub Repository](https://github.com/smasky/UQPyL/)
|
|
17
|
+
- **Documentation**: [ReadTheDocs](https://uqpyl.readthedocs.io/en/latest/)(**#TODO**: Being updating )
|
|
18
|
+
- **Citation Info**: [UQPyL 2.0](**#TODO**: Needs update), [UQPyL 1.0](https://www.sciencedirect.com/science/article/pii/S1364815215300955)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Included Methods and Algorithms
|
|
23
|
+
|
|
24
|
+
### Sensitivity Analysis
|
|
25
|
+
|
|
26
|
+
(All methods support surrogate models)
|
|
27
|
+
- Sobol'
|
|
28
|
+
- Delta Test (DT)
|
|
29
|
+
- Extended Fourier Amplitude Sensitivity Test (eFAST)
|
|
30
|
+
- Random Balance Designs - Fourier Amplitude Sensitivity Test (RBD-FAST)
|
|
31
|
+
- Multivariate Adaptive Regression Splines-Sensitivity Analysis (MARS-SA)
|
|
32
|
+
- Morris
|
|
33
|
+
- Regional Sensitivity Analysis (RSA)
|
|
34
|
+
|
|
35
|
+
### Optimization Algorithms
|
|
36
|
+
|
|
37
|
+
(* indicates solving computational expensive optimization problem)
|
|
38
|
+
- **Single Objective Optimization**: SCE-UA, ML-SCE-UA, GA, CSA, PSO, DE, ABC, ASMO*, EGO*
|
|
39
|
+
- **Multi-Objective Optimization**: MOEA/D, NSGA-II, RVEA, MOASMO*
|
|
40
|
+
|
|
41
|
+
*Note: The library is still being updated. If you need other algorithms, please contact us.*
|
|
42
|
+
|
|
43
|
+
### Surrogate Models
|
|
44
|
+
|
|
45
|
+
- Fully Connected Neural Network (FCNN)
|
|
46
|
+
- Kriging (KRG)
|
|
47
|
+
- Gaussian Process (GP)
|
|
48
|
+
- Linear Regression (LR)
|
|
49
|
+
- Polynomial Regression (PR)
|
|
50
|
+
- Radial Basis Function (RBF)
|
|
51
|
+
- Support Vector Machine (SVM)
|
|
52
|
+
- Multivariate Adaptive Regression Splines (MARS)
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
Recommended (PyPi or Conda):
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install UQPyL
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
conda install UQPyL
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Alternatively:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
git clone https://github.com/smasky/UQPyL.git
|
|
72
|
+
cd UQPyL
|
|
73
|
+
pip install .
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Quick Start
|
|
79
|
+
|
|
80
|
+
To use UQPyL, define the problem you want to solve. The problem usually contains three important properties:
|
|
81
|
+
1. `func` (the mapping from X to Y)
|
|
82
|
+
2. The dimensions of decisions and outputs
|
|
83
|
+
3. The bounds of decisions (ub, lb)
|
|
84
|
+
|
|
85
|
+
### Benchmark Problems
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from UQPyL.problems.single_objective import Sphere
|
|
89
|
+
|
|
90
|
+
problem = Sphere(nInput=10, ub=100, lb=-100)
|
|
91
|
+
problem = Sphere(nInput=10, ub=np.ones(10)*100, lb=np.ones(10)*-100)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Practical Problems
|
|
95
|
+
|
|
96
|
+
Define the evaluation function:
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
from UQPyL.problems import PracticalProblem
|
|
100
|
+
|
|
101
|
+
def func(X):
|
|
102
|
+
Y = np.sum(X, axis=1).reshape(-1, 1)
|
|
103
|
+
return Y
|
|
104
|
+
|
|
105
|
+
problem = PracticalProblem(func=func, nInput=10, nOutput=1, ub=100, lb=-100, name="Sphere")
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Note:** The `func` needs to accept a matrix of X and return a matrix of Y, with columns equal to dimensions and rows equal to samples. X and Y should be np.ndarray.
|
|
109
|
+
|
|
110
|
+
After defining the problem, you can use any methods in UQPyL.
|
|
111
|
+
|
|
112
|
+
### Sensitivity Analysis
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from UQPyL.sensibility import Sobol
|
|
116
|
+
|
|
117
|
+
sobol = Sobol() # Instantiate and set hyper-parameters
|
|
118
|
+
sobol.analyze(problem)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Optimization
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
from UQPyL.optimization.single_objective import SCE_UA
|
|
125
|
+
|
|
126
|
+
sce = SCE_UA()
|
|
127
|
+
res = sce.run(problem)
|
|
128
|
+
bestDec = res.bestDec
|
|
129
|
+
bestObj = res.bestObj
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Surrogate Modeling
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from UQPyL.DoE import LHS
|
|
136
|
+
|
|
137
|
+
lhs = LHS(problem)
|
|
138
|
+
xTrain = lhs.sample(200, problem.nInput)
|
|
139
|
+
yTrain = problem.evaluate(xTrain)
|
|
140
|
+
|
|
141
|
+
xTest = lhs.sample(50, problem.nInput)
|
|
142
|
+
yTest = problem.evaluate(xTest)
|
|
143
|
+
|
|
144
|
+
from UQPyL.surrogate.rbf import RBF
|
|
145
|
+
|
|
146
|
+
rbf = RBF()
|
|
147
|
+
rbf.fit(xTrain, yTrain)
|
|
148
|
+
yPred = rbf.predict(xTest)
|
|
149
|
+
|
|
150
|
+
from UQPyL.utility.metric import r_square
|
|
151
|
+
r2 = r_square(yTest, yPred)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
For more advanced usage, please refer to the documentation (**#TODO**).
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Call for Contributions
|
|
159
|
+
|
|
160
|
+
We welcome contributions to expand our library with more sophisticated UQ methods, optimization algorithms and engineering problems.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Contact
|
|
165
|
+
|
|
166
|
+
For any inquiries or contributions, please contact:
|
|
167
|
+
|
|
168
|
+
**wmtSky**
|
|
169
|
+
Email: [wmtsky@hhu.edu.cn](mailto:wmtsky@hhu.edu.cn), [wmtsmasky@gmail.com](mailto:wmtsmasky@gmail.com)
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
*This project is licensed under the MIT License - see the [LICENSE](https://github.com/smasky/UQPyL/LICENSE) file for details.*
|
|
174
|
+
|
|
175
|
+

|
|
176
|
+

|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from .lhs import LHS
|
|
2
2
|
from .full_fact import FFD
|
|
3
3
|
from .random import Random
|
|
4
|
-
from .
|
|
4
|
+
from .samplerABC import Sampler
|
|
5
5
|
from .sobol_sequence import Sobol_Sequence
|
|
6
6
|
from .fast_sequence import FAST_Sequence
|
|
7
7
|
from .morris_sequence import Morris_Sequence
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import numpy as np
|
|
2
|
+
from typing import Union, Optional
|
|
2
3
|
|
|
3
|
-
from .
|
|
4
|
-
|
|
4
|
+
from .samplerABC import Sampler, decoratorRescale
|
|
5
|
+
from ..problems import ProblemABC as Problem
|
|
5
6
|
class FAST_Sequence(Sampler):
|
|
6
7
|
'''
|
|
7
8
|
The sample technique for FAST(Fourier Amplitude Sensitivity Test) method
|
|
@@ -15,17 +16,14 @@ class FAST_Sequence(Sampler):
|
|
|
15
16
|
Methods:
|
|
16
17
|
__call__ or sample: Generate a sample for FAST method
|
|
17
18
|
|
|
18
|
-
Examples:
|
|
19
|
-
>>> fast_seq=FAST_Sequence()
|
|
20
|
-
>>> samples=fast_seq(5, 4) or fast_seq.sample(5,4)
|
|
21
|
-
|
|
22
19
|
'''
|
|
23
20
|
def __init__(self, M: int=4):
|
|
24
21
|
|
|
25
22
|
super().__init__()
|
|
26
|
-
self.M=M
|
|
27
23
|
|
|
28
|
-
|
|
24
|
+
self.M=M
|
|
25
|
+
|
|
26
|
+
def _generate(self, nt: int, nx: int):
|
|
29
27
|
'''
|
|
30
28
|
Generate a shape of (nt*nx, nx) sample for FAST
|
|
31
29
|
|
|
@@ -55,7 +53,7 @@ class FAST_Sequence(Sampler):
|
|
|
55
53
|
|
|
56
54
|
s=(2*np.pi/nt)*np.arange(nt)
|
|
57
55
|
|
|
58
|
-
|
|
56
|
+
xInit=np.zeros((nt*nx, nx))
|
|
59
57
|
w_tmp=np.zeros(nx)
|
|
60
58
|
|
|
61
59
|
for i in range(nx):
|
|
@@ -66,11 +64,25 @@ class FAST_Sequence(Sampler):
|
|
|
66
64
|
phi=2*np.pi*np.random.rand()
|
|
67
65
|
sin_result=np.sin(w_tmp[:,None]*s+phi)
|
|
68
66
|
arsin_result=(1/np.pi)*np.arcsin(sin_result) #saltelli formula
|
|
69
|
-
|
|
67
|
+
xInit[idx, :]=0.5+arsin_result.transpose()
|
|
70
68
|
|
|
71
|
-
return
|
|
69
|
+
return xInit
|
|
72
70
|
|
|
73
|
-
|
|
71
|
+
@decoratorRescale
|
|
72
|
+
def sample(self, nt: int, nx: Optional[int] = None, problem: Optional[Problem] = None, random_seed: Optional[int] = None):
|
|
73
|
+
|
|
74
|
+
if random_seed is not None:
|
|
75
|
+
self.random_state = np.random.RandomState(random_seed)
|
|
76
|
+
else:
|
|
77
|
+
self.random_state = np.random.RandomState()
|
|
78
|
+
|
|
79
|
+
if problem is not None and nx is not None:
|
|
80
|
+
if(problem.nInput!=nx):
|
|
81
|
+
raise ValueError('The input dimensions of the problem and the samples must be the same')
|
|
82
|
+
elif problem is None and nx is None:
|
|
83
|
+
raise ValueError('Either the problem or the input dimensions must be provided')
|
|
84
|
+
|
|
85
|
+
nx=problem.nInput if problem is not None else nx
|
|
74
86
|
|
|
75
87
|
return self._generate(nt, nx)
|
|
76
88
|
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from typing import Union, Optional
|
|
3
|
+
from itertools import product
|
|
4
|
+
|
|
5
|
+
from .samplerABC import Sampler, decoratorRescale
|
|
6
|
+
from ..problems import ProblemABC as Problem
|
|
7
|
+
|
|
8
|
+
class FFD(Sampler):
|
|
9
|
+
'''
|
|
10
|
+
Full Factorial Design
|
|
11
|
+
|
|
12
|
+
Methods:
|
|
13
|
+
__call__ or sample: Generate a Latin-hypercube design
|
|
14
|
+
|
|
15
|
+
'''
|
|
16
|
+
|
|
17
|
+
#Abandon
|
|
18
|
+
# def __call__(self, nx: int, levels: Union[np.ndarray, int, list]) -> np.ndarray:
|
|
19
|
+
|
|
20
|
+
# return self._generate(nx, levels)
|
|
21
|
+
|
|
22
|
+
def _generate(self, levels: Union[np.ndarray, int, list], nx: int):
|
|
23
|
+
|
|
24
|
+
if isinstance(levels, int):
|
|
25
|
+
levels = [levels]*nx
|
|
26
|
+
elif isinstance(levels, np.ndarray):
|
|
27
|
+
levels = levels.ravel().tolist()
|
|
28
|
+
|
|
29
|
+
if len(levels)!=nx:
|
|
30
|
+
raise ValueError('The length of levels should be equal to nx or 1')
|
|
31
|
+
|
|
32
|
+
factor_levels = [np.linspace(0, 1, num=level)[:level] for level in levels]
|
|
33
|
+
|
|
34
|
+
factor_combinations = list(product(*factor_levels))
|
|
35
|
+
|
|
36
|
+
H = np.array(factor_combinations)
|
|
37
|
+
|
|
38
|
+
return H
|
|
39
|
+
|
|
40
|
+
@decoratorRescale
|
|
41
|
+
def sample(self, levels: Union[np.ndarray, int, list], nx: Optional[int] = None, problem: Optional[Problem] = None, random_seed: Optional[int] = None):
|
|
42
|
+
'''
|
|
43
|
+
Parameters:
|
|
44
|
+
nx: int
|
|
45
|
+
The number of input dimensions
|
|
46
|
+
|
|
47
|
+
levels: Union[np.ndarray, int, list]
|
|
48
|
+
The levels for each input dimension
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
H: 2d-array
|
|
52
|
+
An n-by-samples design matrix between zero and one.
|
|
53
|
+
'''
|
|
54
|
+
|
|
55
|
+
if random_seed is not None:
|
|
56
|
+
self.random_state = np.random.RandomState(random_seed)
|
|
57
|
+
else:
|
|
58
|
+
self.random_state = np.random.RandomState()
|
|
59
|
+
|
|
60
|
+
if problem is not None and nx is not None:
|
|
61
|
+
if(problem.nInput!=nx):
|
|
62
|
+
raise ValueError('The input dimensions of the problem and the samples must be the same')
|
|
63
|
+
elif problem is None and nx is None:
|
|
64
|
+
raise ValueError('Either the problem or the input dimensions must be provided')
|
|
65
|
+
|
|
66
|
+
nx=problem.nInput if problem is not None else nx
|
|
67
|
+
|
|
68
|
+
return self._generate(levels, nx)
|
|
@@ -2,9 +2,9 @@ import numpy as np
|
|
|
2
2
|
from typing import Literal, Optional
|
|
3
3
|
from scipy.spatial.distance import pdist
|
|
4
4
|
|
|
5
|
-
from ..problems import Problem
|
|
5
|
+
from ..problems import ProblemABC as Problem
|
|
6
6
|
|
|
7
|
-
from .
|
|
7
|
+
from .samplerABC import Sampler, decoratorRescale
|
|
8
8
|
|
|
9
9
|
# from ._lhs import _lhs_classic, _lhs_centered, _lhs_correlate, _lhs_maximin, _lhs_centered_maximin
|
|
10
10
|
|
|
@@ -136,22 +136,17 @@ class LHS(Sampler):
|
|
|
136
136
|
|
|
137
137
|
Methods:
|
|
138
138
|
__call__ or sample: Generate a Latin-hypercube design
|
|
139
|
-
|
|
140
|
-
Examples:
|
|
141
|
-
>>>lhs=LHS('classic')
|
|
142
|
-
>>>samples=lhs(5,10) or samples=lhs.sample(5,10)
|
|
143
|
-
|
|
139
|
+
|
|
144
140
|
'''
|
|
145
|
-
def __init__(self, criterion: Criterion ='classic', iterations: int=5
|
|
141
|
+
def __init__(self, criterion: Criterion ='classic', iterations: int=5):
|
|
146
142
|
|
|
147
143
|
self.criterion=criterion
|
|
148
144
|
self.iterations=iterations
|
|
149
|
-
self.problem=problem
|
|
150
145
|
|
|
151
146
|
#initial random state
|
|
152
|
-
|
|
147
|
+
super().__init__()
|
|
153
148
|
|
|
154
|
-
def _generate(self, nt: int, nx:
|
|
149
|
+
def _generate(self, nt: int, nx:int=None):
|
|
155
150
|
'''
|
|
156
151
|
Generate a Latin-hypercube design
|
|
157
152
|
|
|
@@ -167,27 +162,20 @@ class LHS(Sampler):
|
|
|
167
162
|
are uniformly spaced between zero and one.
|
|
168
163
|
'''
|
|
169
164
|
|
|
170
|
-
if self.problem is not None:
|
|
171
|
-
if(self.problem.n_input!=nx):
|
|
172
|
-
raise ValueError('The input dimensions of the problem and the samples must be the same')
|
|
173
|
-
|
|
174
165
|
if self.criterion not in LHS_METHOD:
|
|
175
166
|
raise ValueError('The criterion must be one of {}'.format(LHS_METHOD.keys()))
|
|
176
167
|
|
|
177
168
|
Sampling_method=LHS_METHOD[self.criterion]
|
|
178
169
|
|
|
179
170
|
if self.criterion in ['maximin', 'center_maximin', 'correlation']:
|
|
180
|
-
|
|
171
|
+
xInit=Sampling_method(nt, nx, self.iterations, self.random_state)
|
|
181
172
|
else:
|
|
182
|
-
|
|
173
|
+
xInit=Sampling_method(nt, nx, self.random_state)
|
|
183
174
|
|
|
184
|
-
|
|
185
|
-
if self.problem is not None:
|
|
186
|
-
X=X*(self.problem.ub-self.problem.lb)+self.problem.lb
|
|
187
|
-
|
|
188
|
-
return X
|
|
175
|
+
return xInit
|
|
189
176
|
|
|
190
|
-
|
|
177
|
+
@decoratorRescale
|
|
178
|
+
def sample(self, nt: int, nx:int = None, problem: Problem = None, random_seed: Optional[int] = None) -> np.ndarray:
|
|
191
179
|
'''
|
|
192
180
|
Generate a Latin-hypercube design
|
|
193
181
|
|
|
@@ -212,4 +200,12 @@ class LHS(Sampler):
|
|
|
212
200
|
else:
|
|
213
201
|
self.random_state = np.random.RandomState()
|
|
214
202
|
|
|
203
|
+
if problem is not None and nx is not None:
|
|
204
|
+
if(problem.nInput!=nx):
|
|
205
|
+
raise ValueError('The input dimensions of the problem and the samples must be the same')
|
|
206
|
+
elif problem is None and nx is None:
|
|
207
|
+
raise ValueError('Either the problem or the input dimensions must be provided')
|
|
208
|
+
|
|
209
|
+
nx=problem.nInput if problem is not None else nx
|
|
210
|
+
|
|
215
211
|
return self._generate(nt, nx)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import numpy as np
|
|
2
|
+
from typing import Optional
|
|
2
3
|
|
|
3
|
-
from .
|
|
4
|
+
from .samplerABC import Sampler, decoratorRescale
|
|
5
|
+
from ..problems import ProblemABC as Problem
|
|
4
6
|
|
|
5
7
|
class Morris_Sequence(Sampler):
|
|
6
8
|
'''
|
|
@@ -24,8 +26,8 @@ class Morris_Sequence(Sampler):
|
|
|
24
26
|
|
|
25
27
|
super().__init__()
|
|
26
28
|
self.num_levels=num_levels
|
|
27
|
-
|
|
28
|
-
def _generate(self, nt: int, nx: int)
|
|
29
|
+
|
|
30
|
+
def _generate(self, nt: int, nx: int):
|
|
29
31
|
'''
|
|
30
32
|
Generate a shape of (nt*nx, nx) sample for FAST
|
|
31
33
|
|
|
@@ -40,17 +42,33 @@ class Morris_Sequence(Sampler):
|
|
|
40
42
|
An n-by-samples design matrix that has been normalized so factor values
|
|
41
43
|
are uniformly spaced between zero and one.
|
|
42
44
|
'''
|
|
43
|
-
|
|
45
|
+
xInit=np.zeros((nt*(nx+1), nx))
|
|
44
46
|
|
|
45
47
|
for i in range(nt):
|
|
46
|
-
|
|
48
|
+
xInit[i*(nx+1):(i+1)*(nx+1), :]=self._generate_trajectory(nx)
|
|
47
49
|
|
|
48
|
-
return
|
|
50
|
+
return xInit
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
@decoratorRescale
|
|
53
|
+
def sample(self, nt: int, nx: Optional[int]=None, problem: Optional[Problem]=None, random_seed: Optional[int] = None):
|
|
54
|
+
|
|
55
|
+
if random_seed is not None:
|
|
56
|
+
self.random_state = np.random.RandomState(random_seed)
|
|
57
|
+
else:
|
|
58
|
+
self.random_state = np.random.RandomState()
|
|
59
|
+
|
|
60
|
+
if problem is not None and nx is not None:
|
|
61
|
+
if(problem.nInput!=nx):
|
|
62
|
+
raise ValueError('The input dimensions of the problem and the samples must be the same')
|
|
63
|
+
elif problem is None and nx is None:
|
|
64
|
+
raise ValueError('Either the problem or the input dimensions must be provided')
|
|
65
|
+
|
|
66
|
+
nx=problem.nInput if problem is not None else nx
|
|
67
|
+
|
|
68
|
+
self._generate(nt, nx)
|
|
69
|
+
|
|
70
|
+
def _generate_trajectory(self, nx: int):
|
|
52
71
|
|
|
53
|
-
'''
|
|
54
72
|
delta=self.num_levels/(2*(self.num_levels-1))
|
|
55
73
|
|
|
56
74
|
B=np.tril(np.ones([nx + 1, nx], dtype=int), -1)
|