UQPyL 2.0.5__tar.gz → 2.0.6__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.
Files changed (175) hide show
  1. {UQPyL-2.0.5 → UQPyL-2.0.6}/PKG-INFO +69 -9
  2. {UQPyL-2.0.5 → UQPyL-2.0.6}/README.md +68 -7
  3. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/DoE/__init__.py +1 -1
  4. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/DoE/fast_sequence.py +5 -5
  5. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/DoE/full_fact.py +1 -1
  6. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/DoE/lhs.py +8 -10
  7. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/DoE/morris_sequence.py +5 -5
  8. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/DoE/random.py +1 -2
  9. UQPyL-2.0.5/UQPyL/DoE/sampler_ABC.py → UQPyL-2.0.6/UQPyL/DoE/samplerABC.py +14 -4
  10. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/DoE/sobol_sequence.py +5 -12
  11. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/__init__.py +1 -1
  12. UQPyL-2.0.6/UQPyL/optimization/__init__.py +4 -0
  13. UQPyL-2.0.6/UQPyL/optimization/algorithmABC.py +119 -0
  14. UQPyL-2.0.6/UQPyL/optimization/mathematics/__init__.py +2 -0
  15. {UQPyL-2.0.5/UQPyL/optimization → UQPyL-2.0.6/UQPyL/optimization/mathematics}/boxmin.py +30 -17
  16. UQPyL-2.0.6/UQPyL/optimization/metric/__init__.py +3 -0
  17. UQPyL-2.0.6/UQPyL/optimization/metric/gd.py +12 -0
  18. UQPyL-2.0.6/UQPyL/optimization/metric/hv.py +119 -0
  19. UQPyL-2.0.6/UQPyL/optimization/metric/igd.py +14 -0
  20. UQPyL-2.0.6/UQPyL/optimization/multi_objective/__init__.py +5 -0
  21. UQPyL-2.0.5/UQPyL/optimization/mo_asmo.py → UQPyL-2.0.6/UQPyL/optimization/multi_objective/moasmo.py +5 -5
  22. UQPyL-2.0.6/UQPyL/optimization/multi_objective/moea_d.py +128 -0
  23. UQPyL-2.0.6/UQPyL/optimization/multi_objective/nsga_ii.py +129 -0
  24. UQPyL-2.0.6/UQPyL/optimization/multi_objective/rvea.py +114 -0
  25. UQPyL-2.0.6/UQPyL/optimization/population.py +156 -0
  26. UQPyL-2.0.6/UQPyL/optimization/result.py +125 -0
  27. UQPyL-2.0.6/UQPyL/optimization/single_objective/__init__.py +11 -0
  28. UQPyL-2.0.6/UQPyL/optimization/single_objective/abc.py +175 -0
  29. UQPyL-2.0.6/UQPyL/optimization/single_objective/asmo.py +99 -0
  30. UQPyL-2.0.6/UQPyL/optimization/single_objective/csa.py +154 -0
  31. UQPyL-2.0.6/UQPyL/optimization/single_objective/de.py +85 -0
  32. UQPyL-2.0.6/UQPyL/optimization/single_objective/ego.py +85 -0
  33. UQPyL-2.0.6/UQPyL/optimization/single_objective/ga.py +168 -0
  34. UQPyL-2.0.6/UQPyL/optimization/single_objective/ml_sce_ua.py +135 -0
  35. UQPyL-2.0.6/UQPyL/optimization/single_objective/pso.py +145 -0
  36. UQPyL-2.0.6/UQPyL/optimization/single_objective/sce_ua.py +171 -0
  37. UQPyL-2.0.6/UQPyL/optimization/utility_functions/__init__.py +5 -0
  38. UQPyL-2.0.6/UQPyL/optimization/utility_functions/crowding_distance.py +31 -0
  39. UQPyL-2.0.6/UQPyL/optimization/utility_functions/ndsort.py +36 -0
  40. UQPyL-2.0.6/UQPyL/optimization/utility_functions/operationGA.py +81 -0
  41. UQPyL-2.0.6/UQPyL/optimization/utility_functions/tournament_selection.py +32 -0
  42. UQPyL-2.0.5/UQPyL/optimization/utility_functions/_uniformPoint.py → UQPyL-2.0.6/UQPyL/optimization/utility_functions/uniform_point.py +7 -4
  43. UQPyL-2.0.6/UQPyL/problems/__init__.py +22 -0
  44. UQPyL-2.0.5/UQPyL/problems/multi_DTLZ.py → UQPyL-2.0.6/UQPyL/problems/multi_objective/DTLZ.py +13 -6
  45. UQPyL-2.0.5/UQPyL/problems/multi_ZDT.py → UQPyL-2.0.6/UQPyL/problems/multi_objective/ZDT.py +43 -42
  46. UQPyL-2.0.6/UQPyL/problems/multi_objective/__init__.py +2 -0
  47. UQPyL-2.0.6/UQPyL/problems/pratical_problem.py +16 -0
  48. UQPyL-2.0.6/UQPyL/problems/problemABC.py +90 -0
  49. UQPyL-2.0.6/UQPyL/problems/single_objective/__init__.py +3 -0
  50. UQPyL-2.0.5/UQPyL/problems/single_Benchmarks.py → UQPyL-2.0.6/UQPyL/problems/single_objective/single_base_problem.py +59 -43
  51. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/sensibility/__init__.py +2 -1
  52. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/sensibility/delta_test.py +5 -5
  53. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/sensibility/fast.py +59 -80
  54. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/sensibility/mars_sa.py +1 -1
  55. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/sensibility/morris.py +55 -27
  56. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/sensibility/rbd_fast.py +44 -45
  57. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/sensibility/rsa.py +37 -38
  58. UQPyL-2.0.6/UQPyL/sensibility/saABC.py +151 -0
  59. UQPyL-2.0.6/UQPyL/sensibility/sobol.py +252 -0
  60. UQPyL-2.0.6/UQPyL/surrogates/__init__.py +9 -0
  61. UQPyL-2.0.6/UQPyL/surrogates/fnn/__init__.py +1 -0
  62. {UQPyL-2.0.5/UQPyL/surrogates → UQPyL-2.0.6/UQPyL/surrogates/fnn}/fully_connect_neural_network.py +53 -51
  63. UQPyL-2.0.6/UQPyL/surrogates/gp/__init__.py +2 -0
  64. UQPyL-2.0.6/UQPyL/surrogates/gp/gaussian_process.py +233 -0
  65. UQPyL-2.0.6/UQPyL/surrogates/gp/kernel/__init__.py +6 -0
  66. {UQPyL-2.0.5/UQPyL/surrogates/gp_kernels → UQPyL-2.0.6/UQPyL/surrogates/gp/kernel}/base_kernel.py +14 -6
  67. UQPyL-2.0.5/UQPyL/surrogates/gp_kernels/c_kernel.py → UQPyL-2.0.6/UQPyL/surrogates/gp/kernel/c_kernel_.py +3 -2
  68. UQPyL-2.0.6/UQPyL/surrogates/gp/kernel/dot_kernel_.py +27 -0
  69. UQPyL-2.0.6/UQPyL/surrogates/gp/kernel/matern_kernel.py +76 -0
  70. UQPyL-2.0.6/UQPyL/surrogates/gp/kernel/rbf_kernel.py +61 -0
  71. UQPyL-2.0.6/UQPyL/surrogates/gp/kernel/rq_kernel.py +42 -0
  72. UQPyL-2.0.6/UQPyL/surrogates/kriging/__init__.py +2 -0
  73. UQPyL-2.0.6/UQPyL/surrogates/kriging/kernel/__init__.py +4 -0
  74. UQPyL-2.0.6/UQPyL/surrogates/kriging/kernel/base_kernel.py +53 -0
  75. UQPyL-2.0.6/UQPyL/surrogates/kriging/kernel/cubic_kernel.py +28 -0
  76. {UQPyL-2.0.5/UQPyL/surrogates/krg_kernels → UQPyL-2.0.6/UQPyL/surrogates/kriging/kernel}/exp_kernel.py +9 -8
  77. {UQPyL-2.0.5/UQPyL/surrogates/krg_kernels → UQPyL-2.0.6/UQPyL/surrogates/kriging/kernel}/guass_kernel.py +9 -8
  78. UQPyL-2.0.6/UQPyL/surrogates/kriging/kriging.py +331 -0
  79. UQPyL-2.0.6/UQPyL/surrogates/mars/__init__.py +1 -0
  80. {UQPyL-2.0.5/UQPyL/surrogates/mars_ → UQPyL-2.0.6/UQPyL/surrogates/mars/core}/_basis.c +6527 -5875
  81. {UQPyL-2.0.5/UQPyL/surrogates/mars_ → UQPyL-2.0.6/UQPyL/surrogates/mars/core}/_forward.c +4500 -3879
  82. {UQPyL-2.0.5/UQPyL/surrogates/mars_ → UQPyL-2.0.6/UQPyL/surrogates/mars/core}/_knot_search.c +5072 -4427
  83. {UQPyL-2.0.5/UQPyL/surrogates/mars_ → UQPyL-2.0.6/UQPyL/surrogates/mars/core}/_pruning.c +2782 -2179
  84. {UQPyL-2.0.5/UQPyL/surrogates/mars_ → UQPyL-2.0.6/UQPyL/surrogates/mars/core}/_qr.c +3232 -2607
  85. {UQPyL-2.0.5/UQPyL/surrogates/mars_ → UQPyL-2.0.6/UQPyL/surrogates/mars/core}/_record.c +3898 -3265
  86. {UQPyL-2.0.5/UQPyL/surrogates/mars_ → UQPyL-2.0.6/UQPyL/surrogates/mars/core}/_types.c +1594 -991
  87. {UQPyL-2.0.5/UQPyL/surrogates/mars_ → UQPyL-2.0.6/UQPyL/surrogates/mars/core}/_util.c +2060 -1461
  88. {UQPyL-2.0.5/UQPyL/surrogates → UQPyL-2.0.6/UQPyL/surrogates/mars}/mars.py +9 -9
  89. UQPyL-2.0.6/UQPyL/surrogates/rbf/__init__.py +2 -0
  90. {UQPyL-2.0.5/UQPyL/surrogates/rbf_kernels → UQPyL-2.0.6/UQPyL/surrogates/rbf/kernel}/__init__.py +4 -4
  91. UQPyL-2.0.6/UQPyL/surrogates/rbf/kernel/base_kernel.py +82 -0
  92. UQPyL-2.0.6/UQPyL/surrogates/rbf/kernel/cubic_kernel.py +26 -0
  93. UQPyL-2.0.6/UQPyL/surrogates/rbf/kernel/gaussian_kernel.py +17 -0
  94. UQPyL-2.0.6/UQPyL/surrogates/rbf/kernel/linear_kernel.py +25 -0
  95. UQPyL-2.0.6/UQPyL/surrogates/rbf/kernel/multiquadric_kernel.py +25 -0
  96. UQPyL-2.0.6/UQPyL/surrogates/rbf/kernel/thin_plate_spline_kernel.py +32 -0
  97. UQPyL-2.0.6/UQPyL/surrogates/rbf/radial_basis_function.py +97 -0
  98. UQPyL-2.0.6/UQPyL/surrogates/regression/__init__.py +2 -0
  99. {UQPyL-2.0.5/UQPyL/surrogates/lasso_ → UQPyL-2.0.6/UQPyL/surrogates/regression/lasso}/__init__.py +1 -1
  100. {UQPyL-2.0.5/UQPyL/surrogates/lasso_ → UQPyL-2.0.6/UQPyL/surrogates/regression/lasso}/lasso_fast.c +4367 -3820
  101. UQPyL-2.0.6/UQPyL/surrogates/regression/linear_regression.py +183 -0
  102. UQPyL-2.0.6/UQPyL/surrogates/regression/polynomial_regression.py +107 -0
  103. UQPyL-2.0.6/UQPyL/surrogates/setting.py +90 -0
  104. UQPyL-2.0.6/UQPyL/surrogates/surrogateABC.py +133 -0
  105. UQPyL-2.0.6/UQPyL/surrogates/svr/__init__.py +1 -0
  106. {UQPyL-2.0.5/UQPyL/surrogates/svr_ → UQPyL-2.0.6/UQPyL/surrogates/svr/core}/libsvm_interface.cpp +1 -1
  107. UQPyL-2.0.6/UQPyL/surrogates/svr/support_vector_machine.py +69 -0
  108. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/utility/__init__.py +4 -3
  109. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/utility/grid_search.py +0 -1
  110. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/utility/metrics.py +2 -3
  111. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/utility/model_selections.py +10 -8
  112. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/utility/polynomial_features.py +2 -0
  113. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL/utility/scalers.py +1 -1
  114. UQPyL-2.0.6/UQPyL/utility/verbose.py +354 -0
  115. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL.egg-info/PKG-INFO +69 -9
  116. UQPyL-2.0.6/UQPyL.egg-info/SOURCES.txt +131 -0
  117. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL.egg-info/requires.txt +1 -0
  118. {UQPyL-2.0.5 → UQPyL-2.0.6}/pyproject.toml +2 -2
  119. UQPyL-2.0.6/setup.py +54 -0
  120. UQPyL-2.0.5/UQPyL/optimization/__init__.py +0 -25
  121. UQPyL-2.0.5/UQPyL/optimization/asmo.py +0 -123
  122. UQPyL-2.0.5/UQPyL/optimization/ga.py +0 -190
  123. UQPyL-2.0.5/UQPyL/optimization/moea_d.py +0 -241
  124. UQPyL-2.0.5/UQPyL/optimization/nsga_ii.py +0 -297
  125. UQPyL-2.0.5/UQPyL/optimization/pso.py +0 -162
  126. UQPyL-2.0.5/UQPyL/optimization/sce_ua.py +0 -232
  127. UQPyL-2.0.5/UQPyL/problems/__init__.py +0 -22
  128. UQPyL-2.0.5/UQPyL/problems/pratical_problem.py +0 -27
  129. UQPyL-2.0.5/UQPyL/problems/problem_ABC.py +0 -54
  130. UQPyL-2.0.5/UQPyL/problems/utility_functions/_NDsort.py +0 -34
  131. UQPyL-2.0.5/UQPyL/problems/utility_functions/__init__.py +0 -0
  132. UQPyL-2.0.5/UQPyL/sensibility/sa_ABC.py +0 -92
  133. UQPyL-2.0.5/UQPyL/sensibility/sobol.py +0 -245
  134. UQPyL-2.0.5/UQPyL/surrogates/BaggingEnsemble.py +0 -1
  135. UQPyL-2.0.5/UQPyL/surrogates/BootstrapEnsemble.py +0 -1
  136. UQPyL-2.0.5/UQPyL/surrogates/__init__.py +0 -22
  137. UQPyL-2.0.5/UQPyL/surrogates/gaussian_process.py +0 -194
  138. UQPyL-2.0.5/UQPyL/surrogates/gp_kernels/__init__.py +0 -16
  139. UQPyL-2.0.5/UQPyL/surrogates/gp_kernels/dot_kernel.py +0 -82
  140. UQPyL-2.0.5/UQPyL/surrogates/gp_kernels/matern_kernel.py +0 -119
  141. UQPyL-2.0.5/UQPyL/surrogates/gp_kernels/rbf_kernel.py +0 -93
  142. UQPyL-2.0.5/UQPyL/surrogates/gp_kernels/rq_kernel.py +0 -132
  143. UQPyL-2.0.5/UQPyL/surrogates/krg_kernels/__init__.py +0 -8
  144. UQPyL-2.0.5/UQPyL/surrogates/krg_kernels/base_kernel.py +0 -77
  145. UQPyL-2.0.5/UQPyL/surrogates/krg_kernels/cubic_kernel.py +0 -60
  146. UQPyL-2.0.5/UQPyL/surrogates/kriging.py +0 -332
  147. UQPyL-2.0.5/UQPyL/surrogates/linear_regression.py +0 -225
  148. UQPyL-2.0.5/UQPyL/surrogates/mars_/pyearth/__init__.py +0 -4
  149. UQPyL-2.0.5/UQPyL/surrogates/mlp_utility/__init__.py +0 -9
  150. UQPyL-2.0.5/UQPyL/surrogates/polynomial_regression.py +0 -113
  151. UQPyL-2.0.5/UQPyL/surrogates/radial_basis_function.py +0 -93
  152. UQPyL-2.0.5/UQPyL/surrogates/rbf_kernels/base_kernel.py +0 -447
  153. UQPyL-2.0.5/UQPyL/surrogates/rbf_kernels/cubic_kernel.py +0 -14
  154. UQPyL-2.0.5/UQPyL/surrogates/rbf_kernels/gaussian_kernel.py +0 -9
  155. UQPyL-2.0.5/UQPyL/surrogates/rbf_kernels/linear_kernel.py +0 -15
  156. UQPyL-2.0.5/UQPyL/surrogates/rbf_kernels/multiquadric_kernel.py +0 -18
  157. UQPyL-2.0.5/UQPyL/surrogates/rbf_kernels/thin_plate_spline_kernel.py +0 -20
  158. UQPyL-2.0.5/UQPyL/surrogates/support_vector_machine.py +0 -106
  159. UQPyL-2.0.5/UQPyL/surrogates/surrogate_ABC.py +0 -150
  160. UQPyL-2.0.5/UQPyL.egg-info/SOURCES.txt +0 -105
  161. UQPyL-2.0.5/setup.py +0 -64
  162. {UQPyL-2.0.5 → UQPyL-2.0.6}/LICENSE.md +0 -0
  163. {UQPyL-2.0.5/UQPyL/optimization → UQPyL-2.0.6/UQPyL/optimization/mathematics}/adam.py +0 -0
  164. {UQPyL-2.0.5/UQPyL/optimization → UQPyL-2.0.6/UQPyL/optimization/single_objective}/_binary_ga.py +0 -0
  165. /UQPyL-2.0.5/UQPyL/optimization/utility_functions/_NDsort.py → /UQPyL-2.0.6/UQPyL/problems/utility_functions/NDsort.py +0 -0
  166. {UQPyL-2.0.5/UQPyL/optimization → UQPyL-2.0.6/UQPyL/problems}/utility_functions/__init__.py +0 -0
  167. /UQPyL-2.0.5/UQPyL/problems/utility_functions/_uniformPoint.py → /UQPyL-2.0.6/UQPyL/problems/utility_functions/uniformPoint.py +0 -0
  168. {UQPyL-2.0.5/UQPyL/surrogates/mlp_utility → UQPyL-2.0.6/UQPyL/surrogates/fnn}/_activation_funcs.py +0 -0
  169. {UQPyL-2.0.5/UQPyL/surrogates/mlp_utility → UQPyL-2.0.6/UQPyL/surrogates/fnn}/base.py +0 -0
  170. {UQPyL-2.0.5/UQPyL/surrogates/mars_ → UQPyL-2.0.6/UQPyL/surrogates/mars/core}/__init__.py +0 -0
  171. {UQPyL-2.0.5/UQPyL/surrogates/svr_ → UQPyL-2.0.6/UQPyL/surrogates/svr/core}/__init__.py +0 -0
  172. {UQPyL-2.0.5/UQPyL/surrogates/svr_ → UQPyL-2.0.6/UQPyL/surrogates/svr/core}/svm.cpp +0 -0
  173. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL.egg-info/dependency_links.txt +0 -0
  174. {UQPyL-2.0.5 → UQPyL-2.0.6}/UQPyL.egg-info/top_level.txt +0 -0
  175. {UQPyL-2.0.5 → UQPyL-2.0.6}/setup.cfg +0 -0
@@ -1,10 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: UQPyL
3
- Version: 2.0.5
3
+ Version: 2.0.6
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>
7
- Classifier: Programming Language :: Python :: 3.6
8
7
  Classifier: Programming Language :: Python :: 3.7
9
8
  Classifier: Programming Language :: Python :: 3.8
10
9
  Classifier: Programming Language :: Python :: 3.9
@@ -46,13 +45,10 @@ The **main characteristics** of UQPyL includes:
46
45
  - Regional Sensitivity Analysis (RSA)
47
46
 
48
47
  **Optimization Algorithms:** (* indicates the use of surrogate models)
49
- - SCE-UA
50
- - Genetic Algorithm (GA)
51
- - Non-dominated Sorting Genetic Algorithm-II (NSGA-II)
52
- - AMSMO*
53
- - MO_ASMO*
54
- - MASTO* #TODO
55
- - AMSMO* #TODO
48
+ - Single Objective Optimization: SCE-UA, ML-SCE-UA, GA, CSA, PSO, DE, ABC, ASMO*, EGO*
49
+ - Multi Objective Optimization: MOEA/D, NSGA-II, RVEA, MOASMO*
50
+
51
+ Noted: It is still being updated, and if you need other algorithms, please contact me.
56
52
 
57
53
  **Surrogate Models:**
58
54
  - Full connect neural network (FNN)
@@ -81,6 +77,70 @@ git clone https://github.com/smasky/UQPyL.git
81
77
  pip install .
82
78
  ```
83
79
 
80
+ # Quick Start
81
+ For users, we should define the problem you want to solved firstly. The problem usually contains three important properties:
82
+ a. func (the mapping from X to Y); b. the dimensions of decisions and outputs; c. the bound of decisions (ub, lb).
83
+
84
+ For benchmark problems, we can import them from **UQPyL.problems** and instantiation:
85
+
86
+ ```
87
+ from UQPyL.problems.single_objective import Sphere
88
+
89
+ problem=Sphere(nInput=10, ub=100, lb=-100)
90
+ problem=Sphere(nInput=10, ub=np.ones(10)*100, lb=np.ones(10)*-100)
91
+ ```
92
+
93
+ For practical problems, we should define the evaluation function in addition, like:
94
+ ```
95
+ from UQPyL.problems import PracticalProblem
96
+ def func(X):
97
+ Y=np.sum(X, axis=1).reshape(-1, 1)
98
+ return Y
99
+
100
+ problem=PracticalProblem(func=func, nInput=10, nOutput=1, ub=100, lb=-100, name="Sphere")
101
+ ```
102
+ **Please noted that**, the func need receive the matrix of X and return the matrix of Y. And keep columns equal to dimensions and rows equal to samples.
103
+
104
+ After defining problem you solved, you can use any methods in UQPyL.
105
+ **Sensibility:**
106
+ ```
107
+ from UQPyL.sensibility import Sobol
108
+
109
+ sobol=Sobol() #instantiation and set hyper-parameters
110
+ sobol.analyze(problem)
111
+ ```
112
+
113
+ **Optimization:**
114
+ ```
115
+ from UQPyL.optimization.single_objective import SCE_UA
116
+
117
+ sce=SCE_UA()
118
+ res=sce.run(problem)
119
+ bestDec=res.bestDec; bestObj=res.bestObj
120
+ ```
121
+
122
+ **Surrogate:**
123
+ ```
124
+ from UQPyL.DoE import LHS
125
+
126
+ lhs=LHS(problem)
127
+ xTrain=lhs.sample(200, problem.nInput)
128
+ yTrain=problem.evaluate(xTrain)
129
+
130
+ xTest=lhs.sample(50, problem.nInput)
131
+ yTest=problem.evaluate(xTest)
132
+
133
+ from UQPyL.surrogate.rbf import RBF
134
+
135
+ rbf=RBF()
136
+ rbf.fit(xTrain, yTrain)
137
+ yPred=rbf.predict(xTest)
138
+
139
+ from UQPyL.utility.metric import r_square
140
+ r2=r_square(yTest, yPred)
141
+ ```
142
+
143
+ The above is a quick start. For more advanced usage, please refer to the documentation (#TODO).
84
144
 
85
145
  # Call for Contributions
86
146
  We appreciate and welcome contributions. Because, we only set up standard workflows here. More advanced quantification methods and optimization algorithms are waited for pulling to this project.
@@ -28,13 +28,10 @@ The **main characteristics** of UQPyL includes:
28
28
  - Regional Sensitivity Analysis (RSA)
29
29
 
30
30
  **Optimization Algorithms:** (* indicates the use of surrogate models)
31
- - SCE-UA
32
- - Genetic Algorithm (GA)
33
- - Non-dominated Sorting Genetic Algorithm-II (NSGA-II)
34
- - AMSMO*
35
- - MO_ASMO*
36
- - MASTO* #TODO
37
- - AMSMO* #TODO
31
+ - Single Objective Optimization: SCE-UA, ML-SCE-UA, GA, CSA, PSO, DE, ABC, ASMO*, EGO*
32
+ - Multi Objective Optimization: MOEA/D, NSGA-II, RVEA, MOASMO*
33
+
34
+ Noted: It is still being updated, and if you need other algorithms, please contact me.
38
35
 
39
36
  **Surrogate Models:**
40
37
  - Full connect neural network (FNN)
@@ -63,6 +60,70 @@ git clone https://github.com/smasky/UQPyL.git
63
60
  pip install .
64
61
  ```
65
62
 
63
+ # Quick Start
64
+ For users, we should define the problem you want to solved firstly. The problem usually contains three important properties:
65
+ a. func (the mapping from X to Y); b. the dimensions of decisions and outputs; c. the bound of decisions (ub, lb).
66
+
67
+ For benchmark problems, we can import them from **UQPyL.problems** and instantiation:
68
+
69
+ ```
70
+ from UQPyL.problems.single_objective import Sphere
71
+
72
+ problem=Sphere(nInput=10, ub=100, lb=-100)
73
+ problem=Sphere(nInput=10, ub=np.ones(10)*100, lb=np.ones(10)*-100)
74
+ ```
75
+
76
+ For practical problems, we should define the evaluation function in addition, like:
77
+ ```
78
+ from UQPyL.problems import PracticalProblem
79
+ def func(X):
80
+ Y=np.sum(X, axis=1).reshape(-1, 1)
81
+ return Y
82
+
83
+ problem=PracticalProblem(func=func, nInput=10, nOutput=1, ub=100, lb=-100, name="Sphere")
84
+ ```
85
+ **Please noted that**, the func need receive the matrix of X and return the matrix of Y. And keep columns equal to dimensions and rows equal to samples.
86
+
87
+ After defining problem you solved, you can use any methods in UQPyL.
88
+ **Sensibility:**
89
+ ```
90
+ from UQPyL.sensibility import Sobol
91
+
92
+ sobol=Sobol() #instantiation and set hyper-parameters
93
+ sobol.analyze(problem)
94
+ ```
95
+
96
+ **Optimization:**
97
+ ```
98
+ from UQPyL.optimization.single_objective import SCE_UA
99
+
100
+ sce=SCE_UA()
101
+ res=sce.run(problem)
102
+ bestDec=res.bestDec; bestObj=res.bestObj
103
+ ```
104
+
105
+ **Surrogate:**
106
+ ```
107
+ from UQPyL.DoE import LHS
108
+
109
+ lhs=LHS(problem)
110
+ xTrain=lhs.sample(200, problem.nInput)
111
+ yTrain=problem.evaluate(xTrain)
112
+
113
+ xTest=lhs.sample(50, problem.nInput)
114
+ yTest=problem.evaluate(xTest)
115
+
116
+ from UQPyL.surrogate.rbf import RBF
117
+
118
+ rbf=RBF()
119
+ rbf.fit(xTrain, yTrain)
120
+ yPred=rbf.predict(xTest)
121
+
122
+ from UQPyL.utility.metric import r_square
123
+ r2=r_square(yTest, yPred)
124
+ ```
125
+
126
+ The above is a quick start. For more advanced usage, please refer to the documentation (#TODO).
66
127
 
67
128
  # Call for Contributions
68
129
  We appreciate and welcome contributions. Because, we only set up standard workflows here. More advanced quantification methods and optimization algorithms are waited for pulling to this project.
@@ -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 .sampler_ABC import Sampler
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,6 +1,6 @@
1
1
  import numpy as np
2
2
 
3
- from .sampler_ABC import Sampler
3
+ from .samplerABC import Sampler
4
4
 
5
5
  class FAST_Sequence(Sampler):
6
6
  '''
@@ -24,7 +24,7 @@ class FAST_Sequence(Sampler):
24
24
 
25
25
  super().__init__()
26
26
  self.M=M
27
-
27
+
28
28
  def _generate(self, nt: int, nx: int) -> np.ndarray:
29
29
  '''
30
30
  Generate a shape of (nt*nx, nx) sample for FAST
@@ -55,7 +55,7 @@ class FAST_Sequence(Sampler):
55
55
 
56
56
  s=(2*np.pi/nt)*np.arange(nt)
57
57
 
58
- X_sa=np.zeros((nt*nx, nx))
58
+ xInit=np.zeros((nt*nx, nx))
59
59
  w_tmp=np.zeros(nx)
60
60
 
61
61
  for i in range(nx):
@@ -66,9 +66,9 @@ class FAST_Sequence(Sampler):
66
66
  phi=2*np.pi*np.random.rand()
67
67
  sin_result=np.sin(w_tmp[:,None]*s+phi)
68
68
  arsin_result=(1/np.pi)*np.arcsin(sin_result) #saltelli formula
69
- X_sa[idx, :]=0.5+arsin_result.transpose()
69
+ xInit[idx, :]=0.5+arsin_result.transpose()
70
70
 
71
- return X_sa
71
+ return xInit
72
72
 
73
73
  def sample(self, nt: int, nx: int) -> np.ndarray:
74
74
 
@@ -2,7 +2,7 @@ import numpy as np
2
2
  from typing import Union
3
3
  from itertools import product
4
4
 
5
- from .sampler_ABC import Sampler
5
+ from .samplerABC import Sampler
6
6
 
7
7
  class FFD(Sampler):
8
8
  '''
@@ -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 .sampler_ABC import Sampler
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
 
@@ -151,6 +151,7 @@ class LHS(Sampler):
151
151
  #initial random state
152
152
  self.random_state=np.random.RandomState()
153
153
 
154
+
154
155
  def _generate(self, nt: int, nx: int) -> np.ndarray:
155
156
  '''
156
157
  Generate a Latin-hypercube design
@@ -168,7 +169,7 @@ class LHS(Sampler):
168
169
  '''
169
170
 
170
171
  if self.problem is not None:
171
- if(self.problem.n_input!=nx):
172
+ if(self.problem.nInput!=nx):
172
173
  raise ValueError('The input dimensions of the problem and the samples must be the same')
173
174
 
174
175
  if self.criterion not in LHS_METHOD:
@@ -177,16 +178,13 @@ class LHS(Sampler):
177
178
  Sampling_method=LHS_METHOD[self.criterion]
178
179
 
179
180
  if self.criterion in ['maximin', 'center_maximin', 'correlation']:
180
- X=Sampling_method(nt, nx, self.iterations, self.random_state)
181
+ xInit=Sampling_method(nt, nx, self.iterations, self.random_state)
181
182
  else:
182
- X=Sampling_method(nt, nx, self.random_state)
183
+ xInit=Sampling_method(nt, nx, self.random_state)
183
184
 
184
- #rescale the samples
185
- if self.problem is not None:
186
- X=X*(self.problem.ub-self.problem.lb)+self.problem.lb
187
-
188
- return X
185
+ return xInit
189
186
 
187
+ @decoratorRescale
190
188
  def sample(self, nt: int, nx:int, random_seed: Optional[int]=None) -> np.ndarray:
191
189
  '''
192
190
  Generate a Latin-hypercube design
@@ -1,6 +1,6 @@
1
1
  import numpy as np
2
2
 
3
- from .sampler_ABC import Sampler
3
+ from .samplerABC import Sampler
4
4
 
5
5
  class Morris_Sequence(Sampler):
6
6
  '''
@@ -24,7 +24,7 @@ class Morris_Sequence(Sampler):
24
24
 
25
25
  super().__init__()
26
26
  self.num_levels=num_levels
27
-
27
+
28
28
  def _generate(self, nt: int, nx: int) -> np.ndarray:
29
29
  '''
30
30
  Generate a shape of (nt*nx, nx) sample for FAST
@@ -40,12 +40,12 @@ class Morris_Sequence(Sampler):
40
40
  An n-by-samples design matrix that has been normalized so factor values
41
41
  are uniformly spaced between zero and one.
42
42
  '''
43
- X=np.zeros((nt*(nx+1), nx))
43
+ xInit=np.zeros((nt*(nx+1), nx))
44
44
 
45
45
  for i in range(nt):
46
- X[i*(nx+1):(i+1)*(nx+1), :]=self._generate_trajectory(nx)
46
+ xInit[i*(nx+1):(i+1)*(nx+1), :]=self._generate_trajectory(nx)
47
47
 
48
- return X
48
+ return xInit
49
49
 
50
50
  def _generate_trajectory(self, nx: int) -> np.ndarray:
51
51
  '''
@@ -1,6 +1,6 @@
1
1
  import numpy as np
2
2
 
3
- from .sampler_ABC import Sampler
3
+ from .samplerABC import Sampler
4
4
 
5
5
  class Random(Sampler):
6
6
  '''
@@ -13,7 +13,6 @@ class Random(Sampler):
13
13
  >>> random=RANDOM()
14
14
  >>> random(10,10) or random.sample(10,10)
15
15
  '''
16
-
17
16
  def _generate(self,nt: int, nx: int) -> np.ndarray:
18
17
 
19
18
  H=np.random.random((nt,nx))
@@ -1,17 +1,28 @@
1
1
  import abc
2
2
  import numpy as np
3
3
 
4
+ def decoratorRescale(func):
5
+ def wrapper(self, *args, **kwargs):
6
+ result=func(self, *args, **kwargs)
7
+ if self.problem is not None:
8
+ return self.problem._unit_X_transform_to_bound(result)
9
+ else:
10
+ return result
11
+ return wrapper
4
12
  class Sampler(metaclass=abc.ABCMeta):
5
13
  def __init__(self):
6
14
  pass
7
-
8
15
  def __call__(self, nt:int, nx: int) -> np.ndarray:
9
16
  return self._generate(nt, nx)
10
17
 
11
18
  def sample(self, nt:int, nx:int) -> np.ndarray:
12
19
  return self._generate(nt, nx)
13
20
 
14
- @abc.abstractmethod
21
+ def rescale_to_problem(self, xInit:np.ndarray):
22
+ if self.problem is not None:
23
+ xInit=self.problem._unit_xInit_transform_to_bound(xInit)
24
+ return xInit
25
+
15
26
  def _generate(self, nt: int, nx: int) -> np.ndarray:
16
27
  '''
17
28
  nt: the number of sampled points
@@ -22,5 +33,4 @@ class Sampler(metaclass=abc.ABCMeta):
22
33
 
23
34
  '''
24
35
  pass
25
-
26
-
36
+
@@ -1,7 +1,7 @@
1
1
  import numpy as np
2
2
  from scipy.stats.qmc import Sobol
3
3
 
4
- from .sampler_ABC import Sampler
4
+ from .samplerABC import Sampler
5
5
 
6
6
  class Sobol_Sequence(Sampler):
7
7
  '''
@@ -26,16 +26,16 @@ class Sobol_Sequence(Sampler):
26
26
 
27
27
  self.scramble=scramble
28
28
  self.skip_value=skip_value
29
-
29
+
30
30
  def _generate(self, nt: int, nx: int) -> np.ndarray:
31
31
  '''
32
32
  generate the shape of (nt*nx, nx) and numpy array Sobol sequence.
33
33
  '''
34
34
 
35
35
  sampler=Sobol(d=nx, scramble=self.scramble)
36
- X=sampler.random(nt+self.skip_value)
36
+ xInit=sampler.random(nt+self.skip_value)
37
37
 
38
- return X[self.skip_value:, :]
38
+ return xInit[self.skip_value:, :]
39
39
 
40
40
  def sample(self, nt: int, nx: int) -> np.ndarray:
41
41
  '''
@@ -52,11 +52,4 @@ class Sobol_Sequence(Sampler):
52
52
  An n-by-samples design matrix that has been normalized so factor values
53
53
  are uniformly spaced between zero and one.
54
54
  '''
55
- return self._generate(nt, nx)
56
-
57
-
58
-
59
-
60
-
61
-
62
-
55
+ return self._generate(nt, nx)
@@ -1,6 +1,6 @@
1
1
  from . import problems, surrogates, optimization, sensibility, DoE, utility
2
2
 
3
- __version__ = "2.0.5"
3
+ __version__ = "2.0.6"
4
4
  __author__ = "wmtSky"
5
5
 
6
6
  __all__=[
@@ -0,0 +1,4 @@
1
+ from .single_objective import GA, PSO, CSA, DE, SCE_UA, ML_SCE_UA, ASMO, ABC, Binary_GA, EGO
2
+ from .multi_objective import NSGAII, MOEAD, MOASMO, RVEA
3
+ from .mathematics import Boxmin, Adam
4
+ from .algorithmABC import Algorithm
@@ -0,0 +1,119 @@
1
+ import numpy as np
2
+ import abc
3
+ import functools
4
+
5
+ from .population import Population
6
+ from .result import Result
7
+ from ..DoE import LHS
8
+ from ..utility import Verbose
9
+
10
+ class Algorithm(metaclass=abc.ABCMeta):
11
+ """
12
+ This is a baseclass for algorithms
13
+ """
14
+ def __init__(self, maxFEs=None, maxIterTimes=None, maxTolerateTimes=None, tolerate=1e-6,
15
+ verbose=True, verboseFreq=10, logFlag=True, saveFlag=False):
16
+
17
+ self.setting=Setting()
18
+ self.result=Result(self)
19
+
20
+ self.problem=None
21
+ self.maxFEs=maxFEs
22
+ self.maxIter=maxIterTimes
23
+ self.maxTolerateTimes=maxTolerateTimes
24
+ self.tolerate=tolerate
25
+
26
+ self.verbose=verbose
27
+ self.verboseFreq=verboseFreq
28
+ self.logFlag=logFlag
29
+ self.saveFlag=saveFlag
30
+
31
+ def initialize(self, nInit):
32
+
33
+ lhs=LHS('classic', problem=self.problem)
34
+ xInit=lhs.sample(nInit, self.problem.nInput)
35
+ pop=Population(xInit)
36
+ self.evaluate(pop);
37
+
38
+ return pop
39
+
40
+ @staticmethod
41
+ def initializeRun(func):
42
+
43
+ @functools.wraps(func)
44
+ def wrapper(obj, *args, **kwargs):
45
+ obj.result=Result(obj)
46
+ res=func(obj, *args, **kwargs)
47
+ return res
48
+ return wrapper
49
+
50
+ @abc.abstractmethod
51
+ def run(self, problem, xInit=None, yInit=None):
52
+ pass
53
+
54
+ def evaluate(self, pop):
55
+
56
+ pop.evaluate(self.problem)
57
+ self.FEs+=pop.nPop
58
+
59
+ def checkTermination(self):
60
+
61
+ if self.FEs<=self.maxFEs:
62
+ if self.maxIter is None or self.iters<=self.maxIter:
63
+ if self.maxTolerateTimes is None or self.tolerateTimes<=self.maxTolerateTimes:
64
+ self.iters+=1
65
+ return True
66
+
67
+ return False
68
+
69
+ def setProblem(self, problem):
70
+ self.problem=problem
71
+
72
+ def saveResult(self):
73
+ if self.problem.nOutput>1:
74
+ self.result.save(type=1)
75
+ else:
76
+ self.result.save()
77
+
78
+ @Verbose.decoratorRecord
79
+ def record(self, pop):
80
+
81
+ if self.problem.nOutput==1:
82
+ self.result.update(pop, self.FEs, self.iters)
83
+ else:
84
+ self.result.update(pop, self.FEs, self.iters, 1)
85
+
86
+ def setParameters(self, key, value):
87
+
88
+ self.setting.setParameter(key, value)
89
+
90
+ def getParaValue(self, *args):
91
+
92
+ return self.setting.getParaValue(*args)
93
+
94
+ class Setting():
95
+ """
96
+ Save the parameter setting of the algorithm
97
+ """
98
+
99
+ def __init__(self):
100
+ self.keys=[]
101
+ self.values=[]
102
+ self.dicts={}
103
+
104
+ def setParameter(self, key, value):
105
+
106
+ self.dicts[key]=value
107
+ self.keys.append(key)
108
+ self.values.append(value)
109
+
110
+ def getParaValue(self, *args):
111
+
112
+ values=[]
113
+ for arg in args:
114
+ values.append(self.dicts[arg])
115
+
116
+ if len(args)>1:
117
+ return tuple(values)
118
+ else:
119
+ return values[0]
@@ -0,0 +1,2 @@
1
+ from .adam import Adam
2
+ from .boxmin import Boxmin
@@ -1,26 +1,39 @@
1
1
  import numpy as np
2
2
  from typing import Callable
3
3
 
4
- class Boxmin():
4
+ from ..algorithmABC import Algorithm
5
+ from ...problems import ProblemABC as Problem
6
+ class Boxmin(Algorithm):
5
7
  type='MP' #mathematical programming
6
- def __init__(self, initialPos: np.ndarray, ub: np.ndarray, lb: np.ndarray) -> None:
7
- self.initalPos=initialPos
8
- self.ub=ub
9
- self.lb=lb
10
- self.nv=0
8
+ def __init__(self) -> None:
9
+
10
+ super().__init__()
11
+
11
12
  ###################################Interface Function#################################
12
- def run(self, func: Callable):
13
- self.func=func
13
+ def run(self, problem: Problem, xInit=None):
14
+ self.ub=problem.ub.ravel()
15
+ self.lb=problem.lb.ravel()
16
+ if xInit is None:
17
+ xInit=np.random.uniform(problem.lb.ravel(), problem.ub.ravel(), problem.nInput)
18
+
19
+
20
+ self.func=problem.evaluate
21
+ self.nv=0;
22
+
23
+ self._start(xInit)
14
24
 
15
- self._start()
16
25
  p=self.initalPos.size
26
+ kmax = 2 if p <= 2 else min(p, 4)
17
27
 
18
- for _ in range(np.minimum(p,4)):
28
+ for _ in range(kmax):
19
29
  pos_copy=self.pos.copy()
20
30
  self._explore()
21
31
  self._move(pos_copy)
22
-
23
- return self.pos, self.f
32
+
33
+ self.result.bestDec=self.pos
34
+ self.result.bestObj=self.f
35
+
36
+ return self.result
24
37
  #######################################Private Function################################
25
38
  def _move(self, pos_old: np.ndarray):
26
39
 
@@ -82,14 +95,14 @@ class Boxmin():
82
95
  self.pos=pos
83
96
  self.f=f
84
97
 
85
- def _start(self):
98
+ def _start(self, xInit):
86
99
 
87
- p = self.initalPos.size
88
- D = 2 ** (np.arange(1, p + 1).reshape(-1, 1) / (p + 2))
100
+ self.initalPos=xInit
89
101
 
90
- f = self.func(self.initalPos)
102
+ p = xInit.size
103
+ D = 2 ** (np.arange(1, p + 1).reshape(-1, 1) / (p + 2))
91
104
 
92
105
  self.nv=1
93
106
  self.D=D
94
- self.f=f
107
+ self.f=self.func(xInit)
95
108
  self.pos=self.initalPos
@@ -0,0 +1,3 @@
1
+ from .hv import HV
2
+ from .igd import IGD
3
+ from .gd import GD
@@ -0,0 +1,12 @@
1
+ import numpy as np
2
+ from scipy.spatial.distance import cdist
3
+
4
+ def GD(pop, optimum):
5
+
6
+ distances = cdist(pop, optimum, metric='euclidean')
7
+
8
+ minDist=np.min(distances, axis=1)
9
+
10
+ gd=np.mean(minDist)
11
+
12
+ return gd