UQPyL 2.1.3__tar.gz → 2.1.4__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 (164) hide show
  1. {UQPyL-2.1.3 → uqpyl-2.1.4}/PKG-INFO +17 -5
  2. {UQPyL-2.1.3 → uqpyl-2.1.4}/README.md +9 -2
  3. uqpyl-2.1.4/UQPyL/DoE/__init__.py +12 -0
  4. uqpyl-2.1.4/UQPyL/DoE/base.py +22 -0
  5. UQPyL-2.1.3/UQPyL/DoE/fast_sequence.py → uqpyl-2.1.4/UQPyL/DoE/fast.py +13 -19
  6. {UQPyL-2.1.3 → uqpyl-2.1.4}/UQPyL/DoE/full_fact.py +9 -18
  7. {UQPyL-2.1.3 → uqpyl-2.1.4}/UQPyL/DoE/lhs.py +36 -60
  8. UQPyL-2.1.3/UQPyL/DoE/morris_sequence.py → uqpyl-2.1.4/UQPyL/DoE/morris.py +15 -21
  9. uqpyl-2.1.4/UQPyL/DoE/random.py +45 -0
  10. UQPyL-2.1.3/UQPyL/DoE/saltelli_sequence.py → uqpyl-2.1.4/UQPyL/DoE/saltelli.py +14 -21
  11. UQPyL-2.1.3/UQPyL/DoE/sobol_sequence.py → uqpyl-2.1.4/UQPyL/DoE/sobol.py +16 -20
  12. uqpyl-2.1.4/UQPyL/__init__.py +14 -0
  13. uqpyl-2.1.4/UQPyL/analysis/__init__.py +16 -0
  14. uqpyl-2.1.4/UQPyL/analysis/base.py +333 -0
  15. UQPyL-2.1.3/UQPyL/sensibility/delta_test.py → uqpyl-2.1.4/UQPyL/analysis/delta.py +43 -40
  16. {UQPyL-2.1.3/UQPyL/sensibility → uqpyl-2.1.4/UQPyL/analysis}/fast.py +48 -48
  17. UQPyL-2.1.3/UQPyL/sensibility/mars_sa.py → uqpyl-2.1.4/UQPyL/analysis/mars.py +48 -38
  18. {UQPyL-2.1.3/UQPyL/sensibility → uqpyl-2.1.4/UQPyL/analysis}/morris.py +62 -55
  19. {UQPyL-2.1.3/UQPyL/sensibility → uqpyl-2.1.4/UQPyL/analysis}/rbd_fast.py +51 -38
  20. {UQPyL-2.1.3/UQPyL/sensibility → uqpyl-2.1.4/UQPyL/analysis}/rsa.py +62 -48
  21. {UQPyL-2.1.3/UQPyL/sensibility → uqpyl-2.1.4/UQPyL/analysis}/sobol.py +88 -68
  22. uqpyl-2.1.4/UQPyL/inference/__init__.py +5 -0
  23. uqpyl-2.1.4/UQPyL/inference/amh.py +199 -0
  24. uqpyl-2.1.4/UQPyL/inference/base.py +383 -0
  25. uqpyl-2.1.4/UQPyL/inference/chain.py +45 -0
  26. uqpyl-2.1.4/UQPyL/inference/demc.py +178 -0
  27. uqpyl-2.1.4/UQPyL/inference/dream_zs.py +291 -0
  28. uqpyl-2.1.4/UQPyL/inference/mh.py +161 -0
  29. uqpyl-2.1.4/UQPyL/inference/mh_gibbs.py +185 -0
  30. uqpyl-2.1.4/UQPyL/optimization/__init__.py +7 -0
  31. UQPyL-2.1.3/UQPyL/optimization/algorithmABC.py → uqpyl-2.1.4/UQPyL/optimization/base.py +64 -37
  32. {UQPyL-2.1.3 → uqpyl-2.1.4}/UQPyL/optimization/metric/gd.py +2 -2
  33. {UQPyL-2.1.3 → uqpyl-2.1.4}/UQPyL/optimization/metric/hv.py +1 -11
  34. {UQPyL-2.1.3 → uqpyl-2.1.4}/UQPyL/optimization/metric/igd.py +1 -3
  35. {UQPyL-2.1.3/UQPyL/optimization/multi_objective → uqpyl-2.1.4/UQPyL/optimization/moea}/moasmo.py +36 -37
  36. {UQPyL-2.1.3/UQPyL/optimization/multi_objective → uqpyl-2.1.4/UQPyL/optimization/moea}/moea_d.py +23 -31
  37. {UQPyL-2.1.3/UQPyL/optimization/multi_objective → uqpyl-2.1.4/UQPyL/optimization/moea}/nsga_ii.py +52 -54
  38. {UQPyL-2.1.3/UQPyL/optimization/multi_objective → uqpyl-2.1.4/UQPyL/optimization/moea}/nsga_iii.py +50 -54
  39. {UQPyL-2.1.3/UQPyL/optimization/multi_objective → uqpyl-2.1.4/UQPyL/optimization/moea}/rvea.py +34 -40
  40. {UQPyL-2.1.3 → uqpyl-2.1.4}/UQPyL/optimization/population.py +39 -43
  41. uqpyl-2.1.4/UQPyL/optimization/result.py +263 -0
  42. {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.4/UQPyL/optimization/soea}/abc.py +22 -26
  43. {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.4/UQPyL/optimization/soea}/asmo.py +30 -36
  44. {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.4/UQPyL/optimization/soea}/csa.py +42 -54
  45. {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.4/UQPyL/optimization/soea}/de.py +36 -40
  46. {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.4/UQPyL/optimization/soea}/ego.py +36 -34
  47. {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.4/UQPyL/optimization/soea}/ga.py +37 -39
  48. {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.4/UQPyL/optimization/soea}/ml_sce_ua.py +29 -37
  49. {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.4/UQPyL/optimization/soea}/pso.py +44 -53
  50. {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.4/UQPyL/optimization/soea}/sce_ua.py +30 -40
  51. uqpyl-2.1.4/UQPyL/optimization/util/__init__.py +5 -0
  52. uqpyl-2.1.4/UQPyL/optimization/util/crowding_distance.py +63 -0
  53. UQPyL-2.1.3/UQPyL/optimization/utility_functions/operation_GA.py → uqpyl-2.1.4/UQPyL/optimization/util/ga_operator.py +7 -11
  54. uqpyl-2.1.4/UQPyL/optimization/util/non_dominated_sort.py +43 -0
  55. uqpyl-2.1.4/UQPyL/optimization/util/tournament.py +57 -0
  56. {UQPyL-2.1.3/UQPyL/problems → uqpyl-2.1.4/UQPyL/problem}/__init__.py +9 -9
  57. UQPyL-2.1.3/UQPyL/problems/problemABC.py → uqpyl-2.1.4/UQPyL/problem/base.py +12 -6
  58. {UQPyL-2.1.3/UQPyL/problems/multi_objective → uqpyl-2.1.4/UQPyL/problem/mop}/DTLZ.py +167 -80
  59. {UQPyL-2.1.3/UQPyL/problems/multi_objective → uqpyl-2.1.4/UQPyL/problem/mop}/ZDT.py +11 -11
  60. {UQPyL-2.1.3/UQPyL/problems → uqpyl-2.1.4/UQPyL/problem}/problem.py +1 -1
  61. {UQPyL-2.1.3/UQPyL/problems/single_objective → uqpyl-2.1.4/UQPyL/problem/sop}/single_constraint_problem.py +1 -1
  62. {UQPyL-2.1.3/UQPyL/problems/single_objective → uqpyl-2.1.4/UQPyL/problem/sop}/single_simple_problem.py +1 -1
  63. uqpyl-2.1.4/UQPyL/problem/util/non_dominated_sort.py +86 -0
  64. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/__init__.py +1 -1
  65. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/auto_tuner.py +16 -16
  66. UQPyL-2.1.3/UQPyL/surrogates/surrogateABC.py → uqpyl-2.1.4/UQPyL/surrogate/base.py +9 -66
  67. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/fnn/fully_connect_neural_network.py +7 -5
  68. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/gp/gaussian_process.py +10 -29
  69. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/kriging/kriging.py +12 -12
  70. uqpyl-2.1.4/UQPyL/surrogate/mars/core/_basis.c +53209 -0
  71. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/mars/core/_forward.c +19228 -20367
  72. uqpyl-2.1.4/UQPyL/surrogate/mars/core/_knot_search.c +56144 -0
  73. uqpyl-2.1.4/UQPyL/surrogate/mars/core/_pruning.c +21153 -0
  74. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/mars/core/_qr.c +14568 -15539
  75. uqpyl-2.1.4/UQPyL/surrogate/mars/core/_record.c +28898 -0
  76. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/mars/core/_types.c +2995 -2538
  77. uqpyl-2.1.4/UQPyL/surrogate/mars/core/_util.c +15411 -0
  78. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/mars/mars.py +5 -5
  79. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/rbf/radial_basis_function.py +5 -5
  80. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/regression/lasso/lasso_fast.c +22204 -25017
  81. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/regression/linear_regression.py +5 -5
  82. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/regression/polynomial_regression.py +1 -2
  83. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/svr/support_vector_machine.py +6 -5
  84. uqpyl-2.1.4/UQPyL/util/__init__.py +29 -0
  85. UQPyL-2.1.3/UQPyL/utility/metrics.py → uqpyl-2.1.4/UQPyL/util/metric.py +1 -1
  86. uqpyl-2.1.4/UQPyL/util/plot.py +772 -0
  87. UQPyL-2.1.3/UQPyL/utility/polynomial_features.py → uqpyl-2.1.4/UQPyL/util/poly.py +1 -1
  88. UQPyL-2.1.3/UQPyL/utility/data_selections.py → uqpyl-2.1.4/UQPyL/util/split.py +1 -0
  89. {UQPyL-2.1.3/UQPyL/utility → uqpyl-2.1.4/UQPyL/util}/verbose.py +202 -91
  90. {UQPyL-2.1.3 → uqpyl-2.1.4}/UQPyL.egg-info/PKG-INFO +17 -5
  91. uqpyl-2.1.4/UQPyL.egg-info/SOURCES.txt +141 -0
  92. {UQPyL-2.1.3 → uqpyl-2.1.4}/pyproject.toml +2 -2
  93. uqpyl-2.1.4/setup.py +52 -0
  94. UQPyL-2.1.3/UQPyL/DoE/__init__.py +0 -10
  95. UQPyL-2.1.3/UQPyL/DoE/random.py +0 -54
  96. UQPyL-2.1.3/UQPyL/DoE/samplerABC.py +0 -54
  97. UQPyL-2.1.3/UQPyL/__init__.py +0 -13
  98. UQPyL-2.1.3/UQPyL/optimization/__init__.py +0 -5
  99. UQPyL-2.1.3/UQPyL/optimization/result.py +0 -241
  100. UQPyL-2.1.3/UQPyL/optimization/utility_functions/__init__.py +0 -4
  101. UQPyL-2.1.3/UQPyL/optimization/utility_functions/crowding_distance.py +0 -31
  102. UQPyL-2.1.3/UQPyL/optimization/utility_functions/ndsort.py +0 -50
  103. UQPyL-2.1.3/UQPyL/optimization/utility_functions/tournament_selection.py +0 -37
  104. UQPyL-2.1.3/UQPyL/problems/utility_functions/NDsort.py +0 -34
  105. UQPyL-2.1.3/UQPyL/sensibility/__init__.py +0 -16
  106. UQPyL-2.1.3/UQPyL/sensibility/saABC.py +0 -242
  107. UQPyL-2.1.3/UQPyL/surrogates/mars/core/_basis.c +0 -56172
  108. UQPyL-2.1.3/UQPyL/surrogates/mars/core/_knot_search.c +0 -57281
  109. UQPyL-2.1.3/UQPyL/surrogates/mars/core/_pruning.c +0 -20743
  110. UQPyL-2.1.3/UQPyL/surrogates/mars/core/_record.c +0 -29180
  111. UQPyL-2.1.3/UQPyL/surrogates/mars/core/_util.c +0 -14654
  112. UQPyL-2.1.3/UQPyL/utility/__init__.py +0 -19
  113. UQPyL-2.1.3/UQPyL.egg-info/SOURCES.txt +0 -132
  114. UQPyL-2.1.3/setup.py +0 -53
  115. {UQPyL-2.1.3 → uqpyl-2.1.4}/UQPyL/optimization/metric/__init__.py +0 -0
  116. {UQPyL-2.1.3/UQPyL/optimization/multi_objective → uqpyl-2.1.4/UQPyL/optimization/moea}/__init__.py +0 -0
  117. {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.4/UQPyL/optimization/soea}/__init__.py +0 -0
  118. {UQPyL-2.1.3/UQPyL/optimization/utility_functions → uqpyl-2.1.4/UQPyL/optimization/util}/uniform_point.py +0 -0
  119. {UQPyL-2.1.3/UQPyL/problems/multi_objective → uqpyl-2.1.4/UQPyL/problem/mop}/__init__.py +0 -0
  120. {UQPyL-2.1.3/UQPyL/problems/single_objective → uqpyl-2.1.4/UQPyL/problem/sop}/__init__.py +0 -0
  121. {UQPyL-2.1.3/UQPyL/problems/utility_functions → uqpyl-2.1.4/UQPyL/problem/util}/__init__.py +0 -0
  122. {UQPyL-2.1.3/UQPyL/problems/utility_functions → uqpyl-2.1.4/UQPyL/problem/util}/uniformPoint.py +0 -0
  123. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/fnn/__init__.py +0 -0
  124. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/fnn/_activation_funcs.py +0 -0
  125. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/fnn/base.py +0 -0
  126. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/gp/__init__.py +0 -0
  127. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/gp/kernel/__init__.py +0 -0
  128. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/gp/kernel/base_kernel.py +0 -0
  129. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/gp/kernel/c_kernel_.py +0 -0
  130. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/gp/kernel/dot_kernel_.py +0 -0
  131. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/gp/kernel/matern_kernel.py +0 -0
  132. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/gp/kernel/rbf_kernel.py +0 -0
  133. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/gp/kernel/rq_kernel.py +0 -0
  134. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/kriging/__init__.py +0 -0
  135. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/kriging/kernel/__init__.py +0 -0
  136. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/kriging/kernel/base_kernel.py +0 -0
  137. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/kriging/kernel/cubic_kernel.py +0 -0
  138. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/kriging/kernel/exp_kernel.py +0 -0
  139. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/kriging/kernel/guass_kernel.py +0 -0
  140. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/mars/__init__.py +0 -0
  141. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/mars/core/__init__.py +0 -0
  142. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/rbf/__init__.py +0 -0
  143. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/rbf/kernel/__init__.py +0 -0
  144. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/rbf/kernel/base_kernel.py +0 -0
  145. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/rbf/kernel/cubic_kernel.py +0 -0
  146. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/rbf/kernel/gaussian_kernel.py +0 -0
  147. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/rbf/kernel/linear_kernel.py +0 -0
  148. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/rbf/kernel/multiquadric_kernel.py +0 -0
  149. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/rbf/kernel/thin_plate_spline_kernel.py +0 -0
  150. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/regression/__init__.py +0 -0
  151. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/regression/lasso/__init__.py +0 -0
  152. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/setting.py +0 -0
  153. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/svr/__init__.py +0 -0
  154. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/svr/core/__init__.py +0 -0
  155. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/svr/core/libsvm_interface.cpp +0 -0
  156. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/svr/core/svm.cpp +0 -0
  157. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/util/__init__.py +0 -0
  158. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/util/adam.py +0 -0
  159. {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.4/UQPyL/surrogate}/util/boxmin.py +0 -0
  160. /UQPyL-2.1.3/UQPyL/utility/scalers.py → /uqpyl-2.1.4/UQPyL/util/scaler.py +0 -0
  161. {UQPyL-2.1.3 → uqpyl-2.1.4}/UQPyL.egg-info/dependency_links.txt +0 -0
  162. {UQPyL-2.1.3 → uqpyl-2.1.4}/UQPyL.egg-info/requires.txt +0 -0
  163. {UQPyL-2.1.3 → uqpyl-2.1.4}/UQPyL.egg-info/top_level.txt +0 -0
  164. {UQPyL-2.1.3 → uqpyl-2.1.4}/setup.cfg +0 -0
@@ -1,18 +1,23 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: UQPyL
3
- Version: 2.1.3
3
+ Version: 2.1.4
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.7
8
7
  Classifier: Programming Language :: Python :: 3.8
9
8
  Classifier: Programming Language :: Python :: 3.9
10
9
  Classifier: Programming Language :: Python :: 3.10
11
10
  Classifier: Programming Language :: Python :: 3.11
12
11
  Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
13
  Classifier: License :: OSI Approved :: MIT License
14
14
  Classifier: Operating System :: OS Independent
15
15
  Description-Content-Type: text/markdown
16
+ Requires-Dist: numpy
17
+ Requires-Dist: scipy
18
+ Requires-Dist: prettytable
19
+ Requires-Dist: h5py
20
+ Dynamic: author
16
21
 
17
22
  # UQPyL: Uncertainty Quantification Python Lab
18
23
 
@@ -20,11 +25,18 @@ Description-Content-Type: text/markdown
20
25
 
21
26
  [![PyPI version](https://badge.fury.io/py/UQPyL.svg?icon=si%3Apython&icon_color=%2331aadd)](https://badge.fury.io/py/UQPyL) ![PyPI - Downloads](https://img.shields.io/pypi/dm/UQPyL) ![PyPI - License](https://img.shields.io/pypi/l/UQPyL) ![GitHub last commit](https://img.shields.io/github/last-commit/smasky/UQPyL) ![Static Badge](https://img.shields.io/badge/Author-wmtSky-orange) ![Static Badge](https://img.shields.io/badge/Contact-wmtsmasky%40gmail.com-blue)
22
27
 
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.
28
+ **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, Bayesian Inference, Optimization (Single- and Multi-objective). Additionally, **Surrogate Models** are built-in for solving computationally expensive problems.
24
29
 
25
30
  👉[中文简介](https://github.com/smasky/UQPyL/blob/dev/README_CN.md)
26
31
 
27
- 👉[Documentation](https://uqpyl.readthedocs.io/en/latest/)
32
+ 👉[中文文档](https://swat-uq.readthedocs.io/en/latest/zh/index.html)
33
+
34
+ 👉[Documentation](https://uqpyl.readthedocs.io)
35
+
36
+ ## Changelog
37
+
38
+ - 2025.12.14: Added the **inference** module. And results are now saved in **NetCDF** format, replacing the previous HDF output.
39
+
28
40
 
29
41
  ## Contents
30
42
 
@@ -4,11 +4,18 @@
4
4
 
5
5
  [![PyPI version](https://badge.fury.io/py/UQPyL.svg?icon=si%3Apython&icon_color=%2331aadd)](https://badge.fury.io/py/UQPyL) ![PyPI - Downloads](https://img.shields.io/pypi/dm/UQPyL) ![PyPI - License](https://img.shields.io/pypi/l/UQPyL) ![GitHub last commit](https://img.shields.io/github/last-commit/smasky/UQPyL) ![Static Badge](https://img.shields.io/badge/Author-wmtSky-orange) ![Static Badge](https://img.shields.io/badge/Contact-wmtsmasky%40gmail.com-blue)
6
6
 
7
- **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.
7
+ **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, Bayesian Inference, Optimization (Single- and Multi-objective). Additionally, **Surrogate Models** are built-in for solving computationally expensive problems.
8
8
 
9
9
  👉[中文简介](https://github.com/smasky/UQPyL/blob/dev/README_CN.md)
10
10
 
11
- 👉[Documentation](https://uqpyl.readthedocs.io/en/latest/)
11
+ 👉[中文文档](https://swat-uq.readthedocs.io/en/latest/zh/index.html)
12
+
13
+ 👉[Documentation](https://uqpyl.readthedocs.io)
14
+
15
+ ## Changelog
16
+
17
+ - 2025.12.14: Added the **inference** module. And results are now saved in **NetCDF** format, replacing the previous HDF output.
18
+
12
19
 
13
20
  ## Contents
14
21
 
@@ -0,0 +1,12 @@
1
+ from .lhs import LHS
2
+ from .full_fact import FFD
3
+ from .random import Random
4
+ from .base import Sampler
5
+ from .sobol import SobolSequence
6
+ from .fast import FASTSequence
7
+ from .morris import MorrisSequence
8
+ from .saltelli import SaltelliSequence
9
+
10
+ __all__ = ['LHS', 'FFD', 'Random', 'SaltelliSequence','SobolSequence',
11
+ 'MorrisSequence', 'FASTSequence', 'Sampler']
12
+
@@ -0,0 +1,22 @@
1
+ import abc
2
+ import numpy as np
3
+
4
+ from ..problem import ProblemABC as Problem
5
+
6
+ class Sampler(metaclass = abc.ABCMeta):
7
+
8
+ def __init__(self):
9
+
10
+ pass
11
+
12
+ def _generate(self, nt: int, nx: int, seed = None):
13
+ '''
14
+ nt: the number of sampled points
15
+ nx: the dimensions of decision variables
16
+
17
+ return:
18
+ ndarry[nt,nx]
19
+ '''
20
+
21
+ pass
22
+
@@ -1,12 +1,12 @@
1
1
  import numpy as np
2
2
  from typing import Union, Optional
3
3
 
4
- from .samplerABC import Sampler, decoratorRescale
5
- from ..problems import ProblemABC as Problem
4
+ from .base import Sampler
5
+ from ..problem import ProblemABC as Problem
6
6
 
7
- class FAST_Sequence(Sampler):
7
+ class FASTSequence(Sampler):
8
8
  """
9
- The sample technique for FAST (Fourier Amplitude Sensitivity Test) method.
9
+ The sample method for FAST (Fourier Amplitude Sensitivity Test) method.
10
10
 
11
11
  This class generates samples for the FAST method, which is used for sensitivity analysis
12
12
  by decomposing the output variance into contributions from each input variable.
@@ -31,8 +31,10 @@ class FAST_Sequence(Sampler):
31
31
 
32
32
  :param nt: Number of sample points.
33
33
  :param nx: Input dimensions of sampled points.
34
+
34
35
  :return: A 2D array of samples, normalized so factor values are uniformly spaced between zero and one.
35
36
  """
37
+
36
38
  if nt <= 4 * self.M**2:
37
39
  raise ValueError("The number of samples must be greater than 4 * M^2!")
38
40
 
@@ -55,37 +57,29 @@ class FAST_Sequence(Sampler):
55
57
  idx = list(range(i)) + list(range(i + 1, nx))
56
58
  w_tmp[idx] = w[1:]
57
59
  idx = range(i * nt, (i + 1) * nt)
58
- phi = 2 * np.pi * np.random.rand()
60
+ phi = 2 * np.pi * self.rng.random()
59
61
  sin_result = np.sin(w_tmp[:, None] * s + phi)
60
62
  arsin_result = (1 / np.pi) * np.arcsin(sin_result) # Saltelli's formula
61
63
  xInit[idx, :] = 0.5 + arsin_result.transpose()
62
64
 
63
65
  return xInit
64
66
 
65
- @decoratorRescale
66
- def sample(self, nt: int, nx: Optional[int] = None, problem: Optional[Problem] = None, random_seed: Optional[int] = None):
67
+ def sample(self, problem: Problem, nt: int, seed: int = None):
67
68
  """
68
69
  Generate a sample for the FAST method.
69
70
 
71
+ :param problem: Problem instance to use bounds for sampling.
70
72
  :param nt: Number of sample points.
71
73
  :param nx: Input dimensions of sampled points.
72
- :param problem: Problem instance to use bounds for sampling.
73
74
  :param random_seed: Random seed for reproducibility.
75
+
74
76
  :return: A 2D array of FAST samples.
75
77
  """
76
- if random_seed is not None:
77
- self.random_state = np.random.RandomState(random_seed)
78
- else:
79
- self.random_state = np.random.RandomState()
80
78
 
81
- if problem is not None and nx is not None:
82
- if problem.nInput != nx:
83
- raise ValueError('The input dimensions of the problem and the samples must be the same')
84
- elif problem is None and nx is None:
85
- raise ValueError('Either the problem or the input dimensions must be provided')
79
+ self.rng = np.random.default_rng(seed) if seed is not None else np.random.default_rng()
86
80
 
87
- nx = problem.nInput if problem is not None else nx
81
+ nx = problem.nInput
88
82
 
89
- return self._generate(nt, nx)
83
+ return problem._transform_unit_X(self._generate(nt, nx))
90
84
 
91
85
 
@@ -2,8 +2,8 @@ import numpy as np
2
2
  from typing import Union, Optional
3
3
  from itertools import product
4
4
 
5
- from .samplerABC import Sampler, decoratorRescale
6
- from ..problems import ProblemABC as Problem
5
+ from .base import Sampler
6
+ from ..problem import ProblemABC as Problem
7
7
 
8
8
  class FFD(Sampler):
9
9
  """
@@ -39,28 +39,19 @@ class FFD(Sampler):
39
39
 
40
40
  return H
41
41
 
42
- @decoratorRescale
43
- def sample(self, levels: Union[np.ndarray, int, list], nx: Optional[int] = None, problem: Optional[Problem] = None, random_seed: Optional[int] = None):
42
+ def sample(self, problem: Problem, levels: Union[np.ndarray, int, list], seed: Optional[int] = None):
44
43
  """
45
44
  Generate a full factorial design sample.
46
45
 
47
- :param levels: Levels for each input dimension. Can be an integer, list, or ndarray.
48
- :param nx: Number of input dimensions.
49
46
  :param problem: Problem instance to use bounds for sampling.
47
+ :param levels: Levels for each input dimension. Can be an integer, list, or ndarray.
50
48
  :param random_seed: Random seed for reproducibility.
49
+
51
50
  :return: A 2D array of full factorial design samples.
52
51
  """
53
- if random_seed is not None:
54
- self.random_state = np.random.RandomState(random_seed)
55
- else:
56
- self.random_state = np.random.RandomState()
57
-
58
- if problem is not None and nx is not None:
59
- if problem.nInput != nx:
60
- raise ValueError('The input dimensions of the problem and the samples must be the same')
61
- elif problem is None and nx is None:
62
- raise ValueError('Either the problem or the input dimensions must be provided')
63
52
 
64
- nx = problem.nInput if problem is not None else nx
53
+ self.rng = np.random.default_rng(seed) if seed is not None else np.random.default_rng()
54
+
55
+ nx = problem.nInput
65
56
 
66
- return self._generate(levels, nx)
57
+ return problem._transform_unit_X(self._generate(levels, nx))
@@ -2,26 +2,24 @@ from typing import Literal, Optional
2
2
  import numpy as np
3
3
  from scipy.spatial.distance import pdist
4
4
 
5
- from .samplerABC import Sampler, decoratorRescale
6
- from ..problems import ProblemABC as Problem
5
+ from .base import Sampler
6
+ from ..problem import ProblemABC as Problem
7
7
 
8
- def _lhs_classic(nt: int, nx: int, random_state=None) -> np.ndarray:
8
+ def _lhs_classic(nt: int, nx: int, rng):
9
9
  """
10
10
  Generate a classic Latin Hypercube Sampling (LHS) design.
11
11
 
12
12
  :param nt: Number of samples.
13
13
  :param nx: Number of dimensions.
14
- :param random_state: Random state for reproducibility.
14
+ :param rng: Random state for reproducibility.
15
15
  :return: A 2D array of LHS samples.
16
16
  """
17
- if random_state is None:
18
- random_state = np.random.RandomState()
19
-
17
+
20
18
  # Generate the intervals
21
19
  cut = np.linspace(0, 1, nt + 1)
22
20
 
23
21
  # Fill points uniformly in each interval
24
- u = random_state.rand(nt, nx)
22
+ u = rng.random((nt, nx))
25
23
  a = cut[:nt]
26
24
  b = cut[1:nt + 1]
27
25
  rdpoints = np.zeros_like(u)
@@ -31,30 +29,26 @@ def _lhs_classic(nt: int, nx: int, random_state=None) -> np.ndarray:
31
29
  # Make the random pairings
32
30
  H = np.zeros_like(rdpoints)
33
31
  for j in range(nx):
34
- order = random_state.permutation(range(nt))
32
+ order = rng.permutation(range(nt))
35
33
  H[:, j] = rdpoints[order, j]
36
34
 
37
35
  return H
38
36
 
39
- ################################################################################
40
-
41
- def _lhs_centered(nt: int, nx: int, random_state=None) -> np.ndarray:
37
+ def _lhs_centered(nt: int, nx: int, rng):
42
38
  """
43
39
  Generate a centered Latin Hypercube Sampling (LHS) design.
44
40
 
45
41
  :param nt: Number of samples.
46
42
  :param nx: Number of dimensions.
47
- :param random_state: Random state for reproducibility.
43
+ :param rng: Random state for reproducibility.
48
44
  :return: A 2D array of centered LHS samples.
49
45
  """
50
- if random_state is None:
51
- random_state = np.random.RandomState()
52
-
46
+
53
47
  # Generate the intervals
54
48
  cut = np.linspace(0, 1, nt + 1)
55
49
 
56
50
  # Fill points uniformly in each interval
57
- u = random_state.rand(nt, nx)
51
+ u = rng.random(nt, nx)
58
52
  a = cut[:nt]
59
53
  b = cut[1:nt + 1]
60
54
  _center = (a + b)/2
@@ -62,31 +56,27 @@ def _lhs_centered(nt: int, nx: int, random_state=None) -> np.ndarray:
62
56
  # Make the random pairings
63
57
  H = np.zeros_like(u)
64
58
  for j in range(nx):
65
- H[:, j] = random_state.permutation(_center)
59
+ H[:, j] = rng.permutation(_center)
66
60
 
67
61
  return H
68
62
 
69
- ################################################################################
70
-
71
- def _lhs_maximin(nt: int, nx: int, iterations: int, random_state=None)-> np.ndarray:
63
+ def _lhs_maximin(nt: int, nx: int, iterations: int, rng):
72
64
  """
73
65
  Generate a maximin Latin Hypercube Sampling (LHS) design.
74
66
 
75
67
  :param nt: Number of samples.
76
68
  :param nx: Number of dimensions.
77
69
  :param iterations: Number of iterations to maximize the minimum distance.
78
- :param random_state: Random state for reproducibility.
70
+ :param rng: Random state for reproducibility.
79
71
  :return: A 2D array of maximin LHS samples.
80
72
  """
81
- if random_state is None:
82
- random_state=np.random.RandomState()
83
-
73
+
84
74
  maxdist = 0
85
75
 
86
76
  # Maximize the minimum distance between points
87
77
  for i in range(iterations):
88
78
 
89
- H_candidate = _lhs_classic(nt, nx, random_state)
79
+ H_candidate = _lhs_classic(nt, nx, rng)
90
80
 
91
81
  d = pdist(H_candidate,'euclidean')
92
82
  if maxdist<np.min(d):
@@ -95,25 +85,23 @@ def _lhs_maximin(nt: int, nx: int, iterations: int, random_state=None)-> np.ndar
95
85
 
96
86
  return H
97
87
 
98
- def _lhs_centered_maximin(nt: int, nx: int, iterations: int, random_state=None)-> np.ndarray:
88
+ def _lhs_centered_maximin(nt: int, nx: int, iterations: int, rng):
99
89
  """
100
90
  Generate a centered maximin Latin Hypercube Sampling (LHS) design.
101
91
 
102
92
  :param nt: Number of samples.
103
93
  :param nx: Number of dimensions.
104
94
  :param iterations: Number of iterations to maximize the minimum distance.
105
- :param random_state: Random state for reproducibility.
95
+ :param rng: Random state for reproducibility.
106
96
  :return: A 2D array of centered maximin LHS samples.
107
97
  """
108
- if random_state is None:
109
- random_state=np.random.RandomState()
110
-
98
+
111
99
  maxdist = 0
112
100
 
113
101
  # Maximize the minimum distance between points
114
102
  for i in range(iterations):
115
103
 
116
- H_candidate = _lhs_centered(nt, nx, random_state)
104
+ H_candidate = _lhs_centered(nt, nx, rng)
117
105
  d = pdist(H_candidate,'euclidean')
118
106
  if maxdist<np.min(d):
119
107
  maxdist = np.min(d)
@@ -122,25 +110,23 @@ def _lhs_centered_maximin(nt: int, nx: int, iterations: int, random_state=None)-
122
110
  return H
123
111
  ################################################################################
124
112
 
125
- def _lhs_correlate(nt: int, nx: int, iterations: int, random_state=None) -> np.ndarray:
113
+ def _lhs_correlate(nt: int, nx: int, iterations: int, rng = None):
126
114
  """
127
115
  Generate a correlation-optimized Latin Hypercube Sampling (LHS) design.
128
116
 
129
117
  :param nt: Number of samples.
130
118
  :param nx: Number of dimensions.
131
119
  :param iterations: Number of iterations to minimize correlation.
132
- :param random_state: Random state for reproducibility.
120
+ :param rng: Random state for reproducibility.
133
121
  :return: A 2D array of correlation-optimized LHS samples.
134
122
  """
135
- if random_state is None:
136
- random_state=np.random.RandomState()
137
123
 
138
124
  mincorr = np.inf
139
125
 
140
126
  # Minimize the components correlation coefficients
141
127
  for _ in range(iterations):
142
128
  # Generate a random LHS
143
- H_candidate = _lhs_classic(nt, nx, random_state)
129
+ H_candidate = _lhs_classic(nt, nx, rng)
144
130
  R = np.corrcoef(H_candidate)
145
131
  if np.max(np.abs(R[R!=1]))<mincorr:
146
132
  mincorr = np.max(np.abs(R-np.eye(R.shape[0])))
@@ -149,8 +135,8 @@ def _lhs_correlate(nt: int, nx: int, iterations: int, random_state=None) -> np.n
149
135
 
150
136
  return H
151
137
 
152
- Criterion=Literal['classic','center','maximin','center_maximin','correlation']
153
- LHS_METHOD={'classic': _lhs_classic, 'center': _lhs_centered, 'maximin': _lhs_maximin,
138
+ Criterion = Literal['classic','center','maximin','center_maximin','correlation']
139
+ LHS_METHOD = {'classic': _lhs_classic, 'center': _lhs_centered, 'maximin': _lhs_maximin,
154
140
  'center_maximin': _lhs_centered_maximin, 'correlation': _lhs_correlate}
155
141
 
156
142
  class LHS(Sampler):
@@ -162,16 +148,16 @@ class LHS(Sampler):
162
148
 
163
149
 
164
150
  """
165
- def __init__(self, criterion: Criterion ='classic', iterations: int=5):
151
+ def __init__(self, criterion: Criterion ='classic', iterations = 5):
166
152
  """
167
153
  Initialize the LHS sampler with a specified criterion and number of iterations.
168
154
 
169
155
  :param criterion: The LHS criterion to use.
170
156
  :param iterations: Number of iterations for optimization methods.
171
157
  """
172
- self.criterion=criterion
173
- self.iterations=iterations
174
-
158
+
159
+ self.criterion = criterion
160
+ self.iterations = iterations
175
161
  #initial random state
176
162
  super().__init__()
177
163
 
@@ -190,35 +176,25 @@ class LHS(Sampler):
190
176
  Sampling_method = LHS_METHOD[self.criterion]
191
177
 
192
178
  if self.criterion in ['maximin', 'center_maximin', 'correlation']:
193
- xInit = Sampling_method(nt, nx, self.iterations, self.random_state)
179
+ xInit = Sampling_method(nt, nx, self.iterations, self.rng)
194
180
  else:
195
- xInit = Sampling_method(nt, nx, self.random_state)
181
+ xInit = Sampling_method(nt, nx, self.rng)
196
182
 
197
183
  return xInit
198
184
 
199
- @decoratorRescale
200
- def sample(self, nt: int, nx: int = None, problem: Problem = None, random_seed: Optional[int] = None) -> np.ndarray:
185
+ def sample(self, problem: Problem, nt: int, seed: Optional[int] = None):
201
186
  """
202
187
  Generate a Latin-hypercube design.
203
188
 
204
189
  :param nt: Number of sampled points.
205
190
  :param nx: Input dimensions of sampled points.
206
191
  :param problem: Problem instance to use bounds for sampling.
207
- :param random_seed: Random seed for reproducibility.
192
+ :param seed: Random seed for reproducibility.
208
193
  :return: A 2D array of LHS samples.
209
194
  """
210
195
 
211
- if random_seed is not None:
212
- self.random_state = np.random.RandomState(random_seed)
213
- else:
214
- self.random_state = np.random.RandomState()
215
-
216
- if problem is not None and nx is not None:
217
- if problem.nInput != nx:
218
- raise ValueError('The input dimensions of the problem and the samples must be the same')
219
- elif problem is None and nx is None:
220
- raise ValueError('Either the problem or the input dimensions must be provided')
196
+ self.rng = np.random.default_rng(seed) if seed is not None else np.random.default_rng()
221
197
 
222
- nx = problem.nInput if problem is not None else nx
198
+ nx = problem.nInput
223
199
 
224
- return self._generate(nt, nx)
200
+ return problem._transform_unit_X(self._generate(nt, nx))
@@ -1,10 +1,10 @@
1
1
  import numpy as np
2
2
  from typing import Optional
3
3
 
4
- from .samplerABC import Sampler, decoratorRescale
5
- from ..problems import ProblemABC as Problem
4
+ from .base import Sampler
5
+ from ..problem import ProblemABC as Problem
6
6
 
7
- class Morris_Sequence(Sampler):
7
+ class MorrisSequence(Sampler):
8
8
  """
9
9
  The sample technique for Morris analysis.
10
10
 
@@ -18,6 +18,7 @@ class Morris_Sequence(Sampler):
18
18
  Reference:
19
19
  [1] Max D. Morris (1991) Factorial Sampling Plans for Preliminary Computational Experiments, Technometrics, 33:2, 161-174
20
20
  """
21
+
21
22
  def __init__(self, numLevels: int = 4):
22
23
  """
23
24
  Initialize the Morris Sequence sampler with a specified number of levels.
@@ -25,6 +26,7 @@ class Morris_Sequence(Sampler):
25
26
  :param numLevels: Number of levels for the Morris method.
26
27
  """
27
28
  super().__init__()
29
+
28
30
  self.numLevels = numLevels
29
31
 
30
32
  def _generate(self, nt: int, nx: int):
@@ -38,35 +40,27 @@ class Morris_Sequence(Sampler):
38
40
  xInit = np.zeros((nt * (nx + 1), nx))
39
41
 
40
42
  for i in range(nt):
43
+
41
44
  xInit[i * (nx + 1):(i + 1) * (nx + 1), :] = self._generate_trajectory(nx)
42
45
 
43
46
  return xInit
44
47
 
45
- @decoratorRescale
46
- def sample(self, nt: int, nx: Optional[int] = None, problem: Optional[Problem] = None, random_seed: Optional[int] = None):
48
+ def sample(self, problem: Problem, nt: int, seed: Optional[int] = None):
47
49
  """
48
50
  Generate a sample for the Morris method.
49
51
 
50
- :param nt: Number of trajectories.
51
- :param nx: Input dimensions of sampled points.
52
52
  :param problem: Problem instance to use bounds for sampling.
53
+ :param nt: Number of trajectories.
53
54
  :param random_seed: Random seed for reproducibility.
55
+
54
56
  :return: A 2D array of samples.
55
57
  """
56
- if random_seed is not None:
57
- self.random_state = np.random.RandomState(random_seed)
58
- else:
59
- self.random_state = np.random.RandomState()
60
58
 
61
- if problem is not None and nx is not None:
62
- if problem.nInput != nx:
63
- raise ValueError('The input dimensions of the problem and the samples must be the same')
64
- elif problem is None and nx is None:
65
- raise ValueError('Either the problem or the input dimensions must be provided')
59
+ self.rng = np.random.default_rng(seed) if seed is not None else np.random.default_rng()
66
60
 
67
- nx = problem.nInput if problem is not None else nx
61
+ nx = problem.nInput
68
62
 
69
- return self._generate(nt, nx)
63
+ return problem._transform_unit_X(self._generate(nt, nx))
70
64
 
71
65
  def _generate_trajectory(self, nx: int):
72
66
  """
@@ -80,14 +74,14 @@ class Morris_Sequence(Sampler):
80
74
  B = np.tril(np.ones([nx + 1, nx], dtype=int), -1)
81
75
 
82
76
  # From paper[1] page 164
83
- D_star = np.diag(np.random.choice([-1, 1], nx)) # Step 1
77
+ D_star = np.diag(self.rng.choice([-1, 1], nx)) # Step 1
84
78
  J = np.ones((nx + 1, nx))
85
79
 
86
80
  levels_grids = np.linspace(0, 1 - delta, int(self.numLevels / 2))
87
- x_star = np.random.choice(levels_grids, nx).reshape(1, -1) # Step 2
81
+ x_star = self.rng.choice(levels_grids, nx).reshape(1, -1) # Step 2
88
82
 
89
83
  P_star = np.zeros((nx, nx))
90
- cols = np.random.choice(nx, nx, replace=False)
84
+ cols = self.rng.choice(nx, nx, replace=False)
91
85
  P_star[np.arange(nx), cols] = 1 # Step 3
92
86
 
93
87
  element_a = J[0, :] * x_star
@@ -0,0 +1,45 @@
1
+ import numpy as np
2
+ from typing import Optional
3
+
4
+ from .base import Sampler
5
+ from ..problem import ProblemABC as Problem
6
+
7
+ class Random(Sampler):
8
+ """
9
+ Random Design
10
+
11
+ Methods:
12
+ sample: Generate a random design.
13
+
14
+ Examples:
15
+ >>> random = Random()
16
+ >>> random.sample(10, 10) or random(10, 10)
17
+ """
18
+
19
+ def _generate(self, nt: int, nx: int):
20
+ """
21
+ Generate a random sample.
22
+
23
+ :param nt: Number of sampled points.
24
+ :param nx: Input dimensions of sampled points.
25
+ :return: A 2D array of random samples.
26
+ """
27
+ H = self.rng.random((nt, nx))
28
+
29
+ return H
30
+
31
+ def sample(self, problem: Problem, nt: int, seed: Optional[int] = None):
32
+ """
33
+ Generate a sample with random values between zero and one.
34
+
35
+ :param problem: Problem instance to use bounds for sampling.
36
+ :param nt: Number of sampled points.
37
+ :param random_seed: Random seed for reproducibility.
38
+ :return: A 2D array of random samples.
39
+ """
40
+
41
+ self.rng = np.random.default_rng(seed) if seed is not None else np.random.default_rng()
42
+
43
+ nx = problem.nInput
44
+
45
+ return problem._transform_unit_X(self._generate(nt, nx))