UQPyL 2.1.2__tar.gz → 2.1.3__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.1.2 → UQPyL-2.1.3}/PKG-INFO +205 -137
- {UQPyL-2.1.2 → UQPyL-2.1.3}/README.md +204 -136
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/DoE/samplerABC.py +1 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/__init__.py +1 -1
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/multi_objective/moea_d.py +1 -2
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/multi_objective/nsga_ii.py +1 -1
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/multi_objective/nsga_iii.py +1 -1
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/multi_objective/rvea.py +1 -1
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/result.py +1 -1
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/problems/single_objective/single_simple_problem.py +1 -1
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/mars/core/_basis.c +180 -198
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/mars/core/_forward.c +180 -198
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/mars/core/_knot_search.c +180 -198
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/mars/core/_pruning.c +180 -198
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/mars/core/_qr.c +180 -198
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/mars/core/_record.c +180 -198
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/mars/core/_types.c +180 -198
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/mars/core/_util.c +180 -198
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/regression/lasso/lasso_fast.c +181 -199
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL.egg-info/PKG-INFO +205 -137
- {UQPyL-2.1.2 → UQPyL-2.1.3}/pyproject.toml +1 -1
- {UQPyL-2.1.2 → UQPyL-2.1.3}/setup.py +1 -1
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/DoE/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/DoE/fast_sequence.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/DoE/full_fact.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/DoE/lhs.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/DoE/morris_sequence.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/DoE/random.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/DoE/saltelli_sequence.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/DoE/sobol_sequence.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/algorithmABC.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/metric/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/metric/gd.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/metric/hv.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/metric/igd.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/multi_objective/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/multi_objective/moasmo.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/population.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/single_objective/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/single_objective/abc.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/single_objective/asmo.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/single_objective/csa.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/single_objective/de.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/single_objective/ego.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/single_objective/ga.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/single_objective/ml_sce_ua.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/single_objective/pso.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/single_objective/sce_ua.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/utility_functions/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/utility_functions/crowding_distance.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/utility_functions/ndsort.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/utility_functions/operation_GA.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/utility_functions/tournament_selection.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/optimization/utility_functions/uniform_point.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/problems/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/problems/multi_objective/DTLZ.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/problems/multi_objective/ZDT.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/problems/multi_objective/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/problems/problem.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/problems/problemABC.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/problems/single_objective/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/problems/single_objective/single_constraint_problem.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/problems/utility_functions/NDsort.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/problems/utility_functions/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/problems/utility_functions/uniformPoint.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/sensibility/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/sensibility/delta_test.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/sensibility/fast.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/sensibility/mars_sa.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/sensibility/morris.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/sensibility/rbd_fast.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/sensibility/rsa.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/sensibility/saABC.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/sensibility/sobol.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/auto_tuner.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/fnn/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/fnn/_activation_funcs.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/fnn/base.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/fnn/fully_connect_neural_network.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/gp/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/gp/gaussian_process.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/gp/kernel/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/gp/kernel/base_kernel.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/gp/kernel/c_kernel_.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/gp/kernel/dot_kernel_.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/gp/kernel/matern_kernel.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/gp/kernel/rbf_kernel.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/gp/kernel/rq_kernel.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/kriging/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/kriging/kernel/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/kriging/kernel/base_kernel.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/kriging/kernel/cubic_kernel.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/kriging/kernel/exp_kernel.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/kriging/kernel/guass_kernel.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/kriging/kriging.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/mars/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/mars/core/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/mars/mars.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/rbf/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/rbf/kernel/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/rbf/kernel/base_kernel.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/rbf/kernel/cubic_kernel.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/rbf/kernel/gaussian_kernel.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/rbf/kernel/linear_kernel.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/rbf/kernel/multiquadric_kernel.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/rbf/kernel/thin_plate_spline_kernel.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/rbf/radial_basis_function.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/regression/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/regression/lasso/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/regression/linear_regression.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/regression/polynomial_regression.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/setting.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/surrogateABC.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/svr/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/svr/core/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/svr/core/libsvm_interface.cpp +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/svr/core/svm.cpp +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/svr/support_vector_machine.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/util/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/util/adam.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/surrogates/util/boxmin.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/utility/__init__.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/utility/data_selections.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/utility/metrics.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/utility/polynomial_features.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/utility/scalers.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL/utility/verbose.py +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL.egg-info/SOURCES.txt +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL.egg-info/dependency_links.txt +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL.egg-info/requires.txt +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/UQPyL.egg-info/top_level.txt +0 -0
- {UQPyL-2.1.2 → UQPyL-2.1.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: UQPyL
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.3
|
|
4
4
|
Summary: A python package for parameter uncertainty quantification and optimization
|
|
5
5
|
Author: wmtSky
|
|
6
6
|
Author-email: wmtSky <wmtsky@hhu.edu.cn>
|
|
@@ -16,13 +16,15 @@ Description-Content-Type: text/markdown
|
|
|
16
16
|
|
|
17
17
|
# UQPyL: Uncertainty Quantification Python Lab
|
|
18
18
|
|
|
19
|
-
<p align="center"><img src="
|
|
19
|
+
<p align="center"><img src="./docs/UQ.svg" width="400"/></p>
|
|
20
20
|
|
|
21
21
|
[](https://badge.fury.io/py/UQPyL)     
|
|
22
22
|
|
|
23
23
|
**UQPyL** is a Python package for **Uncertainty Quantification** and **Optimization** of computational models and their associated problems (e.g., model calibration, resource scheduling, product design). It includes a wide range of methods and algorithms for Design of Experiments, Sensitivity Analysis, Optimization (Single- and Multi-objective). Additionally, **Surrogate Models** are built-in for solving computationally expensive problems.
|
|
24
24
|
|
|
25
|
-
👉[
|
|
25
|
+
👉[中文简介](https://github.com/smasky/UQPyL/blob/dev/README_CN.md)
|
|
26
|
+
|
|
27
|
+
👉[Documentation](https://uqpyl.readthedocs.io/en/latest/)
|
|
26
28
|
|
|
27
29
|
## Contents
|
|
28
30
|
|
|
@@ -41,10 +43,10 @@ Description-Content-Type: text/markdown
|
|
|
41
43
|
|
|
42
44
|
|
|
43
45
|
## ✨ Main Features
|
|
44
|
-
1. **Comprehensive Sensitivity Analysis and Optimization**: Implements widely used sensitivity analysis
|
|
46
|
+
1. **Comprehensive Sensitivity Analysis and Optimization**: Implements widely used sensitivity analysis methods and optimization algorithms.
|
|
45
47
|
2. **Running Display and Result Save**: Enable users to track and save the history and results of their running.
|
|
46
|
-
3. **Advanced Surrogate Modeling**:
|
|
47
|
-
4. **Rich Application Resources**: Provides a
|
|
48
|
+
3. **Advanced Surrogate Modeling**: Integrate various surrogate models and an auto-tunning tool to enhance these model performances.
|
|
49
|
+
4. **Rich Application Resources**: Provides a suite of benchmark problems and practical case studies, enabling users to get started quickly. (👉**Recent Planing:** For water science research, we plan to customize the interface to integrate water-related models with UQPyL, enhancing usability and functionality, like [SWAT-UQ](https://github.com/smasky/SWAT-UQ). So, **if you have interest, please contact us to collaborate.**).
|
|
48
50
|
5. **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**)
|
|
49
51
|
|
|
50
52
|
## ⚙️ Installation
|
|
@@ -73,8 +75,8 @@ pip install .
|
|
|
73
75
|
|
|
74
76
|
- **Website**: [UQPyL Official Site](http://www.uq-pyl.com) (**TODO**: Needs update)
|
|
75
77
|
- **Source Code**: [GitHub Repository](https://github.com/smasky/UQPyL/)
|
|
76
|
-
- **Documentation**: [ReadTheDocs](https://uqpyl.readthedocs.io/en/latest/)
|
|
77
|
-
- **Citation Infos**: [UQPyL 2.0](
|
|
78
|
+
- **Documentation**: [ReadTheDocs](https://uqpyl.readthedocs.io/en/latest/)
|
|
79
|
+
- **Citation Infos**: [UQPyL 2.0](Future update), [UQPyL 1.0](https://www.sciencedirect.com/science/article/pii/S1364815215300955)
|
|
78
80
|
|
|
79
81
|
---
|
|
80
82
|
|
|
@@ -92,7 +94,7 @@ pip install .
|
|
|
92
94
|
|Morris| \ |[Morris, (2012)](https://www.tandfonline.com/doi/abs/10.1080/00401706.1991.10484804)|
|
|
93
95
|
|RSA| Regional Sensitivity Analysis | [Hornberger, Spear, (1981)](https://www.osti.gov/biblio/6396608), [Pianosi (2016)](https://www.sciencedirect.com/science/article/pii/S1364815216300287) |
|
|
94
96
|
|
|
95
|
-
💡 **Noted:** All methods now support for
|
|
97
|
+
💡 **Noted:** All methods now support for integrating surrogate models. (Please check [this tutorial](https://uqpyl.readthedocs.io/en/latest/surrogate_model.html#sensitivity-analysis-with-surrogate-models))
|
|
96
98
|
|
|
97
99
|
🚀 **Credits:** Special thanks to the [SALib](https://github.com/SALib/SALib) project for inspiring parts of the implementation.
|
|
98
100
|
|
|
@@ -108,7 +110,7 @@ pip install .
|
|
|
108
110
|
| DE | Differential Evolution | Single | [Storn and Price (1997)](https://link.springer.com/article/10.1023/a:1008202821328) |
|
|
109
111
|
| ABC |Artificial Bee Colony | Single | [Karaboga (2005)](https://abc.erciyes.edu.tr/pub/tr06_2005.pdf) |
|
|
110
112
|
| ASMO | Adaptive Surrogate Modelling based Optimization | Single, Surrogate | [Wang et al.(2014)](https://www.sciencedirect.com/science/article/pii/S1364815214001698) |
|
|
111
|
-
| EGO | Efficient Global Optimization | Single, Surrogate | [Jones (1998)](https://link.springer.com/article/10.1023/A:1008306431147)
|
|
113
|
+
| EGO | Efficient Global Optimization | Single, Surrogate | [Jones (1998)](https://link.springer.com/article/10.1023/A:1008306431147) |
|
|
112
114
|
| MOEA/D | Multi-objective Evolutionary Algorithm based on Decomposition | Multiple | [Zhang, Li (2007)](https://ieeexplore.ieee.org/document/4358754)|
|
|
113
115
|
| NSGA-II| Nondominated Sorting Genetic Algorithm II | Multiple | [Deb et al. (2002)](https://ieeexplore.ieee.org/document/996017)|
|
|
114
116
|
| NSGA-III| Nondominated Sorting Genetic Algorithm III| Multiple | [Deb, Jain (2014)](https://ieeexplore.ieee.org/document/6600851)|
|
|
@@ -137,21 +139,21 @@ pip install .
|
|
|
137
139
|
|
|
138
140
|
| Name | Formula | Optimal Solution | Optima |
|
|
139
141
|
|------|---------|------------------|--------|
|
|
140
|
-
|Sphere| <img src="
|
|
141
|
-
|Schwefel_2_22| <img src="
|
|
142
|
-
|Schwefel_1_22| <img src="
|
|
143
|
-
|Schwefel_2_21| <img src="
|
|
144
|
-
|Schwefel_2_26 | <img src="
|
|
145
|
-
| Rosenbrock | <img src="
|
|
146
|
-
| Step | <img src="
|
|
147
|
-
| Quartic | <img src="
|
|
148
|
-
| Rastrigin | <img src="
|
|
149
|
-
| Ackley | <img src="
|
|
150
|
-
| Griewank | <img src="
|
|
151
|
-
| Trid | <img src="
|
|
152
|
-
| Bent_Cigar | <img src="
|
|
153
|
-
| Discus | <img src="
|
|
154
|
-
| Weierstrass | <img src="
|
|
142
|
+
|Sphere| <img src="./docs/pic/Sphere.svg" /> | ( 0, 0, 0 ... 0 ) | 0.0 |
|
|
143
|
+
|Schwefel_2_22| <img src="./docs/pic/Schwefel_2_22.svg" /> | ( 0, 0, 0 ... 0 ) | 0.0 |
|
|
144
|
+
|Schwefel_1_22| <img src="./docs/pic/Schwefel_1_22.svg" /> | ( 0, 0, 0 ... 0 ) | 0.0 |
|
|
145
|
+
|Schwefel_2_21| <img src="./docs/pic/Schwefel_2_21.svg" /> | ( 0, 0, 0 ... 0 ) | 0.0 |
|
|
146
|
+
|Schwefel_2_26 | <img src="./docs/pic/Schwefel_2_26.svg" /> | (420.9687 ... 420.9687) | -12569.5 |
|
|
147
|
+
| Rosenbrock | <img src="./docs/pic/Rosenbrock.svg" /> | ( 0, 0, 0 ... 0 ) | 0.0 |
|
|
148
|
+
| Step | <img src="./docs/pic/Step.svg" /> | ( 1, 1, 1 ... 1) | 0.0 |
|
|
149
|
+
| Quartic | <img src="./docs/pic/Quartic.svg" /> | ( 1, 1, 1 ... 1) | 0.0 |
|
|
150
|
+
| Rastrigin | <img src="./docs/pic/Rastrigin.svg" /> | ( 0, 0, 0 ... 0 ) | 0.0 |
|
|
151
|
+
| Ackley | <img src="./docs/pic/Ackley.svg" /> | ( 0, 0, 0 ... 0 ) | 0.0 |
|
|
152
|
+
| Griewank | <img src="./docs/pic/Griewank.svg" /> | ( 0, 0, 0 ... 0) | 0.0 |
|
|
153
|
+
| Trid | <img src="./docs/pic/Trid.svg" /> | <img src="docs/pic/Trid_solution.svg">| `-D(D+4)(D-1)/6` |
|
|
154
|
+
| Bent_Cigar | <img src="./docs/pic/Bent_Cigar.svg" /> |(0, 0, 0 ... 0) | 0.0 |
|
|
155
|
+
| Discus | <img src="./docs/pic/Discus.svg" /> | (0, 0, 0 ... 0) | 0.0 |
|
|
156
|
+
| Weierstrass | <img src="./docs/pic/Weierstrass.svg" /> | (0, 0, 0 ... 0) | 0.0 |
|
|
155
157
|
|
|
156
158
|
### Multi-objective Problems
|
|
157
159
|
|
|
@@ -178,140 +180,189 @@ pip install .
|
|
|
178
180
|
|
|
179
181
|
## 🍭 Quick Start
|
|
180
182
|
|
|
181
|
-
To effectively use UQPyL, the
|
|
182
|
-
1. The **basic information** of the problem, e.g., the dimension, range, value type (float, int, or discrete) of each variable, name of the problem, decisions, objectives.
|
|
183
|
-
2. The **function** from input variables `x` to output objective `obj` named `objFunc` in UQPyL, i.e., how the output `obj` is obtained from the inputs `x`, which could be an analytical function, or include running computational model, external black-box process. If necessary, the constraint functions named `concFunc` should be implemented.
|
|
183
|
+
To effectively use UQPyL, the key is to define the solved problem, including:
|
|
184
184
|
|
|
185
|
-
|
|
185
|
+
1. The **basic information** of the problem, e.g., the dimension, range, type (float, int, or discrete) of each variable, the name of the problem, decisions, objectives, constraints.
|
|
186
186
|
|
|
187
|
-
|
|
187
|
+
2. The **objective function** that describe how the output `obj` is obtained from the inputs `x`, referred to as `objFunc` in UQPyL. The `objFunc` can be a mathematical formula, computational model with pre- and post-processing, or external black-box process.
|
|
188
188
|
|
|
189
|
-
|
|
189
|
+
3. If required, the **constraint function** should be implemented, referred to as `conFunc`, which contains one or more constraints that the inputs x must satisfy.
|
|
190
190
|
|
|
191
|
+
Take the variant of the Rosenbrock function as example:
|
|
191
192
|
|
|
192
|
-
<
|
|
193
|
+
<p align="center"><img src="./docs/pic/Problem1.svg" width=500/></p>
|
|
194
|
+
|
|
195
|
+
Compared to original Rosenbrock, this problem involve extra constraint functions ( $x_1^2+x_2^2+x_3^2 \ge 4$ ) and changes the variable types, from the origin `continuous` and `float` to `int` ( $x_2$ ) and `discrete` ( $x_3$ ).
|
|
193
196
|
|
|
197
|
+
Now, we use this problem to specifically introducing:
|
|
198
|
+
|
|
199
|
+
<a href="https://nbviewer.org/github/smasky/UQPyL/blob/dev/notebooks/defefine_problem.ipynb" target="_blank">📘 View Jupyter Notebook example online </a>
|
|
194
200
|
|
|
195
201
|
```python
|
|
196
|
-
#
|
|
202
|
+
# For simplifying the process of defining problem, UQPyL provide a `Problem` class
|
|
203
|
+
|
|
204
|
+
# Step 1: Import `Problem` class from the `problems` module of UQPyL
|
|
197
205
|
from UQPyL.problems import Problem
|
|
198
206
|
|
|
199
|
-
# Step 2:
|
|
200
|
-
# The
|
|
201
|
-
#
|
|
202
|
-
#
|
|
203
|
-
#
|
|
204
|
-
#
|
|
205
|
-
#
|
|
207
|
+
# Step 2: Defining the `objFunc` function
|
|
208
|
+
# The `objFunc` function takes a 2-dimensional(2D) NumPy array `X` as input and
|
|
209
|
+
# returns a 2D NumPy array `objs` as output.
|
|
210
|
+
#
|
|
211
|
+
# Input:
|
|
212
|
+
# X = [ [1, 2, 3], # Each row represents a decision (or solution)
|
|
213
|
+
# [4, 5, 6], # Each column represents a specific variable
|
|
214
|
+
# [7, 8, 9] ]
|
|
215
|
+
#
|
|
216
|
+
# Output:
|
|
217
|
+
# objs = [ [1], # Each row represents the objective value(s)
|
|
218
|
+
# [2], corresponding to a decision in `X`
|
|
219
|
+
# [3] ]
|
|
220
|
+
#
|
|
221
|
+
# Note:
|
|
222
|
+
# - If there are N decisions and M objectives, the shape of `objs` should be (N, M)
|
|
223
|
+
# - Users must ensure that `objs` is a 2D NumPy array
|
|
224
|
+
|
|
225
|
+
def objFunc(X):
|
|
226
|
+
# If possible, advise vectorizing operations on matrix X
|
|
227
|
+
# to improve computational efficiency.
|
|
206
228
|
|
|
207
|
-
def objFunc(X):
|
|
208
|
-
# If possible, advise vectorizing operations on matrix X to improve computational efficiency.
|
|
209
229
|
objs =100 * (X[:, 2] - X[:, 1]**2)**2+ 100 * (X[:, 1] - X[:, 0]**2)**2 + \
|
|
210
|
-
(1 - X[:, 1])**2 + (1 - X[:, 0])**2
|
|
211
|
-
|
|
230
|
+
(1 - X[:, 1])**2 + (1 - X[:, 0])**2
|
|
231
|
+
|
|
232
|
+
return objs[:, None] # Ensure the returned `objs` is a 2D numpy array.
|
|
233
|
+
|
|
212
234
|
|
|
213
|
-
#
|
|
214
|
-
#
|
|
215
|
-
#
|
|
216
|
-
#
|
|
217
|
-
#
|
|
235
|
+
# Alternative Usage:
|
|
236
|
+
#
|
|
237
|
+
# When using computational models where vectorized operations on the input `X` are not feasible,
|
|
238
|
+
# UQPyL provides a convenient alternative: the `@singleFunc` decorator.
|
|
239
|
+
#
|
|
240
|
+
# This decorator enables "single-run" mode, where `objFunc` accepts
|
|
241
|
+
# a single input at a time. The input should be a Python list or 1D NumPy array.
|
|
242
|
+
#
|
|
243
|
+
# `objFunc` would returns a scalar value (int or float) for single-objective problems,
|
|
244
|
+
# or a list / 1D NumPy array for multi-objective problems.
|
|
218
245
|
|
|
219
|
-
# First, import the decorator
|
|
246
|
+
# First, import the decorator from UQPyL.problems
|
|
220
247
|
from UQPyL.problems import singleFunc
|
|
221
248
|
|
|
222
249
|
@singleFunc
|
|
223
|
-
def objFunc_(X):
|
|
224
|
-
|
|
250
|
+
def objFunc_(X):
|
|
251
|
+
|
|
252
|
+
# Perform calculations for each element in X
|
|
253
|
+
|
|
225
254
|
obj = 100 * (X[2] - X[1]**2)**2 + 100 * (X[1] - X[0]**2)**2 + \
|
|
226
255
|
(1 - X[1])**2 + (1 - X[0])**2
|
|
227
|
-
return obj # Return the objective value: a scalar for single-objective, or a 1D array/list for multi-objective
|
|
228
256
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
# Note: The return value of conFunc indicates whether the constraints are satisfied:
|
|
232
|
-
# - A negative value indicates a violation of the constraint — the smaller the value, the more severe the violation.
|
|
233
|
-
# - A positive value indicates the constraint is satisfied, i.e., the solution is feasible.
|
|
234
|
-
# As a result, users may need to reformulate their original constraint expressions to follow this convention.
|
|
257
|
+
return obj
|
|
258
|
+
|
|
235
259
|
|
|
236
|
-
#
|
|
260
|
+
# Step 3: Define `conFunc` function
|
|
261
|
+
# Similar to `objFunc`, `conFunc` also supports two modes.
|
|
262
|
+
#
|
|
263
|
+
# Note:
|
|
264
|
+
# The return of `conFunc` require whether the constraints are satisfied:
|
|
265
|
+
# - A negative value indicates a violation of the constraint — the smaller the
|
|
266
|
+
# value, the more severe the violation.
|
|
267
|
+
# - A positive value indicates the constraint is satisfied, i.e., the solution
|
|
268
|
+
# is feasible.
|
|
269
|
+
# Therefore, users need to reformulate their original constraint expressions
|
|
270
|
+
# to follow this convention.
|
|
271
|
+
|
|
272
|
+
# Array Mode
|
|
237
273
|
def conFunc(X):
|
|
274
|
+
|
|
238
275
|
cons = X[:, 0]**2 + X[:, 1]**2 + X[:, 2]**2 - 4
|
|
239
|
-
return cons[:, None]
|
|
240
276
|
|
|
241
|
-
#
|
|
277
|
+
return cons[:, None] #keep 2D numpy array
|
|
278
|
+
|
|
279
|
+
# Single-run Mode
|
|
242
280
|
@singleFunc
|
|
243
281
|
def conFunc(X):
|
|
282
|
+
|
|
244
283
|
con = X[0]**2 + X[1]**2 + X[2]**2 - 4
|
|
245
|
-
return con
|
|
246
284
|
|
|
247
|
-
|
|
285
|
+
return con # scaler value is feasible
|
|
248
286
|
|
|
249
|
-
|
|
250
|
-
nOutput = 1 # number of outputs (objective functions), here it's 1 objective.
|
|
287
|
+
# Step 4: Describe the properties of X
|
|
251
288
|
|
|
252
|
-
#
|
|
253
|
-
|
|
289
|
+
nInput = 3 # number of input variables, here it's 3 inputs.
|
|
290
|
+
nOutput = 1 # number of outputs, here it's 1 objective.
|
|
291
|
+
|
|
292
|
+
# Upper bound of X.
|
|
293
|
+
# It can be a float, int, list, or numpy array.
|
|
294
|
+
ub = [10, 10, 10]
|
|
254
295
|
# In this case, both input variables have an upper bound of 10.
|
|
296
|
+
# Optional way:
|
|
297
|
+
ub_ = 10
|
|
255
298
|
|
|
256
299
|
# Lower bound of X.
|
|
257
|
-
lb = [0, 0, 0]
|
|
258
|
-
|
|
300
|
+
lb = [0, 0, 0]
|
|
301
|
+
lb_ = 0
|
|
259
302
|
|
|
260
|
-
#
|
|
261
|
-
#
|
|
303
|
+
# Type of variables.
|
|
304
|
+
# Where `0` for continuous, `1` for integer, and `2` for discrete.
|
|
262
305
|
varType = [0, 1, 2]
|
|
263
|
-
#
|
|
264
|
-
# varType[1] = 1: The second input (X[1]) is an integer variable.
|
|
265
|
-
# varType[2] = 2: The second input (X[2]) is a discrete variable.
|
|
306
|
+
# corresponding to float, integer, discrete
|
|
266
307
|
|
|
267
|
-
#
|
|
268
|
-
varSet = {2: [2, 3.4, 5.1, 7]}
|
|
269
|
-
#
|
|
270
|
-
#
|
|
271
|
-
# This means that X[2] can only take one of these four values: 2, 3.4, 5.1, or 7.
|
|
308
|
+
# For discrete variables, users should indicate the set of possible values
|
|
309
|
+
varSet = {2: [2, 3.4, 5.1, 7]}
|
|
310
|
+
# Here, following Python zero-based indexing, `2` refers to the third variable.
|
|
311
|
+
# This means that x3 can only take one of these four values: 2, 3.4, 5.1, or 7.
|
|
272
312
|
|
|
273
|
-
#
|
|
313
|
+
# Optimization type:
|
|
314
|
+
# Where 'min' for minimization, 'max' for maximization.
|
|
274
315
|
optType = 'min'
|
|
316
|
+
# Note:
|
|
317
|
+
# For multi-objective problems, users can specify the optimization direction
|
|
318
|
+
# (e.g., `min` or `max`)
|
|
319
|
+
# for each objective individually using a list,
|
|
320
|
+
# or define a global direction that applies to all objectives.
|
|
275
321
|
|
|
276
|
-
#
|
|
322
|
+
# Labels of each input variables.
|
|
277
323
|
xLabels = ['x1', 'x2', 'x3']
|
|
278
|
-
# If the optimization problem
|
|
279
|
-
# Otherwise, default names
|
|
324
|
+
# If the optimization problem includes named variables, you can define them here.
|
|
325
|
+
# Otherwise, default names such as 'x1', 'x2', 'x3', etc., will be automatically generated.
|
|
326
|
+
|
|
280
327
|
|
|
281
|
-
#
|
|
282
|
-
yLabels = ['obj1']
|
|
283
|
-
#
|
|
328
|
+
# Labels of each objective.
|
|
329
|
+
yLabels = ['obj1']
|
|
330
|
+
# Similar to `xLabel`, if your objective(s) have specific names, you can define them here.
|
|
331
|
+
# Otherwise, default labels such as 'obj1', 'obj2', etc., will be used.
|
|
284
332
|
|
|
285
333
|
# Name of the optimization problem
|
|
286
|
-
name = 'Rosenbrock'
|
|
287
|
-
# Useful for identifying the problem instance,
|
|
334
|
+
name = 'Rosenbrock'
|
|
335
|
+
# Useful for identifying the problem instance, managing results, saving files, etc.
|
|
288
336
|
|
|
289
337
|
#Step 5: Initialize the problem instance
|
|
290
338
|
problem = Problem(
|
|
291
|
-
nInput=nInput,
|
|
292
|
-
nOutput=nOutput,
|
|
293
|
-
objFunc=objFunc,
|
|
294
|
-
conFunc=conFunc,
|
|
295
|
-
ub=ub,
|
|
296
|
-
lb=lb,
|
|
297
|
-
varType=varType,
|
|
298
|
-
varSet=varSet,
|
|
299
|
-
xLabels=xLabels,
|
|
300
|
-
yLabels=yLabels,
|
|
301
|
-
name=name
|
|
339
|
+
nInput = nInput,
|
|
340
|
+
nOutput = nOutput,
|
|
341
|
+
objFunc = objFunc,
|
|
342
|
+
conFunc = conFunc,
|
|
343
|
+
ub = ub,
|
|
344
|
+
lb = lb,
|
|
345
|
+
varType = varType,
|
|
346
|
+
varSet = varSet,
|
|
347
|
+
xLabels = xLabels,
|
|
348
|
+
yLabels = yLabels,
|
|
349
|
+
name = name
|
|
302
350
|
)
|
|
303
351
|
|
|
304
|
-
# Step 6:
|
|
305
|
-
# All methods and algorithms
|
|
306
|
-
#
|
|
352
|
+
# Step 6: Optimization
|
|
353
|
+
# All methods and algorithms of UQPyL run by reading the `problem` objective
|
|
354
|
+
# Use the Genetic Algorithm (GA) as example
|
|
307
355
|
from UQPyL.optimization.single_objective import GA
|
|
308
356
|
|
|
309
|
-
# Create an instance of
|
|
357
|
+
# Create an instance of GA.
|
|
358
|
+
# By default, GA would output optimizing history
|
|
310
359
|
# and final results in the command line.
|
|
360
|
+
# please check tutorial for specific usage.
|
|
311
361
|
ga = GA()
|
|
312
362
|
|
|
313
|
-
# Run
|
|
363
|
+
# Run `ga` by input `problem` object
|
|
314
364
|
ga.run(problem = problem)
|
|
365
|
+
|
|
315
366
|
# Output:
|
|
316
367
|
# Time: 0.0 day | 0.0 hour | 0.0 minute | 1.17 second
|
|
317
368
|
# Used FEs: 50000 | Iters: 999
|
|
@@ -329,43 +380,54 @@ ga.run(problem = problem)
|
|
|
329
380
|
```
|
|
330
381
|
|
|
331
382
|
### Benchmark Problems
|
|
332
|
-
|
|
383
|
+
|
|
384
|
+
UQPyL provides some built-in benchmark problems (inheriting from `Problem` class) to test algorithms.
|
|
385
|
+
|
|
333
386
|
```python
|
|
387
|
+
|
|
388
|
+
# Import single-objective problems from UQPyL.problems.single_objective
|
|
334
389
|
from UQPyL.problems.single_objective import Sphere, Ackley
|
|
390
|
+
|
|
391
|
+
# Import multi-objective problems from UQPyL.problems.multi_objective
|
|
335
392
|
from UQPyL.problems.multi_objective import ZDT1, DTLZ1
|
|
336
393
|
|
|
337
|
-
#
|
|
338
|
-
# You can easily customize the input dimension and variable bounds as needed
|
|
394
|
+
# Users can easily customize the input dimension and variable bounds as needed
|
|
339
395
|
|
|
340
396
|
# Single-objective benchmark problems
|
|
341
|
-
|
|
342
|
-
|
|
397
|
+
# Sphere function with 10 dimensions, bounds of all variables is [-100, 100]
|
|
398
|
+
problem1 = Sphere(nInput=10, ub=100, lb=-100)
|
|
343
399
|
|
|
344
|
-
#
|
|
345
|
-
|
|
346
|
-
problem4 = DTLZ1(nInput=15) # DTLZ1 problem with 15 decision variables
|
|
400
|
+
# Ackley function with 15 dimensions, bounds of all variables is [-100, 100]
|
|
401
|
+
problem2 = Ackley(nInput=15, ub=np.ones(10)*100, lb=np.ones(10)*-100) #
|
|
347
402
|
|
|
348
|
-
#
|
|
349
|
-
#
|
|
350
|
-
|
|
403
|
+
# Multi-objective benchmark problems
|
|
404
|
+
# ZDT1 problem with 5 decision variables, bounds use default.
|
|
405
|
+
problem3 = ZDT1(nInput=5)
|
|
351
406
|
|
|
407
|
+
# DTLZ1 problem with 15 decision variables, bounds use default.
|
|
408
|
+
problem4 = DTLZ1(nInput=15)
|
|
352
409
|
|
|
410
|
+
```
|
|
353
411
|
|
|
354
412
|
### Sensitivity Analysis
|
|
355
413
|
|
|
356
|
-
|
|
357
|
-
<p align="center"><img src="
|
|
414
|
+
Take Ishigami Function as example.
|
|
415
|
+
<p align="center"><img src="./docs/pic/Problem2.svg" width=400 /></p>
|
|
358
416
|
|
|
359
417
|
The theoretical sensitivity indices of the Ishigami function are as follows:
|
|
418
|
+
|
|
360
419
|
First-order sensitivity indices: x1 = 0.314, x2 = 0.442, x3 = 0.000
|
|
420
|
+
|
|
361
421
|
Total-order sensitivity indices: x1 = 0.558, x2 = 0.442, x3 = 0.244
|
|
362
422
|
|
|
363
423
|
<a href="https://nbviewer.org/github/smasky/UQPyL/blob/dev/notebooks/sensitivity_analysis.ipynb" target="_blank">📘 View Jupyter Notebook example online </a>
|
|
364
424
|
|
|
365
425
|
```python
|
|
366
426
|
import numpy as np
|
|
427
|
+
|
|
367
428
|
from UQPyL.problems import Problem
|
|
368
|
-
|
|
429
|
+
|
|
430
|
+
# Define Ishigami problem
|
|
369
431
|
def objFunc(X):
|
|
370
432
|
objs = np.sin(X[:, 0]) + 7 * np.sin(X[:, 1])**2 + \
|
|
371
433
|
0.1 * X[:, 2]**4 * np.sin(X[:, 0])
|
|
@@ -374,24 +436,25 @@ def objFunc(X):
|
|
|
374
436
|
Ishigami = Problem(nInput = 3, nOutput = 1, objFunc = objFunc,
|
|
375
437
|
ub = np.pi, lb = -1*np.pi, varType = [0, 0, 0],
|
|
376
438
|
name = "Ishigami")
|
|
377
|
-
|
|
439
|
+
|
|
440
|
+
# Import sensibility analysis methods from UQPyL.sensibility
|
|
378
441
|
from UQPyL.sensibility import Sobol
|
|
379
442
|
|
|
380
|
-
#
|
|
443
|
+
# Create a instance of `Sobol`
|
|
381
444
|
sobol = Sobol()
|
|
445
|
+
|
|
446
|
+
# Sampling sample
|
|
382
447
|
# N = 512 defines the base sample size;
|
|
383
|
-
# total number of evaluations will be larger due to Sobol' method structure
|
|
384
448
|
X = sobol.sample(problem = Ishigami, N = 512)
|
|
385
449
|
|
|
386
|
-
# Evaluate the objective
|
|
387
|
-
# Returns an array of function outputs corresponding to each input in X
|
|
450
|
+
# Evaluate the objective of sample points
|
|
388
451
|
Obj = problem.objFunc(X)
|
|
389
452
|
|
|
390
453
|
# Perform Sobol' sensitivity analysis
|
|
391
454
|
# Inputs:
|
|
392
455
|
# - problem: the problem instance (defines bounds and function)
|
|
393
456
|
# - X: the input samples
|
|
394
|
-
# - Obj: the
|
|
457
|
+
# - Obj: the objective of X
|
|
395
458
|
sobol.analyze(problem, X, Obj)
|
|
396
459
|
|
|
397
460
|
# By default, the following results will be obtained:
|
|
@@ -414,6 +477,7 @@ sobol.analyze(problem, X, Obj)
|
|
|
414
477
|
# +-------------------+-------------------+-------------------+
|
|
415
478
|
|
|
416
479
|
```
|
|
480
|
+
|
|
417
481
|
### Optimization
|
|
418
482
|
|
|
419
483
|
Here's an example using SCE-UA to optimize the Sphere function
|
|
@@ -422,20 +486,21 @@ Here's an example using SCE-UA to optimize the Sphere function
|
|
|
422
486
|
|
|
423
487
|
```python
|
|
424
488
|
|
|
425
|
-
# Import
|
|
489
|
+
# Import Sphere
|
|
426
490
|
from UQPyL.problems.single_objective import Sphere
|
|
427
491
|
|
|
428
|
-
#
|
|
429
|
-
sphere = Sphere(nInput = 10)
|
|
492
|
+
# Create an instance of Sphere
|
|
493
|
+
sphere = Sphere(nInput = 10)
|
|
430
494
|
|
|
431
|
-
# Import
|
|
495
|
+
# Import SCE-UA from UQPyL.optimization.single_objective
|
|
432
496
|
from UQPyL.optimization.single_objective import SCE_UA
|
|
433
497
|
|
|
434
|
-
#
|
|
498
|
+
# Create an instance of Sphere
|
|
435
499
|
sce = SCE_UA()
|
|
436
500
|
|
|
437
|
-
# Run
|
|
501
|
+
# Run
|
|
438
502
|
res = sce.run(sphere)
|
|
503
|
+
# Return object `res` is a python dict, which containing optimization history and the best results
|
|
439
504
|
|
|
440
505
|
# Extract the best decision variables and objective values
|
|
441
506
|
bestDecs = res.bestDecs
|
|
@@ -470,8 +535,9 @@ Use RBF model to predict Sphere Function as an example
|
|
|
470
535
|
<a href="https://nbviewer.org/github/smasky/UQPyL/blob/dev/notebooks/surrogate_modelling.ipynb" target="_blank">📘 View Jupyter Notebook example online </a>
|
|
471
536
|
|
|
472
537
|
```python
|
|
538
|
+
|
|
539
|
+
# Generating training data
|
|
473
540
|
from UQPyL.problems import Sphere
|
|
474
|
-
#Instantiate the problem
|
|
475
541
|
sphere = Sphere(nInput = 10)
|
|
476
542
|
|
|
477
543
|
# Import Latin Hypercube Sampling (LHS) for generating design of experiments
|
|
@@ -481,26 +547,28 @@ from UQPyL.DoE import LHS
|
|
|
481
547
|
lhs = LHS()
|
|
482
548
|
xTrain = lhs.sample(200, problem.nInput, problem = sphere)
|
|
483
549
|
|
|
484
|
-
# Evaluate the true objective
|
|
550
|
+
# Evaluate the true objective of training points
|
|
485
551
|
yTrain = sphere.objFunc(xTrain)
|
|
486
552
|
|
|
487
553
|
# Generate 50 test samples for model validation
|
|
488
554
|
xTest = lhs.sample(50, problem.nInput, problem = sphere)
|
|
489
|
-
# Evaluate the true
|
|
555
|
+
# Evaluate the true objective of test points
|
|
490
556
|
yTest = sphere.objFunc(xTest)
|
|
491
557
|
|
|
492
558
|
# Import Radial Basis Function (RBF) surrogate model
|
|
493
559
|
from UQPyL.surrogate.rbf import RBF
|
|
494
560
|
|
|
495
|
-
#
|
|
561
|
+
# Create an instance of RBF
|
|
496
562
|
rbf = RBF()
|
|
563
|
+
# fit the model
|
|
497
564
|
rbf.fit(xTrain, yTrain)
|
|
498
565
|
|
|
499
|
-
# Use the trained RBF model to predict outputs
|
|
566
|
+
# Use the trained RBF model to predict outputs of test inputs
|
|
500
567
|
yPred = rbf.predict(xTest)
|
|
501
568
|
|
|
502
|
-
# Import R²
|
|
569
|
+
# Import R² to evaluate surrogate model performance
|
|
503
570
|
from UQPyL.utility.metric import r_square
|
|
571
|
+
|
|
504
572
|
# Compute R² score between true and predicted test outputs
|
|
505
573
|
r2 = r_square(yTest, yPred)
|
|
506
574
|
print(r2)
|