UQPyL 2.0.4__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 (177) hide show
  1. {UQPyL-2.0.4 → UQPyL-2.0.6}/PKG-INFO +69 -9
  2. {UQPyL-2.0.4 → UQPyL-2.0.6}/README.md +68 -7
  3. {UQPyL-2.0.4 → UQPyL-2.0.6}/UQPyL/DoE/__init__.py +1 -1
  4. {UQPyL-2.0.4 → UQPyL-2.0.6}/UQPyL/DoE/fast_sequence.py +5 -5
  5. {UQPyL-2.0.4 → UQPyL-2.0.6}/UQPyL/DoE/full_fact.py +1 -1
  6. UQPyL-2.0.6/UQPyL/DoE/lhs.py +213 -0
  7. {UQPyL-2.0.4 → UQPyL-2.0.6}/UQPyL/DoE/morris_sequence.py +5 -5
  8. {UQPyL-2.0.4 → UQPyL-2.0.6}/UQPyL/DoE/random.py +1 -2
  9. UQPyL-2.0.4/UQPyL/DoE/sampler_ABC.py → UQPyL-2.0.6/UQPyL/DoE/samplerABC.py +14 -4
  10. {UQPyL-2.0.4 → UQPyL-2.0.6}/UQPyL/DoE/sobol_sequence.py +5 -12
  11. {UQPyL-2.0.4 → 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.4/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.4/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.4/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.4/UQPyL/problems/multi_DTLZ.py → UQPyL-2.0.6/UQPyL/problems/multi_objective/DTLZ.py +13 -6
  45. UQPyL-2.0.4/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.4/UQPyL/problems/single_Benchmarks.py → UQPyL-2.0.6/UQPyL/problems/single_objective/single_base_problem.py +115 -71
  51. {UQPyL-2.0.4 → UQPyL-2.0.6}/UQPyL/sensibility/__init__.py +2 -1
  52. {UQPyL-2.0.4 → UQPyL-2.0.6}/UQPyL/sensibility/delta_test.py +5 -5
  53. {UQPyL-2.0.4 → UQPyL-2.0.6}/UQPyL/sensibility/fast.py +60 -81
  54. {UQPyL-2.0.4 → UQPyL-2.0.6}/UQPyL/sensibility/mars_sa.py +1 -1
  55. {UQPyL-2.0.4 → UQPyL-2.0.6}/UQPyL/sensibility/morris.py +55 -27
  56. {UQPyL-2.0.4 → UQPyL-2.0.6}/UQPyL/sensibility/rbd_fast.py +44 -45
  57. {UQPyL-2.0.4 → 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.4/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.4/UQPyL/surrogates/gp_kernels → UQPyL-2.0.6/UQPyL/surrogates/gp/kernel}/base_kernel.py +14 -6
  67. UQPyL-2.0.4/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.4/UQPyL/surrogates/krg_kernels → UQPyL-2.0.6/UQPyL/surrogates/kriging/kernel}/exp_kernel.py +9 -8
  77. {UQPyL-2.0.4/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.4/UQPyL/surrogates/mars_ → UQPyL-2.0.6/UQPyL/surrogates/mars/core}/_basis.c +6527 -5875
  81. {UQPyL-2.0.4/UQPyL/surrogates/mars_ → UQPyL-2.0.6/UQPyL/surrogates/mars/core}/_forward.c +4500 -3879
  82. {UQPyL-2.0.4/UQPyL/surrogates/mars_ → UQPyL-2.0.6/UQPyL/surrogates/mars/core}/_knot_search.c +5072 -4427
  83. {UQPyL-2.0.4/UQPyL/surrogates/mars_ → UQPyL-2.0.6/UQPyL/surrogates/mars/core}/_pruning.c +2782 -2179
  84. {UQPyL-2.0.4/UQPyL/surrogates/mars_ → UQPyL-2.0.6/UQPyL/surrogates/mars/core}/_qr.c +3232 -2607
  85. {UQPyL-2.0.4/UQPyL/surrogates/mars_ → UQPyL-2.0.6/UQPyL/surrogates/mars/core}/_record.c +3898 -3265
  86. {UQPyL-2.0.4/UQPyL/surrogates/mars_ → UQPyL-2.0.6/UQPyL/surrogates/mars/core}/_types.c +1594 -991
  87. {UQPyL-2.0.4/UQPyL/surrogates/mars_ → UQPyL-2.0.6/UQPyL/surrogates/mars/core}/_util.c +2060 -1461
  88. {UQPyL-2.0.4/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.4/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.4/UQPyL/surrogates/lasso_ → UQPyL-2.0.6/UQPyL/surrogates/regression/lasso}/__init__.py +1 -1
  100. {UQPyL-2.0.4/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.4/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.4 → UQPyL-2.0.6}/UQPyL/utility/__init__.py +5 -4
  109. {UQPyL-2.0.4 → UQPyL-2.0.6}/UQPyL/utility/grid_search.py +3 -4
  110. {UQPyL-2.0.4 → UQPyL-2.0.6}/UQPyL/utility/metrics.py +4 -6
  111. {UQPyL-2.0.4 → UQPyL-2.0.6}/UQPyL/utility/model_selections.py +10 -8
  112. {UQPyL-2.0.4 → UQPyL-2.0.6}/UQPyL/utility/polynomial_features.py +2 -0
  113. {UQPyL-2.0.4 → 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.4 → 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.4 → UQPyL-2.0.6}/UQPyL.egg-info/requires.txt +1 -0
  118. {UQPyL-2.0.4 → UQPyL-2.0.6}/pyproject.toml +2 -2
  119. UQPyL-2.0.6/setup.py +54 -0
  120. UQPyL-2.0.4/UQPyL/DoE/_lhs.py +0 -90
  121. UQPyL-2.0.4/UQPyL/DoE/lhs.py +0 -73
  122. UQPyL-2.0.4/UQPyL/optimization/__init__.py +0 -25
  123. UQPyL-2.0.4/UQPyL/optimization/asmo.py +0 -123
  124. UQPyL-2.0.4/UQPyL/optimization/ga.py +0 -190
  125. UQPyL-2.0.4/UQPyL/optimization/moea_d.py +0 -241
  126. UQPyL-2.0.4/UQPyL/optimization/nsga_ii.py +0 -297
  127. UQPyL-2.0.4/UQPyL/optimization/pso.py +0 -162
  128. UQPyL-2.0.4/UQPyL/optimization/sce_ua.py +0 -232
  129. UQPyL-2.0.4/UQPyL/problems/__init__.py +0 -22
  130. UQPyL-2.0.4/UQPyL/problems/pratical_problem.py +0 -27
  131. UQPyL-2.0.4/UQPyL/problems/problem_ABC.py +0 -54
  132. UQPyL-2.0.4/UQPyL/problems/utility_functions/_NDsort.py +0 -34
  133. UQPyL-2.0.4/UQPyL/problems/utility_functions/__init__.py +0 -0
  134. UQPyL-2.0.4/UQPyL/sensibility/sa_ABC.py +0 -92
  135. UQPyL-2.0.4/UQPyL/sensibility/sobol.py +0 -245
  136. UQPyL-2.0.4/UQPyL/surrogates/BaggingEnsemble.py +0 -1
  137. UQPyL-2.0.4/UQPyL/surrogates/BootstrapEnsemble.py +0 -1
  138. UQPyL-2.0.4/UQPyL/surrogates/__init__.py +0 -22
  139. UQPyL-2.0.4/UQPyL/surrogates/gaussian_process.py +0 -194
  140. UQPyL-2.0.4/UQPyL/surrogates/gp_kernels/__init__.py +0 -16
  141. UQPyL-2.0.4/UQPyL/surrogates/gp_kernels/dot_kernel.py +0 -82
  142. UQPyL-2.0.4/UQPyL/surrogates/gp_kernels/matern_kernel.py +0 -119
  143. UQPyL-2.0.4/UQPyL/surrogates/gp_kernels/rbf_kernel.py +0 -93
  144. UQPyL-2.0.4/UQPyL/surrogates/gp_kernels/rq_kernel.py +0 -132
  145. UQPyL-2.0.4/UQPyL/surrogates/krg_kernels/__init__.py +0 -8
  146. UQPyL-2.0.4/UQPyL/surrogates/krg_kernels/base_kernel.py +0 -77
  147. UQPyL-2.0.4/UQPyL/surrogates/krg_kernels/cubic_kernel.py +0 -60
  148. UQPyL-2.0.4/UQPyL/surrogates/kriging.py +0 -332
  149. UQPyL-2.0.4/UQPyL/surrogates/linear_regression.py +0 -225
  150. UQPyL-2.0.4/UQPyL/surrogates/mars_/pyearth/__init__.py +0 -4
  151. UQPyL-2.0.4/UQPyL/surrogates/mlp_utility/__init__.py +0 -9
  152. UQPyL-2.0.4/UQPyL/surrogates/polynomial_regression.py +0 -113
  153. UQPyL-2.0.4/UQPyL/surrogates/radial_basis_function.py +0 -93
  154. UQPyL-2.0.4/UQPyL/surrogates/rbf_kernels/base_kernel.py +0 -447
  155. UQPyL-2.0.4/UQPyL/surrogates/rbf_kernels/cubic_kernel.py +0 -14
  156. UQPyL-2.0.4/UQPyL/surrogates/rbf_kernels/gaussian_kernel.py +0 -9
  157. UQPyL-2.0.4/UQPyL/surrogates/rbf_kernels/linear_kernel.py +0 -15
  158. UQPyL-2.0.4/UQPyL/surrogates/rbf_kernels/multiquadric_kernel.py +0 -18
  159. UQPyL-2.0.4/UQPyL/surrogates/rbf_kernels/thin_plate_spline_kernel.py +0 -20
  160. UQPyL-2.0.4/UQPyL/surrogates/support_vector_machine.py +0 -106
  161. UQPyL-2.0.4/UQPyL/surrogates/surrogate_ABC.py +0 -150
  162. UQPyL-2.0.4/UQPyL.egg-info/SOURCES.txt +0 -106
  163. UQPyL-2.0.4/setup.py +0 -64
  164. {UQPyL-2.0.4 → UQPyL-2.0.6}/LICENSE.md +0 -0
  165. {UQPyL-2.0.4/UQPyL/optimization → UQPyL-2.0.6/UQPyL/optimization/mathematics}/adam.py +0 -0
  166. {UQPyL-2.0.4/UQPyL/optimization → UQPyL-2.0.6/UQPyL/optimization/single_objective}/_binary_ga.py +0 -0
  167. /UQPyL-2.0.4/UQPyL/optimization/utility_functions/_NDsort.py → /UQPyL-2.0.6/UQPyL/problems/utility_functions/NDsort.py +0 -0
  168. {UQPyL-2.0.4/UQPyL/optimization → UQPyL-2.0.6/UQPyL/problems}/utility_functions/__init__.py +0 -0
  169. /UQPyL-2.0.4/UQPyL/problems/utility_functions/_uniformPoint.py → /UQPyL-2.0.6/UQPyL/problems/utility_functions/uniformPoint.py +0 -0
  170. {UQPyL-2.0.4/UQPyL/surrogates/mlp_utility → UQPyL-2.0.6/UQPyL/surrogates/fnn}/_activation_funcs.py +0 -0
  171. {UQPyL-2.0.4/UQPyL/surrogates/mlp_utility → UQPyL-2.0.6/UQPyL/surrogates/fnn}/base.py +0 -0
  172. {UQPyL-2.0.4/UQPyL/surrogates/mars_ → UQPyL-2.0.6/UQPyL/surrogates/mars/core}/__init__.py +0 -0
  173. {UQPyL-2.0.4/UQPyL/surrogates/svr_ → UQPyL-2.0.6/UQPyL/surrogates/svr/core}/__init__.py +0 -0
  174. {UQPyL-2.0.4/UQPyL/surrogates/svr_ → UQPyL-2.0.6/UQPyL/surrogates/svr/core}/svm.cpp +0 -0
  175. {UQPyL-2.0.4 → UQPyL-2.0.6}/UQPyL.egg-info/dependency_links.txt +0 -0
  176. {UQPyL-2.0.4 → UQPyL-2.0.6}/UQPyL.egg-info/top_level.txt +0 -0
  177. {UQPyL-2.0.4 → 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.4
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
  '''
@@ -0,0 +1,213 @@
1
+ import numpy as np
2
+ from typing import Literal, Optional
3
+ from scipy.spatial.distance import pdist
4
+
5
+ from ..problems import ProblemABC as Problem
6
+
7
+ from .samplerABC import Sampler, decoratorRescale
8
+
9
+ # from ._lhs import _lhs_classic, _lhs_centered, _lhs_correlate, _lhs_maximin, _lhs_centered_maximin
10
+
11
+
12
+
13
+ def _lhs_classic(nt: int, nx: int, random_state=None) -> np.ndarray:
14
+ # Generate the intervals
15
+ if random_state is None:
16
+ random_state=np.random.RandomState()
17
+ cut = np.linspace(0, 1, nt + 1)
18
+
19
+ # Fill points uniformly in each interval
20
+ u = random_state.rand(nt, nx)
21
+ a = cut[:nt]
22
+ b = cut[1:nt + 1]
23
+ rdpoints = np.zeros_like(u)
24
+ for j in range(nx):
25
+ rdpoints[:, j] = u[:, j]*(b-a) + a
26
+
27
+ # Make the random pairings
28
+ H = np.zeros_like(rdpoints)
29
+ for j in range(nx):
30
+ order = random_state.permutation(range(nt))
31
+ H[:, j] = rdpoints[order, j]
32
+
33
+ return H
34
+
35
+ ################################################################################
36
+
37
+ def _lhs_centered(nt: int, nx: int, random_state=None) -> np.ndarray:
38
+
39
+ if random_state is None:
40
+ random_state=np.random.RandomState()
41
+
42
+ # Generate the intervals
43
+ cut = np.linspace(0, 1, nt + 1)
44
+
45
+ # Fill points uniformly in each interval
46
+ u = random_state.rand(nt, nx)
47
+ a = cut[:nt]
48
+ b = cut[1:nt + 1]
49
+ _center = (a + b)/2
50
+
51
+ # Make the random pairings
52
+ H = np.zeros_like(u)
53
+ for j in range(nx):
54
+ H[:, j] = random_state.permutation(_center)
55
+
56
+ return H
57
+
58
+ ################################################################################
59
+
60
+ def _lhs_maximin(nt: int, nx: int, iterations: int, random_state=None)-> np.ndarray:
61
+
62
+ if random_state is None:
63
+ random_state=np.random.RandomState()
64
+
65
+ maxdist = 0
66
+
67
+ # Maximize the minimum distance between points
68
+ for i in range(iterations):
69
+
70
+ H_candidate = _lhs_classic(nt, nx, random_state)
71
+
72
+ d = pdist(H_candidate,'euclidean')
73
+ if maxdist<np.min(d):
74
+ maxdist = np.min(d)
75
+ H = H_candidate.copy()
76
+
77
+ return H
78
+
79
+ def _lhs_centered_maximin(nt: int, nx: int, iterations: int, random_state=None)-> np.ndarray:
80
+
81
+ if random_state is None:
82
+ random_state=np.random.RandomState()
83
+
84
+ maxdist = 0
85
+
86
+ # Maximize the minimum distance between points
87
+ for i in range(iterations):
88
+
89
+ H_candidate = _lhs_centered(nt, nx, random_state)
90
+ d = pdist(H_candidate,'euclidean')
91
+ if maxdist<np.min(d):
92
+ maxdist = np.min(d)
93
+ H = H_candidate.copy()
94
+
95
+ return H
96
+ ################################################################################
97
+
98
+ def _lhs_correlate(nt: int, nx: int, iterations: int, random_state=None) -> np.ndarray:
99
+
100
+ if random_state is None:
101
+ random_state=np.random.RandomState()
102
+
103
+ mincorr = np.inf
104
+
105
+ # Minimize the components correlation coefficients
106
+ for _ in range(iterations):
107
+ # Generate a random LHS
108
+ H_candidate = _lhs_classic(nt, nx, random_state)
109
+ R = np.corrcoef(H_candidate)
110
+ if np.max(np.abs(R[R!=1]))<mincorr:
111
+ mincorr = np.max(np.abs(R-np.eye(R.shape[0])))
112
+ print('new candidate solution found with max,abs corrcoef = {}'.format(mincorr))
113
+ H = H_candidate.copy()
114
+
115
+ return H
116
+
117
+ Criterion=Literal['classic','center','maximin','center_maximin','correlation']
118
+ LHS_METHOD={'classic': _lhs_classic, 'center': _lhs_centered, 'maximin': _lhs_maximin,
119
+ 'center_maximin': _lhs_centered_maximin, 'correlation': _lhs_correlate}
120
+
121
+ class LHS(Sampler):
122
+ '''
123
+ Latin-hypercube design
124
+
125
+ Parameters:
126
+ criterion : str
127
+ Allowable values are "classic", "center", "maximin", "center_maximin",
128
+ and "correlation". (Default: classic)
129
+
130
+ iterations : int
131
+ The number of iterations in the maximin, center_maximin and correlations methods
132
+ (Default: 5).
133
+
134
+ problem : problem
135
+ if the problem is provided, the bounds of the problem will be used to generate the samples
136
+
137
+ Methods:
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
+
144
+ '''
145
+ def __init__(self, criterion: Criterion ='classic', iterations: int=5, problem: Optional[Problem]=None):
146
+
147
+ self.criterion=criterion
148
+ self.iterations=iterations
149
+ self.problem=problem
150
+
151
+ #initial random state
152
+ self.random_state=np.random.RandomState()
153
+
154
+
155
+ def _generate(self, nt: int, nx: int) -> np.ndarray:
156
+ '''
157
+ Generate a Latin-hypercube design
158
+
159
+ Parameters
160
+ nt: int
161
+ the number of sampled points
162
+ nx: int
163
+ the input dimensions of sampled points
164
+
165
+ Returns:
166
+ H: 2d-array
167
+ An n-by-samples design matrix that has been normalized so factor values
168
+ are uniformly spaced between zero and one.
169
+ '''
170
+
171
+ if self.problem is not None:
172
+ if(self.problem.nInput!=nx):
173
+ raise ValueError('The input dimensions of the problem and the samples must be the same')
174
+
175
+ if self.criterion not in LHS_METHOD:
176
+ raise ValueError('The criterion must be one of {}'.format(LHS_METHOD.keys()))
177
+
178
+ Sampling_method=LHS_METHOD[self.criterion]
179
+
180
+ if self.criterion in ['maximin', 'center_maximin', 'correlation']:
181
+ xInit=Sampling_method(nt, nx, self.iterations, self.random_state)
182
+ else:
183
+ xInit=Sampling_method(nt, nx, self.random_state)
184
+
185
+ return xInit
186
+
187
+ @decoratorRescale
188
+ def sample(self, nt: int, nx:int, random_seed: Optional[int]=None) -> np.ndarray:
189
+ '''
190
+ Generate a Latin-hypercube design
191
+
192
+ Parameters
193
+ nt: int
194
+ the number of sampled points
195
+
196
+ nx: int
197
+ the input dimensions of sampled points
198
+
199
+ random_seed: int
200
+ the random seed for the random number generator
201
+
202
+ Returns:
203
+ H: 2d-array
204
+ An n-by-samples design matrix that has been normalized so factor values
205
+ are uniformly spaced between zero and one.
206
+ '''
207
+
208
+ if random_seed is not None:
209
+ self.random_state = np.random.RandomState(random_seed)
210
+ else:
211
+ self.random_state = np.random.RandomState()
212
+
213
+ return self._generate(nt, nx)
@@ -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.4"
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