UQPyL 2.1.3__tar.gz → 2.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {UQPyL-2.1.3 → uqpyl-2.1.5}/PKG-INFO +20 -6
- {UQPyL-2.1.3 → uqpyl-2.1.5}/README.md +10 -3
- uqpyl-2.1.5/UQPyL/__init__.py +46 -0
- uqpyl-2.1.5/UQPyL/analysis/__init__.py +16 -0
- uqpyl-2.1.5/UQPyL/analysis/base.py +333 -0
- UQPyL-2.1.3/UQPyL/sensibility/delta_test.py → uqpyl-2.1.5/UQPyL/analysis/delta.py +43 -40
- {UQPyL-2.1.3/UQPyL/sensibility → uqpyl-2.1.5/UQPyL/analysis}/fast.py +51 -49
- UQPyL-2.1.3/UQPyL/sensibility/mars_sa.py → uqpyl-2.1.5/UQPyL/analysis/mars.py +48 -38
- {UQPyL-2.1.3/UQPyL/sensibility → uqpyl-2.1.5/UQPyL/analysis}/morris.py +62 -55
- {UQPyL-2.1.3/UQPyL/sensibility → uqpyl-2.1.5/UQPyL/analysis}/rbd_fast.py +51 -38
- {UQPyL-2.1.3/UQPyL/sensibility → uqpyl-2.1.5/UQPyL/analysis}/rsa.py +62 -48
- {UQPyL-2.1.3/UQPyL/sensibility → uqpyl-2.1.5/UQPyL/analysis}/sobol.py +88 -68
- uqpyl-2.1.5/UQPyL/doe/__init__.py +12 -0
- uqpyl-2.1.5/UQPyL/doe/base.py +22 -0
- UQPyL-2.1.3/UQPyL/DoE/fast_sequence.py → uqpyl-2.1.5/UQPyL/doe/fast.py +13 -19
- {UQPyL-2.1.3/UQPyL/DoE → uqpyl-2.1.5/UQPyL/doe}/full_fact.py +9 -18
- {UQPyL-2.1.3/UQPyL/DoE → uqpyl-2.1.5/UQPyL/doe}/lhs.py +36 -60
- UQPyL-2.1.3/UQPyL/DoE/morris_sequence.py → uqpyl-2.1.5/UQPyL/doe/morris.py +15 -21
- uqpyl-2.1.5/UQPyL/doe/random.py +45 -0
- UQPyL-2.1.3/UQPyL/DoE/saltelli_sequence.py → uqpyl-2.1.5/UQPyL/doe/saltelli.py +17 -23
- UQPyL-2.1.3/UQPyL/DoE/sobol_sequence.py → uqpyl-2.1.5/UQPyL/doe/sobol.py +18 -21
- uqpyl-2.1.5/UQPyL/inference/__init__.py +5 -0
- uqpyl-2.1.5/UQPyL/inference/amh.py +199 -0
- uqpyl-2.1.5/UQPyL/inference/base.py +383 -0
- uqpyl-2.1.5/UQPyL/inference/chain.py +45 -0
- uqpyl-2.1.5/UQPyL/inference/demc.py +178 -0
- uqpyl-2.1.5/UQPyL/inference/dream_zs.py +293 -0
- uqpyl-2.1.5/UQPyL/inference/mh.py +160 -0
- uqpyl-2.1.5/UQPyL/inference/mh_gibbs.py +185 -0
- uqpyl-2.1.5/UQPyL/optimization/__init__.py +7 -0
- UQPyL-2.1.3/UQPyL/optimization/algorithmABC.py → uqpyl-2.1.5/UQPyL/optimization/base.py +69 -43
- {UQPyL-2.1.3 → uqpyl-2.1.5}/UQPyL/optimization/metric/gd.py +2 -2
- {UQPyL-2.1.3 → uqpyl-2.1.5}/UQPyL/optimization/metric/hv.py +6 -15
- {UQPyL-2.1.3 → uqpyl-2.1.5}/UQPyL/optimization/metric/igd.py +1 -3
- {UQPyL-2.1.3/UQPyL/optimization/multi_objective → uqpyl-2.1.5/UQPyL/optimization/moea}/moasmo.py +43 -43
- {UQPyL-2.1.3/UQPyL/optimization/multi_objective → uqpyl-2.1.5/UQPyL/optimization/moea}/moea_d.py +23 -31
- {UQPyL-2.1.3/UQPyL/optimization/multi_objective → uqpyl-2.1.5/UQPyL/optimization/moea}/nsga_ii.py +52 -54
- {UQPyL-2.1.3/UQPyL/optimization/multi_objective → uqpyl-2.1.5/UQPyL/optimization/moea}/nsga_iii.py +50 -54
- {UQPyL-2.1.3/UQPyL/optimization/multi_objective → uqpyl-2.1.5/UQPyL/optimization/moea}/rvea.py +34 -40
- {UQPyL-2.1.3 → uqpyl-2.1.5}/UQPyL/optimization/population.py +55 -50
- uqpyl-2.1.5/UQPyL/optimization/result.py +263 -0
- {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.5/UQPyL/optimization/soea}/abc.py +22 -26
- {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.5/UQPyL/optimization/soea}/asmo.py +36 -39
- {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.5/UQPyL/optimization/soea}/csa.py +42 -54
- {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.5/UQPyL/optimization/soea}/de.py +36 -40
- {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.5/UQPyL/optimization/soea}/ego.py +41 -38
- {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.5/UQPyL/optimization/soea}/ga.py +37 -39
- {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.5/UQPyL/optimization/soea}/ml_sce_ua.py +29 -37
- {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.5/UQPyL/optimization/soea}/pso.py +44 -53
- {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.5/UQPyL/optimization/soea}/sce_ua.py +30 -40
- uqpyl-2.1.5/UQPyL/optimization/util/__init__.py +5 -0
- uqpyl-2.1.5/UQPyL/optimization/util/crowding_distance.py +63 -0
- UQPyL-2.1.3/UQPyL/optimization/utility_functions/operation_GA.py → uqpyl-2.1.5/UQPyL/optimization/util/ga_operator.py +7 -11
- uqpyl-2.1.5/UQPyL/optimization/util/non_dominated_sort.py +43 -0
- uqpyl-2.1.5/UQPyL/optimization/util/tournament.py +57 -0
- {UQPyL-2.1.3/UQPyL/optimization/utility_functions → uqpyl-2.1.5/UQPyL/optimization/util}/uniform_point.py +2 -0
- {UQPyL-2.1.3/UQPyL/problems → uqpyl-2.1.5/UQPyL/problem}/__init__.py +9 -9
- UQPyL-2.1.3/UQPyL/problems/problemABC.py → uqpyl-2.1.5/UQPyL/problem/base.py +12 -6
- {UQPyL-2.1.3/UQPyL/problems/multi_objective → uqpyl-2.1.5/UQPyL/problem/mop}/DTLZ.py +167 -80
- {UQPyL-2.1.3/UQPyL/problems/multi_objective → uqpyl-2.1.5/UQPyL/problem/mop}/ZDT.py +14 -12
- {UQPyL-2.1.3/UQPyL/problems → uqpyl-2.1.5/UQPyL/problem}/problem.py +1 -1
- {UQPyL-2.1.3/UQPyL/problems/single_objective → uqpyl-2.1.5/UQPyL/problem/sop}/single_constraint_problem.py +1 -1
- {UQPyL-2.1.3/UQPyL/problems/single_objective → uqpyl-2.1.5/UQPyL/problem/sop}/single_simple_problem.py +1 -1
- uqpyl-2.1.5/UQPyL/problem/util/non_dominated_sort.py +86 -0
- {UQPyL-2.1.3/UQPyL/problems/utility_functions → uqpyl-2.1.5/UQPyL/problem/util}/uniformPoint.py +2 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/__init__.py +1 -1
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/auto_tuner.py +28 -17
- UQPyL-2.1.3/UQPyL/surrogates/surrogateABC.py → uqpyl-2.1.5/UQPyL/surrogate/base.py +11 -68
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/fnn/fully_connect_neural_network.py +7 -5
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/gp/gaussian_process.py +13 -31
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/gp/kernel/rq_kernel.py +2 -1
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/kriging/kriging.py +17 -16
- uqpyl-2.1.5/UQPyL/surrogate/mars/core/_basis.c +53276 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/mars/core/_forward.c +19339 -20280
- uqpyl-2.1.5/UQPyL/surrogate/mars/core/_knot_search.c +56169 -0
- uqpyl-2.1.5/UQPyL/surrogate/mars/core/_pruning.c +21258 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/mars/core/_qr.c +14515 -15478
- uqpyl-2.1.5/UQPyL/surrogate/mars/core/_record.c +28940 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/mars/core/_types.c +3004 -2538
- uqpyl-2.1.5/UQPyL/surrogate/mars/core/_util.c +15441 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/mars/mars.py +7 -6
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/rbf/radial_basis_function.py +5 -5
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/regression/lasso/lasso_fast.c +22231 -25020
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/regression/linear_regression.py +5 -5
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/regression/polynomial_regression.py +1 -2
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/setting.py +9 -9
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/svr/support_vector_machine.py +6 -5
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/util/adam.py +21 -2
- uqpyl-2.1.5/UQPyL/util/__init__.py +29 -0
- UQPyL-2.1.3/UQPyL/utility/metrics.py → uqpyl-2.1.5/UQPyL/util/metric.py +1 -1
- uqpyl-2.1.5/UQPyL/util/plot.py +772 -0
- UQPyL-2.1.3/UQPyL/utility/polynomial_features.py → uqpyl-2.1.5/UQPyL/util/poly.py +1 -1
- UQPyL-2.1.3/UQPyL/utility/data_selections.py → uqpyl-2.1.5/UQPyL/util/split.py +9 -2
- {UQPyL-2.1.3/UQPyL/utility → uqpyl-2.1.5/UQPyL/util}/verbose.py +212 -99
- {UQPyL-2.1.3 → uqpyl-2.1.5}/UQPyL.egg-info/PKG-INFO +20 -6
- uqpyl-2.1.5/UQPyL.egg-info/SOURCES.txt +181 -0
- uqpyl-2.1.5/UQPyL.egg-info/requires.txt +10 -0
- uqpyl-2.1.5/pyproject.toml +70 -0
- uqpyl-2.1.5/setup.py +52 -0
- uqpyl-2.1.5/tests/test_analysis_base_branches.py +86 -0
- uqpyl-2.1.5/tests/test_analysis_delta.py +30 -0
- uqpyl-2.1.5/tests/test_analysis_delta_more.py +60 -0
- uqpyl-2.1.5/tests/test_analysis_more_methods.py +79 -0
- uqpyl-2.1.5/tests/test_analysis_morris.py +26 -0
- uqpyl-2.1.5/tests/test_analysis_sobol_more.py +49 -0
- uqpyl-2.1.5/tests/test_doe_base.py +16 -0
- uqpyl-2.1.5/tests/test_doe_sampling.py +136 -0
- uqpyl-2.1.5/tests/test_inference_algorithms_more.py +141 -0
- uqpyl-2.1.5/tests/test_inference_base_and_chain.py +105 -0
- uqpyl-2.1.5/tests/test_inference_mh.py +39 -0
- uqpyl-2.1.5/tests/test_inference_more_branches.py +124 -0
- uqpyl-2.1.5/tests/test_optimization_algorithms_smoke.py +31 -0
- uqpyl-2.1.5/tests/test_optimization_base_termination_branches.py +59 -0
- uqpyl-2.1.5/tests/test_optimization_more_algorithms_smoke.py +113 -0
- uqpyl-2.1.5/tests/test_optimization_more_coverage.py +77 -0
- uqpyl-2.1.5/tests/test_optimization_population.py +28 -0
- uqpyl-2.1.5/tests/test_optimization_population_branches.py +57 -0
- uqpyl-2.1.5/tests/test_optimization_population_more.py +19 -0
- uqpyl-2.1.5/tests/test_optimization_result.py +63 -0
- uqpyl-2.1.5/tests/test_optimization_sce_pso_smoke.py +32 -0
- uqpyl-2.1.5/tests/test_optimization_utils_and_metrics.py +110 -0
- uqpyl-2.1.5/tests/test_problem.py +131 -0
- uqpyl-2.1.5/tests/test_problem_base.py +133 -0
- uqpyl-2.1.5/tests/test_problem_mop_pf.py +39 -0
- uqpyl-2.1.5/tests/test_problem_sop_mop_smoke.py +103 -0
- uqpyl-2.1.5/tests/test_problem_utils.py +54 -0
- uqpyl-2.1.5/tests/test_surrogate_adam.py +30 -0
- uqpyl-2.1.5/tests/test_surrogate_autotuner.py +26 -0
- uqpyl-2.1.5/tests/test_surrogate_base_rbf_krg_gpr.py +97 -0
- uqpyl-2.1.5/tests/test_surrogate_boxmin_via_gp.py +23 -0
- uqpyl-2.1.5/tests/test_surrogate_fnn_smoke.py +26 -0
- uqpyl-2.1.5/tests/test_surrogate_kernels.py +86 -0
- uqpyl-2.1.5/tests/test_surrogate_linear_regression_more.py +55 -0
- uqpyl-2.1.5/tests/test_surrogate_polynomial_regression.py +15 -0
- uqpyl-2.1.5/tests/test_surrogate_regression.py +37 -0
- uqpyl-2.1.5/tests/test_surrogate_svr_smoke.py +36 -0
- uqpyl-2.1.5/tests/test_util_metric.py +40 -0
- uqpyl-2.1.5/tests/test_util_split.py +27 -0
- uqpyl-2.1.5/tests/test_util_verbose.py +131 -0
- UQPyL-2.1.3/UQPyL/DoE/__init__.py +0 -10
- UQPyL-2.1.3/UQPyL/DoE/random.py +0 -54
- UQPyL-2.1.3/UQPyL/DoE/samplerABC.py +0 -54
- UQPyL-2.1.3/UQPyL/__init__.py +0 -13
- UQPyL-2.1.3/UQPyL/optimization/__init__.py +0 -5
- UQPyL-2.1.3/UQPyL/optimization/result.py +0 -241
- UQPyL-2.1.3/UQPyL/optimization/utility_functions/__init__.py +0 -4
- UQPyL-2.1.3/UQPyL/optimization/utility_functions/crowding_distance.py +0 -31
- UQPyL-2.1.3/UQPyL/optimization/utility_functions/ndsort.py +0 -50
- UQPyL-2.1.3/UQPyL/optimization/utility_functions/tournament_selection.py +0 -37
- UQPyL-2.1.3/UQPyL/problems/utility_functions/NDsort.py +0 -34
- UQPyL-2.1.3/UQPyL/sensibility/__init__.py +0 -16
- UQPyL-2.1.3/UQPyL/sensibility/saABC.py +0 -242
- UQPyL-2.1.3/UQPyL/surrogates/mars/core/_basis.c +0 -56172
- UQPyL-2.1.3/UQPyL/surrogates/mars/core/_knot_search.c +0 -57281
- UQPyL-2.1.3/UQPyL/surrogates/mars/core/_pruning.c +0 -20743
- UQPyL-2.1.3/UQPyL/surrogates/mars/core/_record.c +0 -29180
- UQPyL-2.1.3/UQPyL/surrogates/mars/core/_util.c +0 -14654
- UQPyL-2.1.3/UQPyL/utility/__init__.py +0 -19
- UQPyL-2.1.3/UQPyL.egg-info/SOURCES.txt +0 -132
- UQPyL-2.1.3/UQPyL.egg-info/requires.txt +0 -4
- UQPyL-2.1.3/pyproject.toml +0 -40
- UQPyL-2.1.3/setup.py +0 -53
- {UQPyL-2.1.3 → uqpyl-2.1.5}/UQPyL/optimization/metric/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/optimization/multi_objective → uqpyl-2.1.5/UQPyL/optimization/moea}/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/optimization/single_objective → uqpyl-2.1.5/UQPyL/optimization/soea}/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/problems/multi_objective → uqpyl-2.1.5/UQPyL/problem/mop}/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/problems/single_objective → uqpyl-2.1.5/UQPyL/problem/sop}/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/problems/utility_functions → uqpyl-2.1.5/UQPyL/problem/util}/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/fnn/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/fnn/_activation_funcs.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/fnn/base.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/gp/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/gp/kernel/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/gp/kernel/base_kernel.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/gp/kernel/c_kernel_.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/gp/kernel/dot_kernel_.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/gp/kernel/matern_kernel.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/gp/kernel/rbf_kernel.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/kriging/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/kriging/kernel/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/kriging/kernel/base_kernel.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/kriging/kernel/cubic_kernel.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/kriging/kernel/exp_kernel.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/kriging/kernel/guass_kernel.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/mars/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/mars/core/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/rbf/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/rbf/kernel/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/rbf/kernel/base_kernel.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/rbf/kernel/cubic_kernel.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/rbf/kernel/gaussian_kernel.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/rbf/kernel/linear_kernel.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/rbf/kernel/multiquadric_kernel.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/rbf/kernel/thin_plate_spline_kernel.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/regression/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/regression/lasso/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/svr/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/svr/core/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/svr/core/libsvm_interface.cpp +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/svr/core/svm.cpp +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/util/__init__.py +0 -0
- {UQPyL-2.1.3/UQPyL/surrogates → uqpyl-2.1.5/UQPyL/surrogate}/util/boxmin.py +0 -0
- /UQPyL-2.1.3/UQPyL/utility/scalers.py → /uqpyl-2.1.5/UQPyL/util/scaler.py +0 -0
- {UQPyL-2.1.3 → uqpyl-2.1.5}/UQPyL.egg-info/dependency_links.txt +0 -0
- {UQPyL-2.1.3 → uqpyl-2.1.5}/UQPyL.egg-info/top_level.txt +0 -0
- {UQPyL-2.1.3 → uqpyl-2.1.5}/setup.cfg +0 -0
|
@@ -1,30 +1,44 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: UQPyL
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.5
|
|
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<2
|
|
17
|
+
Requires-Dist: scipy
|
|
18
|
+
Requires-Dist: prettytable
|
|
19
|
+
Requires-Dist: xarray
|
|
20
|
+
Requires-Dist: netcdf4<1.7; python_version < "3.9"
|
|
21
|
+
Requires-Dist: netcdf4; python_version >= "3.9"
|
|
22
|
+
Dynamic: author
|
|
16
23
|
|
|
17
24
|
# UQPyL: Uncertainty Quantification Python Lab
|
|
18
25
|
|
|
19
26
|
<p align="center"><img src="./docs/UQ.svg" width="400"/></p>
|
|
20
27
|
|
|
21
|
-
[](https://badge.fury.io/py/UQPyL)     
|
|
28
|
+
[](https://badge.fury.io/py/UQPyL) [](https://github.com/smasky/UQPyL/actions/workflows/ci.yml) [](https://codecov.io/gh/smasky/UQPyL)     
|
|
22
29
|
|
|
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.
|
|
30
|
+
**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
31
|
|
|
25
32
|
👉[中文简介](https://github.com/smasky/UQPyL/blob/dev/README_CN.md)
|
|
26
33
|
|
|
27
|
-
👉[
|
|
34
|
+
👉[中文文档](https://swat-uq.readthedocs.io/en/latest/zh/index.html)
|
|
35
|
+
|
|
36
|
+
👉[Documentation](https://uqpyl.readthedocs.io)
|
|
37
|
+
|
|
38
|
+
## Changelog
|
|
39
|
+
|
|
40
|
+
- 2025.12.14: Added the **inference** module. And results are now saved in **NetCDF** format, replacing the previous HDF output.
|
|
41
|
+
|
|
28
42
|
|
|
29
43
|
## Contents
|
|
30
44
|
|
|
@@ -2,13 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
<p align="center"><img src="./docs/UQ.svg" width="400"/></p>
|
|
4
4
|
|
|
5
|
-
[](https://badge.fury.io/py/UQPyL)     
|
|
5
|
+
[](https://badge.fury.io/py/UQPyL) [](https://github.com/smasky/UQPyL/actions/workflows/ci.yml) [](https://codecov.io/gh/smasky/UQPyL)     
|
|
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
|
-
👉[
|
|
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,46 @@
|
|
|
1
|
+
"""
|
|
2
|
+
UQPyL package entry.
|
|
3
|
+
|
|
4
|
+
CI (Linux) is case-sensitive. If the repository historically contains a mixed-case
|
|
5
|
+
DOE folder name (e.g. `DoE`), imports like `import UQPyL.doe` or relative imports
|
|
6
|
+
`from ..doe import ...` will fail. To make the package robust across platforms,
|
|
7
|
+
we create a small alias between `UQPyL.doe` and `UQPyL.DoE` before importing other
|
|
8
|
+
subpackages (some of which depend on DOE at import-time).
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import importlib
|
|
12
|
+
import sys
|
|
13
|
+
|
|
14
|
+
# --- DOE/DoE compatibility shim (must run early) ---
|
|
15
|
+
_doe_mod = None
|
|
16
|
+
try:
|
|
17
|
+
_doe_mod = importlib.import_module(__name__ + ".doe")
|
|
18
|
+
except ModuleNotFoundError:
|
|
19
|
+
try:
|
|
20
|
+
_doe_mod = importlib.import_module(__name__ + ".DoE")
|
|
21
|
+
except ModuleNotFoundError:
|
|
22
|
+
_doe_mod = None
|
|
23
|
+
|
|
24
|
+
if _doe_mod is not None:
|
|
25
|
+
# Alias both names to the same module object.
|
|
26
|
+
sys.modules.setdefault(__name__ + ".doe", _doe_mod)
|
|
27
|
+
sys.modules.setdefault(__name__ + ".DoE", _doe_mod)
|
|
28
|
+
|
|
29
|
+
# Import subpackages after the shim so downstream imports won't crash.
|
|
30
|
+
from . import problem, surrogate, optimization, analysis, util, inference # noqa: E402,F401
|
|
31
|
+
|
|
32
|
+
# Keep `doe` attribute if available
|
|
33
|
+
doe = _doe_mod # noqa: E402
|
|
34
|
+
|
|
35
|
+
__version__ = "2.1.5"
|
|
36
|
+
__author__ = "wmtSky"
|
|
37
|
+
|
|
38
|
+
__all__=[
|
|
39
|
+
"problem",
|
|
40
|
+
"surrogate",
|
|
41
|
+
"optimization",
|
|
42
|
+
"analysis",
|
|
43
|
+
"doe",
|
|
44
|
+
"inference",
|
|
45
|
+
"util"
|
|
46
|
+
]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from .morris import Morris
|
|
2
|
+
from .fast import FAST
|
|
3
|
+
from .rbd_fast import RBDFAST
|
|
4
|
+
from .sobol import Sobol
|
|
5
|
+
from .delta import DeltaTest
|
|
6
|
+
from .mars import MARS
|
|
7
|
+
from .rsa import RSA
|
|
8
|
+
|
|
9
|
+
__all__=["Morris",
|
|
10
|
+
"FAST",
|
|
11
|
+
"RBDFAST",
|
|
12
|
+
"Sobol",
|
|
13
|
+
"DeltaTest",
|
|
14
|
+
"MARS",
|
|
15
|
+
"RSA"
|
|
16
|
+
]
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import abc
|
|
2
|
+
from typing import Tuple, Optional
|
|
3
|
+
import numpy as np
|
|
4
|
+
import xarray as xr
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
|
|
7
|
+
from ..util import Scaler
|
|
8
|
+
from ..problem import ProblemABC as Problem
|
|
9
|
+
|
|
10
|
+
class AnalysisABC(metaclass=abc.ABCMeta):
|
|
11
|
+
|
|
12
|
+
"""
|
|
13
|
+
Abstract base class for analysis methods.
|
|
14
|
+
This class provides some common interfaces for analysis methods.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def __init__(self, scalers: Tuple[Optional[Scaler], Optional[Scaler]],
|
|
18
|
+
verboseFlag: bool = False, logFlag: bool = False, saveFlag: bool = False):
|
|
19
|
+
|
|
20
|
+
"""
|
|
21
|
+
Initialize the analysis base class with optional scalers and flags.
|
|
22
|
+
|
|
23
|
+
:param scalers: Tuple[Optional[Scaler], Optional[Scaler]] - Tuple containing scalers for input (X) and output (Y) data.
|
|
24
|
+
:param verboseFlag: bool - If True, enables verbose mode for logging.
|
|
25
|
+
:param logFlag: bool - If True, enables logging of results.
|
|
26
|
+
:param saveFlag: bool - If True, saves the results to a file.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
# Initialize input scaler
|
|
30
|
+
if scalers[0] is None:
|
|
31
|
+
self.xScale = None
|
|
32
|
+
else:
|
|
33
|
+
if not isinstance(scalers[0], Scaler):
|
|
34
|
+
raise TypeError("scaler must be an instance of Scaler or None!")
|
|
35
|
+
self.xScale = scalers[0]
|
|
36
|
+
|
|
37
|
+
# Initialize output scaler
|
|
38
|
+
if scalers[1] is None:
|
|
39
|
+
self.yScale = None
|
|
40
|
+
else:
|
|
41
|
+
if not isinstance(scalers[1], Scaler):
|
|
42
|
+
raise TypeError("scaler must be an instance of Scaler or None!")
|
|
43
|
+
self.yScale = scalers[1]
|
|
44
|
+
|
|
45
|
+
# Set flags for verbosity, logging, and saving
|
|
46
|
+
self.verboseFlag = verboseFlag
|
|
47
|
+
self.logFlag = logFlag
|
|
48
|
+
self.saveFlag = saveFlag
|
|
49
|
+
|
|
50
|
+
# Initialize settings and results
|
|
51
|
+
self.setting = Setting()
|
|
52
|
+
self.result = Result(self)
|
|
53
|
+
|
|
54
|
+
def setParaValue(self, key, value):
|
|
55
|
+
|
|
56
|
+
"""
|
|
57
|
+
Set a parameter for the sensitivity analysis.
|
|
58
|
+
|
|
59
|
+
:param key: str - The name of the parameter.
|
|
60
|
+
:param value: Any - The value of the parameter.
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
self.setting.setParaValue(key, value)
|
|
64
|
+
|
|
65
|
+
def getParaValue(self, *args):
|
|
66
|
+
|
|
67
|
+
"""
|
|
68
|
+
Retrieve the value of one or more parameters.
|
|
69
|
+
|
|
70
|
+
:param args: str - The names of the parameters to retrieve.
|
|
71
|
+
:return: The value(s) of the specified parameter(s).
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
return self.setting.getParaValue(*args)
|
|
75
|
+
|
|
76
|
+
def setProblem(self, problem: Problem):
|
|
77
|
+
|
|
78
|
+
"""
|
|
79
|
+
Set the problem instance for the analysis.
|
|
80
|
+
|
|
81
|
+
:param problem: Problem - The problem instance defining the input and output space.
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
self.problem = problem
|
|
85
|
+
|
|
86
|
+
def check_Y(self, X, Y, target = 'objFunc', index = 'all'):
|
|
87
|
+
# Evaluate the problem if Y is not provided
|
|
88
|
+
if Y is None:
|
|
89
|
+
if target == 'objFunc':
|
|
90
|
+
Y = self.problem.objFunc(X)
|
|
91
|
+
elif target == 'conFunc':
|
|
92
|
+
Y = self.problem.conFunc(X)
|
|
93
|
+
else:
|
|
94
|
+
raise ValueError("Target must be 'objFunc' or 'conFunc'!")
|
|
95
|
+
|
|
96
|
+
if index != 'all':
|
|
97
|
+
if not isinstance(index, list):
|
|
98
|
+
raise ValueError("Index must be a list of integers!")
|
|
99
|
+
else:
|
|
100
|
+
try:
|
|
101
|
+
Y = Y[:, index]
|
|
102
|
+
except:
|
|
103
|
+
raise ValueError("Please check the index you set!")
|
|
104
|
+
|
|
105
|
+
return Y
|
|
106
|
+
|
|
107
|
+
def recordResult(self, X, Y, res):
|
|
108
|
+
|
|
109
|
+
self.result.res['history'] = (X, Y)
|
|
110
|
+
self.result.res['results'] = res
|
|
111
|
+
|
|
112
|
+
self.result.res['verbose'] = {}
|
|
113
|
+
|
|
114
|
+
for (name, val, row, col, _) in res:
|
|
115
|
+
|
|
116
|
+
for i, t in enumerate(row):
|
|
117
|
+
self.record(t, name, col, val[i])
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def record(self, target, indicator, labels, values):
|
|
121
|
+
|
|
122
|
+
"""
|
|
123
|
+
Record the analysis results.
|
|
124
|
+
|
|
125
|
+
:param target: str - The target of the objective function or constraint function.
|
|
126
|
+
:param indicator: str - The indicator of the analysis.
|
|
127
|
+
:param labels: list - The labels for the input variables.
|
|
128
|
+
:param value: list - The sensitivity indices.
|
|
129
|
+
"""
|
|
130
|
+
|
|
131
|
+
self.result.res['verbose'].setdefault(target, {})
|
|
132
|
+
self.result.res['verbose'][target].setdefault(indicator, {})
|
|
133
|
+
|
|
134
|
+
for label, v in zip(labels, values):
|
|
135
|
+
|
|
136
|
+
self.result.res['verbose'][target][indicator][label] = v
|
|
137
|
+
|
|
138
|
+
self.result.res['verbose'][target][indicator]['array'] = np.array(values)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def __reverse_X_Y__(self, X, Y):
|
|
142
|
+
|
|
143
|
+
if self.xScale:
|
|
144
|
+
X = self.xScale.inverse_transform(X)
|
|
145
|
+
|
|
146
|
+
if self.yScale:
|
|
147
|
+
Y = self.yScale.inverse_transform(Y)
|
|
148
|
+
|
|
149
|
+
return X, Y
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def __check_and_scale_xy__(self, X, Y):
|
|
153
|
+
|
|
154
|
+
"""
|
|
155
|
+
Check and scale the input and output data if scalers are provided.
|
|
156
|
+
|
|
157
|
+
:param X: np.ndarray - The input data.
|
|
158
|
+
:param Y: np.ndarray - The output data.
|
|
159
|
+
:return: Tuple[np.ndarray, np.ndarray] - The scaled input and output data.
|
|
160
|
+
"""
|
|
161
|
+
|
|
162
|
+
if not isinstance(X, np.ndarray) and X is not None:
|
|
163
|
+
raise TypeError("X must be an instance of np.ndarray or None!")
|
|
164
|
+
|
|
165
|
+
if self.xScale:
|
|
166
|
+
X = self.xScale.fit_transform(X)
|
|
167
|
+
|
|
168
|
+
if not isinstance(Y, np.ndarray) and Y is not None:
|
|
169
|
+
raise TypeError("Y must be an instance of np.ndarray or None!")
|
|
170
|
+
|
|
171
|
+
if Y.ndim == 1:
|
|
172
|
+
Y = Y.reshape(-1, 1)
|
|
173
|
+
|
|
174
|
+
if self.yScale:
|
|
175
|
+
Y = self.yScale.fit_transform(Y)
|
|
176
|
+
|
|
177
|
+
return X, Y
|
|
178
|
+
|
|
179
|
+
def evaluate(self, X, target = 'objFunc'):
|
|
180
|
+
|
|
181
|
+
"""
|
|
182
|
+
Evaluate the problem with the given input data.
|
|
183
|
+
|
|
184
|
+
:param X: np.ndarray - The input data.
|
|
185
|
+
:param target: str - The target to evaluate.
|
|
186
|
+
:return: np.ndarray - The output data.
|
|
187
|
+
"""
|
|
188
|
+
|
|
189
|
+
if target == 'objFunc':
|
|
190
|
+
Y = self.problem.objFunc(X)
|
|
191
|
+
elif target == 'conFunc':
|
|
192
|
+
Y = self.problem.conFunc(X)
|
|
193
|
+
else:
|
|
194
|
+
raise ValueError("Target must be 'objFunc' or 'conFunc'!")
|
|
195
|
+
|
|
196
|
+
return Y
|
|
197
|
+
|
|
198
|
+
@abc.abstractmethod
|
|
199
|
+
def analyze(self, X = None, Y = None):
|
|
200
|
+
|
|
201
|
+
"""
|
|
202
|
+
Abstract method for performing analysis.
|
|
203
|
+
Must be implemented by subclasses.
|
|
204
|
+
"""
|
|
205
|
+
|
|
206
|
+
pass
|
|
207
|
+
|
|
208
|
+
class Result():
|
|
209
|
+
|
|
210
|
+
"""
|
|
211
|
+
Class to store and manage the results of analysis.
|
|
212
|
+
"""
|
|
213
|
+
|
|
214
|
+
def __init__(self, obj):
|
|
215
|
+
"""
|
|
216
|
+
Initialize the Result class.
|
|
217
|
+
|
|
218
|
+
:param obj: The analysis object.
|
|
219
|
+
"""
|
|
220
|
+
|
|
221
|
+
self.res = { }
|
|
222
|
+
|
|
223
|
+
self.obj = obj
|
|
224
|
+
|
|
225
|
+
def generateNetCDF(self):
|
|
226
|
+
|
|
227
|
+
X = self.res['history'][0]; Y = self.res['history'][1]
|
|
228
|
+
res = self.res['results']
|
|
229
|
+
|
|
230
|
+
decsDim1 = X.shape[1]
|
|
231
|
+
n = X.shape[0]
|
|
232
|
+
nI = X.shape[1]
|
|
233
|
+
nO = Y.shape[1]
|
|
234
|
+
decsDim2 = int(X.shape[1] * (X.shape[1] - 1) / 2)
|
|
235
|
+
|
|
236
|
+
ds = xr.Dataset(
|
|
237
|
+
|
|
238
|
+
data_vars = {
|
|
239
|
+
"X" : (("idx", "nI"), X, {"description": "decision variables"}),
|
|
240
|
+
"Y" : (("idx", "nO"), Y, {"description": "objectives or constraints"}),
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
coords = {
|
|
244
|
+
'decsDim1': ("decsDim1", np.arange(decsDim1), {"description": "First-order or total-order indices of decision variables"}),
|
|
245
|
+
'decsDim2': ("decsDim2", np.arange(decsDim2), {"description": "Second-order sensitivity indices of decision variables"}),
|
|
246
|
+
'nI': ("nI", np.arange(nI), {"description": "decision variables dimensions"}),
|
|
247
|
+
'nO': ("nO", np.arange(nO), {"description": "Number of outputs"}),
|
|
248
|
+
'idx' : ("idx", np.arange(n), {"description": "Number of samples"}),
|
|
249
|
+
},
|
|
250
|
+
attrs = {
|
|
251
|
+
"problem" : f"{self.obj.problem.name}_{self.obj.problem.nInput}D_{self.obj.problem.nOutput}O_{self.obj.problem.nCons}C",
|
|
252
|
+
"method" : self.obj.name,
|
|
253
|
+
"created": datetime.now().isoformat(timespec='seconds'),
|
|
254
|
+
**{
|
|
255
|
+
k: (str(v) if isinstance(v, bool) else v)
|
|
256
|
+
for k, v in self.obj.setting.dict.items()
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
for (name, val, row, col, col_dim) in res:
|
|
263
|
+
|
|
264
|
+
ds[name] = xr.DataArray(
|
|
265
|
+
val,
|
|
266
|
+
dims=["nO", col_dim]
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
if "target" not in ds.coords:
|
|
270
|
+
ds = ds.assign_coords({"target": ("nO", row, {"description": "target labels"})})
|
|
271
|
+
|
|
272
|
+
if "firstIdx" not in ds.coords and col_dim == "decsDim1":
|
|
273
|
+
ds = ds.assign_coords({"firstIdx": ("decsDim1", col, {"description": "first order indices of decision variables"})})
|
|
274
|
+
ds = ds.assign_coords({"totalIdx": ("decsDim1", col, {"description": "total order indices of decision variables"})})
|
|
275
|
+
|
|
276
|
+
if "secondIdx" not in ds.coords and col_dim == "decsDim2":
|
|
277
|
+
ds = ds.assign_coords({"secondIdx": ("decsDim2", col, {"description": "second order indices of decision variables"})})
|
|
278
|
+
|
|
279
|
+
return ds
|
|
280
|
+
|
|
281
|
+
class Setting():
|
|
282
|
+
"""
|
|
283
|
+
Class to manage the parameter settings of the algorithm.
|
|
284
|
+
"""
|
|
285
|
+
|
|
286
|
+
def __init__(self):
|
|
287
|
+
"""
|
|
288
|
+
Initialize the Setting class.
|
|
289
|
+
"""
|
|
290
|
+
self.dict = {}
|
|
291
|
+
|
|
292
|
+
def keys(self):
|
|
293
|
+
"""
|
|
294
|
+
Get the keys of the parameter settings.
|
|
295
|
+
|
|
296
|
+
:return: list - The keys of the parameter settings.
|
|
297
|
+
"""
|
|
298
|
+
return self.dict.keys()
|
|
299
|
+
|
|
300
|
+
def values(self):
|
|
301
|
+
"""
|
|
302
|
+
Get the values of the parameter settings.
|
|
303
|
+
|
|
304
|
+
:return: list - The values of the parameter settings.
|
|
305
|
+
"""
|
|
306
|
+
return self.dict.values()
|
|
307
|
+
|
|
308
|
+
def setParaValue(self, key, value):
|
|
309
|
+
|
|
310
|
+
"""
|
|
311
|
+
Set a parameter value.
|
|
312
|
+
|
|
313
|
+
:param key: str - The name of the parameter.
|
|
314
|
+
:param value: Any - The value of the parameter.
|
|
315
|
+
"""
|
|
316
|
+
|
|
317
|
+
self.dict[key] = value
|
|
318
|
+
|
|
319
|
+
def getParaValue(self, *args):
|
|
320
|
+
"""
|
|
321
|
+
Get the value of one or more parameters.
|
|
322
|
+
|
|
323
|
+
:param args: str - The names of the parameters to retrieve.
|
|
324
|
+
:return: The value(s) of the specified parameter(s).
|
|
325
|
+
"""
|
|
326
|
+
values = []
|
|
327
|
+
for arg in args:
|
|
328
|
+
values.append(self.dict[arg])
|
|
329
|
+
|
|
330
|
+
if len(args) > 1:
|
|
331
|
+
return tuple(values)
|
|
332
|
+
else:
|
|
333
|
+
return values[0]
|
|
@@ -3,13 +3,13 @@ import numpy as np
|
|
|
3
3
|
from scipy.spatial import KDTree
|
|
4
4
|
from typing import Optional, Tuple
|
|
5
5
|
|
|
6
|
-
from .
|
|
7
|
-
from ..
|
|
8
|
-
from ..
|
|
9
|
-
from ..
|
|
10
|
-
from ..optimization import GA
|
|
6
|
+
from .base import AnalysisABC
|
|
7
|
+
from ..doe import LHS, Sampler
|
|
8
|
+
from ..problem import ProblemABC, Problem
|
|
9
|
+
from ..util import Scaler, Verbose
|
|
10
|
+
from ..optimization.soea import GA
|
|
11
11
|
|
|
12
|
-
class
|
|
12
|
+
class DeltaTest(AnalysisABC):
|
|
13
13
|
"""
|
|
14
14
|
-------------------------------------------------
|
|
15
15
|
Delta Test
|
|
@@ -37,8 +37,10 @@ class Delta_Test(SA):
|
|
|
37
37
|
[2] SALib, https://github.com/SALib/SALib
|
|
38
38
|
-------------------------------------------------
|
|
39
39
|
"""
|
|
40
|
+
|
|
41
|
+
name = "DeltaTest"
|
|
42
|
+
|
|
40
43
|
def __init__(self, scalers: Tuple[Optional[Scaler], Optional[Scaler]] = (None, None),
|
|
41
|
-
nNeighbors: int = 2,
|
|
42
44
|
verboseFlag: bool = True, logFlag: bool = False, saveFlag: bool = False):
|
|
43
45
|
"""
|
|
44
46
|
Initialize the Delta Test method.
|
|
@@ -50,18 +52,11 @@ class Delta_Test(SA):
|
|
|
50
52
|
:param saveFlag: bool - If True, saves the results to a file. Defaults to False.
|
|
51
53
|
"""
|
|
52
54
|
|
|
53
|
-
# Attributes indicating the types of sensitivity indices calculated
|
|
54
|
-
self.firstOrder = True
|
|
55
|
-
self.secondOrder = False
|
|
56
|
-
self.totalOrder = False
|
|
57
|
-
|
|
58
55
|
# Initialize the base class with provided scalers and flags
|
|
59
56
|
super().__init__(scalers, verboseFlag, logFlag, saveFlag)
|
|
60
57
|
|
|
61
|
-
# Set the number of nearest neighbors for analysis
|
|
62
|
-
self.setParameters('nNeighbors', nNeighbors)
|
|
63
58
|
|
|
64
|
-
def sample(self, problem: Problem, N: int = 500, sampler: Sampler = LHS('classic')):
|
|
59
|
+
def sample(self, problem: Problem, N: int = 500, sampler: Sampler = LHS('classic'), seed: Optional[int] = None):
|
|
65
60
|
"""
|
|
66
61
|
Generate a sample set for the Delta Test.
|
|
67
62
|
--------------------------------------------------
|
|
@@ -72,16 +67,19 @@ class Delta_Test(SA):
|
|
|
72
67
|
:return: np.ndarray - A 2D array of shape `(N, nInput)`, where `nInput` is the number of input variables.
|
|
73
68
|
"""
|
|
74
69
|
|
|
70
|
+
self.rng = np.random.default_rng(seed) if seed is not None else np.random.default_rng()
|
|
71
|
+
|
|
75
72
|
nInput = problem.nInput
|
|
76
73
|
|
|
77
74
|
# Generate samples using the specified sampler
|
|
78
|
-
|
|
75
|
+
sampler_seed = self.rng.integers(1, 1000000)
|
|
76
|
+
X = sampler.sample(problem, N, seed = sampler_seed)
|
|
79
77
|
|
|
80
78
|
# Transform the samples to the problem's input space
|
|
81
79
|
return problem._transform_unit_X(X)
|
|
82
80
|
|
|
83
|
-
@Verbose.
|
|
84
|
-
def analyze(self, problem, X: np.ndarray, Y: np.ndarray = None):
|
|
81
|
+
@Verbose.analyze
|
|
82
|
+
def analyze(self, problem, X: np.ndarray, Y: np.ndarray = None, target = 'objFunc', index = 'all', nNeighbors: int = 2):
|
|
85
83
|
"""
|
|
86
84
|
Perform the Delta Test analysis on the input data.
|
|
87
85
|
--------------------------------------------------
|
|
@@ -89,7 +87,10 @@ class Delta_Test(SA):
|
|
|
89
87
|
:param X: np.ndarray - A 2D array of shape `(N, n_input)`, representing the input data for analysis.
|
|
90
88
|
:param Y: np.ndarray - A 1D array of length `N` representing the output values corresponding to `X`.
|
|
91
89
|
If None, it will be computed by evaluating the problem with `X`.
|
|
92
|
-
|
|
90
|
+
:param target: str - The target of the analysis, set 'objFunc' or 'conFunc'. Defaults to 'objFunc'.
|
|
91
|
+
:param index: list - The index of the output variables to analyze. Defaults to 'all'.
|
|
92
|
+
:param nNeighbors: int - The number of nearest neighbors used in Delta Test estimation. Defaults to 2.
|
|
93
|
+
|
|
93
94
|
:return: Result - An object containing the sensitivity indices 'S1', 'S2', and 'ST',
|
|
94
95
|
representing first-order, second-order, and total-order indices.
|
|
95
96
|
You can use result.Si to get the sensitivity indices.
|
|
@@ -99,36 +100,38 @@ class Delta_Test(SA):
|
|
|
99
100
|
self.setProblem(problem)
|
|
100
101
|
|
|
101
102
|
# Retrieve the number of nearest neighbors for analysis
|
|
102
|
-
|
|
103
|
+
self.setParaValue('nNeighbors', nNeighbors)
|
|
103
104
|
|
|
104
105
|
# Evaluate the problem if Y is not provided
|
|
105
|
-
|
|
106
|
-
Y = self.evaluate(X)
|
|
106
|
+
Y = self.check_Y(X, Y, target, index)
|
|
107
107
|
|
|
108
108
|
# Scale the input and output data if scalers are provided
|
|
109
109
|
X, Y = self.__check_and_scale_xy__(X, Y)
|
|
110
110
|
nInput = problem.nInput
|
|
111
|
+
numY = Y.shape[1]
|
|
112
|
+
|
|
113
|
+
outputLabel = "obj" if target == "objFunc" else "con"
|
|
114
|
+
|
|
115
|
+
S1 = np.zeros((numY, nInput))
|
|
116
|
+
S1_scaled = np.zeros((numY, nInput))
|
|
117
|
+
row_label = [f"{outputLabel}{i+1}" for i in range(numY)]
|
|
118
|
+
col_label_1 = problem.xLabels
|
|
119
|
+
|
|
120
|
+
for i in range(numY):
|
|
121
|
+
Y_i = Y[:, i:i+1]
|
|
122
|
+
base = self._cal_delta(X, Y_i, nNeighbors)
|
|
123
|
+
for j in range(nInput):
|
|
124
|
+
XSub = np.delete(X, [j], axis=1)
|
|
125
|
+
S1[i, j] = self._cal_delta(XSub, Y_i, nNeighbors)
|
|
126
|
+
S1_scaled[i] = S1[i] / np.sum(S1[i])
|
|
127
|
+
|
|
128
|
+
res = [('S1', S1, row_label, col_label_1, 'decsDim1'), ('S1_scale', S1_scaled, row_label, col_label_1, 'decsDim1')]
|
|
111
129
|
|
|
112
|
-
|
|
113
|
-
S1 = np.zeros(nInput)
|
|
114
|
-
|
|
115
|
-
# Calculate the base Delta value
|
|
116
|
-
base = self._cal_delta(X, Y, nNeighbors)
|
|
117
|
-
|
|
118
|
-
# Calculate first-order sensitivity indices for each input variable
|
|
119
|
-
for i in range(nInput):
|
|
120
|
-
XSub = np.delete(X, [i], axis=1)
|
|
121
|
-
S1[i] = self._cal_delta(XSub, Y, nNeighbors)
|
|
122
|
-
|
|
123
|
-
# Adjust the sensitivity indices
|
|
124
|
-
S1 = S1 - base
|
|
125
|
-
S1 = S1 - np.min(S1)
|
|
130
|
+
X, Y = self.__reverse_X_Y__(X, Y)
|
|
126
131
|
|
|
127
|
-
|
|
128
|
-
self.record('S1', problem.xLabels, S1)
|
|
129
|
-
self.record('S1(scaled)', problem.xLabels, S1 / np.sum(S1))
|
|
132
|
+
self.recordResult(X, Y, res)
|
|
130
133
|
|
|
131
|
-
return self.result
|
|
134
|
+
return self.result.generateNetCDF()
|
|
132
135
|
|
|
133
136
|
def findCombEA(self, problem, X: np.ndarray, Y: np.ndarray = None,
|
|
134
137
|
FEs: int = 10000,
|