CUQIpy 1.3.0.post0.dev401__tar.gz → 1.4.0.post0.dev41__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.
Potentially problematic release.
This version of CUQIpy might be problematic. Click here for more details.
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/CUQIpy.egg-info/PKG-INFO +1 -1
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/CUQIpy.egg-info/SOURCES.txt +15 -14
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/PKG-INFO +1 -1
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/__init__.py +1 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/_version.py +3 -3
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/density/_density.py +9 -1
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_joint_distribution.py +96 -11
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/experimental/__init__.py +1 -2
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/experimental/_recommender.py +4 -4
- cuqipy-1.4.0.post0.dev41/cuqi/legacy/__init__.py +2 -0
- {cuqipy-1.3.0.post0.dev401/cuqi → cuqipy-1.4.0.post0.dev41/cuqi/legacy}/sampler/_cwmh.py +2 -2
- {cuqipy-1.3.0.post0.dev401/cuqi → cuqipy-1.4.0.post0.dev41/cuqi/legacy}/sampler/_gibbs.py +9 -5
- {cuqipy-1.3.0.post0.dev401/cuqi → cuqipy-1.4.0.post0.dev41/cuqi/legacy}/sampler/_hmc.py +2 -2
- {cuqipy-1.3.0.post0.dev401/cuqi → cuqipy-1.4.0.post0.dev41/cuqi/legacy}/sampler/_langevin_algorithm.py +3 -3
- {cuqipy-1.3.0.post0.dev401/cuqi → cuqipy-1.4.0.post0.dev41/cuqi/legacy}/sampler/_laplace_approximation.py +1 -1
- {cuqipy-1.3.0.post0.dev401/cuqi → cuqipy-1.4.0.post0.dev41/cuqi/legacy}/sampler/_mh.py +2 -2
- {cuqipy-1.3.0.post0.dev401/cuqi → cuqipy-1.4.0.post0.dev41/cuqi/legacy}/sampler/_pcn.py +3 -3
- {cuqipy-1.3.0.post0.dev401/cuqi → cuqipy-1.4.0.post0.dev41/cuqi/legacy}/sampler/_rto.py +2 -2
- {cuqipy-1.3.0.post0.dev401/cuqi → cuqipy-1.4.0.post0.dev41/cuqi/legacy}/sampler/_sampler.py +5 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/problem/_problem.py +87 -80
- {cuqipy-1.3.0.post0.dev401/cuqi/experimental/mcmc → cuqipy-1.4.0.post0.dev41/cuqi/sampler}/__init__.py +14 -13
- {cuqipy-1.3.0.post0.dev401/cuqi/experimental/mcmc → cuqipy-1.4.0.post0.dev41/cuqi/sampler}/_conjugate.py +1 -1
- {cuqipy-1.3.0.post0.dev401/cuqi/experimental/mcmc → cuqipy-1.4.0.post0.dev41/cuqi/sampler}/_conjugate_approx.py +2 -2
- {cuqipy-1.3.0.post0.dev401/cuqi/experimental/mcmc → cuqipy-1.4.0.post0.dev41/cuqi/sampler}/_cwmh.py +2 -2
- {cuqipy-1.3.0.post0.dev401/cuqi/experimental/mcmc → cuqipy-1.4.0.post0.dev41/cuqi/sampler}/_direct.py +1 -1
- {cuqipy-1.3.0.post0.dev401/cuqi/experimental/mcmc → cuqipy-1.4.0.post0.dev41/cuqi/sampler}/_gibbs.py +5 -5
- {cuqipy-1.3.0.post0.dev401/cuqi/experimental/mcmc → cuqipy-1.4.0.post0.dev41/cuqi/sampler}/_hmc.py +2 -2
- {cuqipy-1.3.0.post0.dev401/cuqi/experimental/mcmc → cuqipy-1.4.0.post0.dev41/cuqi/sampler}/_langevin_algorithm.py +3 -3
- {cuqipy-1.3.0.post0.dev401/cuqi/experimental/mcmc → cuqipy-1.4.0.post0.dev41/cuqi/sampler}/_laplace_approximation.py +1 -1
- {cuqipy-1.3.0.post0.dev401/cuqi/experimental/mcmc → cuqipy-1.4.0.post0.dev41/cuqi/sampler}/_mh.py +1 -1
- {cuqipy-1.3.0.post0.dev401/cuqi/experimental/mcmc → cuqipy-1.4.0.post0.dev41/cuqi/sampler}/_pcn.py +1 -1
- {cuqipy-1.3.0.post0.dev401/cuqi/experimental/mcmc → cuqipy-1.4.0.post0.dev41/cuqi/sampler}/_rto.py +1 -1
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/tests/test_bayesian_inversion.py +8 -8
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/tests/test_implicit_priors.py +6 -6
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/tests/test_joint_distribution.py +173 -1
- cuqipy-1.3.0.post0.dev401/tests/test_sampler.py → cuqipy-1.4.0.post0.dev41/tests/test_legacy_sampler.py +27 -27
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/tests/test_problem.py +0 -1
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/tests/test_samples.py +6 -6
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/CUQIpy.egg-info/dependency_links.txt +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/CUQIpy.egg-info/requires.txt +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/CUQIpy.egg-info/top_level.txt +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/LICENSE +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/README.md +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/_messages.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/array/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/array/_array.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/config.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/data/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/data/_data.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/data/astronaut.npz +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/data/camera.npz +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/data/cat.npz +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/data/cookie.png +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/data/satellite.mat +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/density/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/diagnostics.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_beta.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_cauchy.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_cmrf.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_custom.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_distribution.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_gamma.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_gaussian.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_gmrf.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_inverse_gamma.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_laplace.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_lmrf.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_lognormal.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_modifiedhalfnormal.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_normal.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_posterior.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_smoothed_laplace.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_truncated_normal.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_uniform.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/experimental/algebra/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/experimental/algebra/_ast.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/experimental/algebra/_orderedset.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/experimental/algebra/_randomvariable.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/experimental/geometry/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/experimental/geometry/_productgeometry.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/geometry/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/geometry/_geometry.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/implicitprior/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/implicitprior/_regularizedGMRF.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/implicitprior/_regularizedGaussian.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/implicitprior/_regularizedUnboundedUniform.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/implicitprior/_restorator.py +0 -0
- {cuqipy-1.3.0.post0.dev401/cuqi → cuqipy-1.4.0.post0.dev41/cuqi/legacy}/sampler/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev401/cuqi → cuqipy-1.4.0.post0.dev41/cuqi/legacy}/sampler/_conjugate.py +0 -0
- {cuqipy-1.3.0.post0.dev401/cuqi → cuqipy-1.4.0.post0.dev41/cuqi/legacy}/sampler/_conjugate_approx.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/likelihood/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/likelihood/_likelihood.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/model/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/model/_model.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/operator/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/operator/_operator.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/pde/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/pde/_pde.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/problem/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev401/cuqi/experimental/mcmc → cuqipy-1.4.0.post0.dev41/cuqi/sampler}/_sampler.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/samples/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/samples/_samples.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/solver/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/solver/_solver.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/testproblem/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/testproblem/_testproblem.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/utilities/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/utilities/_get_python_variable_name.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/utilities/_utilities.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/pyproject.toml +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/requirements.txt +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/setup.cfg +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/setup.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/tests/test_MRFs.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/tests/test_abstract_distribution_density.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/tests/test_density.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/tests/test_distribution.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/tests/test_distributions_shape.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/tests/test_geometry.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/tests/test_likelihood.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/tests/test_model.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/tests/test_pde.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/tests/test_posterior.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/tests/test_solver.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/tests/test_testproblem.py +0 -0
- {cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/tests/test_utilities.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: CUQIpy
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0.post0.dev41
|
|
4
4
|
Summary: Computational Uncertainty Quantification for Inverse problems in Python
|
|
5
5
|
Maintainer-email: "Nicolai A. B. Riis" <nabr@dtu.dk>, "Jakob S. Jørgensen" <jakj@dtu.dk>, "Amal M. Alghamdi" <amaal@dtu.dk>, Chao Zhang <chaz@dtu.dk>
|
|
6
6
|
License: Apache License
|
|
@@ -52,19 +52,6 @@ cuqi/experimental/algebra/_orderedset.py
|
|
|
52
52
|
cuqi/experimental/algebra/_randomvariable.py
|
|
53
53
|
cuqi/experimental/geometry/__init__.py
|
|
54
54
|
cuqi/experimental/geometry/_productgeometry.py
|
|
55
|
-
cuqi/experimental/mcmc/__init__.py
|
|
56
|
-
cuqi/experimental/mcmc/_conjugate.py
|
|
57
|
-
cuqi/experimental/mcmc/_conjugate_approx.py
|
|
58
|
-
cuqi/experimental/mcmc/_cwmh.py
|
|
59
|
-
cuqi/experimental/mcmc/_direct.py
|
|
60
|
-
cuqi/experimental/mcmc/_gibbs.py
|
|
61
|
-
cuqi/experimental/mcmc/_hmc.py
|
|
62
|
-
cuqi/experimental/mcmc/_langevin_algorithm.py
|
|
63
|
-
cuqi/experimental/mcmc/_laplace_approximation.py
|
|
64
|
-
cuqi/experimental/mcmc/_mh.py
|
|
65
|
-
cuqi/experimental/mcmc/_pcn.py
|
|
66
|
-
cuqi/experimental/mcmc/_rto.py
|
|
67
|
-
cuqi/experimental/mcmc/_sampler.py
|
|
68
55
|
cuqi/geometry/__init__.py
|
|
69
56
|
cuqi/geometry/_geometry.py
|
|
70
57
|
cuqi/implicitprior/__init__.py
|
|
@@ -72,6 +59,19 @@ cuqi/implicitprior/_regularizedGMRF.py
|
|
|
72
59
|
cuqi/implicitprior/_regularizedGaussian.py
|
|
73
60
|
cuqi/implicitprior/_regularizedUnboundedUniform.py
|
|
74
61
|
cuqi/implicitprior/_restorator.py
|
|
62
|
+
cuqi/legacy/__init__.py
|
|
63
|
+
cuqi/legacy/sampler/__init__.py
|
|
64
|
+
cuqi/legacy/sampler/_conjugate.py
|
|
65
|
+
cuqi/legacy/sampler/_conjugate_approx.py
|
|
66
|
+
cuqi/legacy/sampler/_cwmh.py
|
|
67
|
+
cuqi/legacy/sampler/_gibbs.py
|
|
68
|
+
cuqi/legacy/sampler/_hmc.py
|
|
69
|
+
cuqi/legacy/sampler/_langevin_algorithm.py
|
|
70
|
+
cuqi/legacy/sampler/_laplace_approximation.py
|
|
71
|
+
cuqi/legacy/sampler/_mh.py
|
|
72
|
+
cuqi/legacy/sampler/_pcn.py
|
|
73
|
+
cuqi/legacy/sampler/_rto.py
|
|
74
|
+
cuqi/legacy/sampler/_sampler.py
|
|
75
75
|
cuqi/likelihood/__init__.py
|
|
76
76
|
cuqi/likelihood/_likelihood.py
|
|
77
77
|
cuqi/model/__init__.py
|
|
@@ -86,6 +86,7 @@ cuqi/sampler/__init__.py
|
|
|
86
86
|
cuqi/sampler/_conjugate.py
|
|
87
87
|
cuqi/sampler/_conjugate_approx.py
|
|
88
88
|
cuqi/sampler/_cwmh.py
|
|
89
|
+
cuqi/sampler/_direct.py
|
|
89
90
|
cuqi/sampler/_gibbs.py
|
|
90
91
|
cuqi/sampler/_hmc.py
|
|
91
92
|
cuqi/sampler/_langevin_algorithm.py
|
|
@@ -112,12 +113,12 @@ tests/test_distributions_shape.py
|
|
|
112
113
|
tests/test_geometry.py
|
|
113
114
|
tests/test_implicit_priors.py
|
|
114
115
|
tests/test_joint_distribution.py
|
|
116
|
+
tests/test_legacy_sampler.py
|
|
115
117
|
tests/test_likelihood.py
|
|
116
118
|
tests/test_model.py
|
|
117
119
|
tests/test_pde.py
|
|
118
120
|
tests/test_posterior.py
|
|
119
121
|
tests/test_problem.py
|
|
120
|
-
tests/test_sampler.py
|
|
121
122
|
tests/test_samples.py
|
|
122
123
|
tests/test_solver.py
|
|
123
124
|
tests/test_testproblem.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: CUQIpy
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0.post0.dev41
|
|
4
4
|
Summary: Computational Uncertainty Quantification for Inverse problems in Python
|
|
5
5
|
Maintainer-email: "Nicolai A. B. Riis" <nabr@dtu.dk>, "Jakob S. Jørgensen" <jakj@dtu.dk>, "Amal M. Alghamdi" <amaal@dtu.dk>, Chao Zhang <chaz@dtu.dk>
|
|
6
6
|
License: Apache License
|
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "2025-
|
|
11
|
+
"date": "2025-10-09T13:25:50+0200",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "1.
|
|
14
|
+
"full-revisionid": "92bb2e16f3828d8074c008d4ed6a08edcae0889d",
|
|
15
|
+
"version": "1.4.0.post0.dev41"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -143,7 +143,15 @@ class Density(ABC):
|
|
|
143
143
|
def enable_FD(self, epsilon=1e-8):
|
|
144
144
|
""" Enable finite difference approximation for logd gradient. Note
|
|
145
145
|
that if enabled, the FD approximation will be used even if the
|
|
146
|
-
_gradient method is implemented.
|
|
146
|
+
_gradient method is implemented.
|
|
147
|
+
|
|
148
|
+
Parameters
|
|
149
|
+
----------
|
|
150
|
+
epsilon : float
|
|
151
|
+
|
|
152
|
+
Spacing (step size) to use for finite difference approximation for logd
|
|
153
|
+
gradient for each variable. Default is 1e-8.
|
|
154
|
+
"""
|
|
147
155
|
self._FD_enabled = True
|
|
148
156
|
self._FD_epsilon = epsilon
|
|
149
157
|
|
{cuqipy-1.3.0.post0.dev401 → cuqipy-1.4.0.post0.dev41}/cuqi/distribution/_joint_distribution.py
RENAMED
|
@@ -84,6 +84,8 @@ class JointDistribution:
|
|
|
84
84
|
cond_vars = self._get_conditioning_variables()
|
|
85
85
|
if len(cond_vars) > 0:
|
|
86
86
|
raise ValueError(f"Every density parameter must have a distribution (prior). Missing prior for {cond_vars}.")
|
|
87
|
+
# Initialize finite difference gradient approximation settings
|
|
88
|
+
self.disable_FD()
|
|
87
89
|
|
|
88
90
|
# --------- Public properties ---------
|
|
89
91
|
@property
|
|
@@ -96,6 +98,38 @@ class JointDistribution:
|
|
|
96
98
|
""" Returns the geometries of the joint distribution. """
|
|
97
99
|
return [dist.geometry for dist in self._distributions]
|
|
98
100
|
|
|
101
|
+
@property
|
|
102
|
+
def FD_enabled(self):
|
|
103
|
+
""" Returns a dictionary of keys and booleans indicating for each
|
|
104
|
+
parameter name (key) if finite difference approximation of the logd
|
|
105
|
+
gradient is enabled. """
|
|
106
|
+
par_names = self.get_parameter_names()
|
|
107
|
+
FD_enabled = {
|
|
108
|
+
par_name: self.FD_epsilon[par_name] is not None for par_name in par_names
|
|
109
|
+
}
|
|
110
|
+
return FD_enabled
|
|
111
|
+
|
|
112
|
+
@property
|
|
113
|
+
def FD_epsilon(self):
|
|
114
|
+
""" Returns a dictionary indicating for each parameter name the
|
|
115
|
+
spacing for the finite difference approximation of the logd gradient."""
|
|
116
|
+
return self._FD_epsilon
|
|
117
|
+
|
|
118
|
+
@FD_epsilon.setter
|
|
119
|
+
def FD_epsilon(self, value):
|
|
120
|
+
""" Set the spacing for the finite difference approximation of the
|
|
121
|
+
logd gradient as a dictionary. The keys are the parameter names.
|
|
122
|
+
The value for each key is either None (no FD approximation) or a float
|
|
123
|
+
representing the FD step size.
|
|
124
|
+
"""
|
|
125
|
+
par_names = self.get_parameter_names()
|
|
126
|
+
if value is None:
|
|
127
|
+
self._FD_epsilon = {par_name: None for par_name in par_names}
|
|
128
|
+
else:
|
|
129
|
+
if set(value.keys()) != set(par_names):
|
|
130
|
+
raise ValueError("Keys of FD_epsilon must match the parameter names of the distribution "+f" {par_names}")
|
|
131
|
+
self._FD_epsilon = value
|
|
132
|
+
|
|
99
133
|
# --------- Public methods ---------
|
|
100
134
|
def logd(self, *args, **kwargs):
|
|
101
135
|
""" Evaluate the un-normalized log density function. """
|
|
@@ -136,6 +170,33 @@ class JointDistribution:
|
|
|
136
170
|
# Can reduce to Posterior, Likelihood or Distribution.
|
|
137
171
|
return new_joint._reduce_to_single_density()
|
|
138
172
|
|
|
173
|
+
def enable_FD(self, epsilon=None):
|
|
174
|
+
""" Enable finite difference approximation for logd gradient. Note
|
|
175
|
+
that if enabled, the FD approximation will be used even if the
|
|
176
|
+
_gradient method is implemented. By default, all parameters
|
|
177
|
+
will have FD enabled with a step size of 1e-8.
|
|
178
|
+
|
|
179
|
+
Parameters
|
|
180
|
+
----------
|
|
181
|
+
epsilon : dict, *optional*
|
|
182
|
+
|
|
183
|
+
Dictionary indicating the spacing (step size) to use for finite
|
|
184
|
+
difference approximation for logd gradient for each variable.
|
|
185
|
+
|
|
186
|
+
Keys are variable names.
|
|
187
|
+
Values are either a float to enable FD with the given value as the FD
|
|
188
|
+
step size, or None to disable FD for that variable. Default is 1e-8 for
|
|
189
|
+
all variables.
|
|
190
|
+
"""
|
|
191
|
+
if epsilon is None:
|
|
192
|
+
epsilon = {par_name: 1e-8 for par_name in self.get_parameter_names()}
|
|
193
|
+
self.FD_epsilon = epsilon
|
|
194
|
+
|
|
195
|
+
def disable_FD(self):
|
|
196
|
+
""" Disable finite difference approximation for logd gradient. """
|
|
197
|
+
par_names = self.get_parameter_names()
|
|
198
|
+
self.FD_epsilon = {par_name: None for par_name in par_names}
|
|
199
|
+
|
|
139
200
|
def get_parameter_names(self) -> List[str]:
|
|
140
201
|
""" Returns the parameter names of the joint distribution. """
|
|
141
202
|
return [dist.name for dist in self._distributions]
|
|
@@ -202,34 +263,58 @@ class JointDistribution:
|
|
|
202
263
|
# Count number of distributions and likelihoods
|
|
203
264
|
n_dist = len(self._distributions)
|
|
204
265
|
n_likelihood = len(self._likelihoods)
|
|
266
|
+
reduced_FD_epsilon = {par_name:self.FD_epsilon[par_name] for par_name in self.get_parameter_names()}
|
|
267
|
+
self.enable_FD(epsilon=reduced_FD_epsilon)
|
|
205
268
|
|
|
206
269
|
# Cant reduce if there are multiple distributions or likelihoods
|
|
207
270
|
if n_dist > 1:
|
|
208
271
|
return self
|
|
209
272
|
|
|
273
|
+
# If only evaluated densities left return joint to ensure logd method is available
|
|
274
|
+
if n_dist == 0 and n_likelihood == 0:
|
|
275
|
+
return self
|
|
276
|
+
|
|
277
|
+
# Extract the parameter name of the distribution
|
|
278
|
+
if n_dist == 1:
|
|
279
|
+
par_name = self._distributions[0].name
|
|
280
|
+
elif n_likelihood == 1:
|
|
281
|
+
par_name = self._likelihoods[0].name
|
|
282
|
+
else:
|
|
283
|
+
par_name = None
|
|
284
|
+
|
|
210
285
|
# If exactly one distribution and multiple likelihoods reduce
|
|
211
286
|
if n_dist == 1 and n_likelihood > 1:
|
|
212
|
-
|
|
213
|
-
|
|
287
|
+
reduced_distribution = MultipleLikelihoodPosterior(*self._densities)
|
|
288
|
+
reduced_FD_epsilon = {par_name:self.FD_epsilon[par_name]}
|
|
289
|
+
|
|
214
290
|
# If exactly one distribution and one likelihood its a Posterior
|
|
215
291
|
if n_dist == 1 and n_likelihood == 1:
|
|
216
292
|
# Ensure parameter names match, otherwise return the joint distribution
|
|
217
293
|
if set(self._likelihoods[0].get_parameter_names()) != set(self._distributions[0].get_parameter_names()):
|
|
218
294
|
return self
|
|
219
|
-
|
|
295
|
+
reduced_distribution = Posterior(self._likelihoods[0], self._distributions[0])
|
|
296
|
+
reduced_distribution = self._add_constants_to_density(reduced_distribution)
|
|
297
|
+
reduced_FD_epsilon = self.FD_epsilon[par_name]
|
|
220
298
|
|
|
221
299
|
# If exactly one distribution and no likelihoods its a Distribution
|
|
222
300
|
if n_dist == 1 and n_likelihood == 0:
|
|
223
|
-
|
|
224
|
-
|
|
301
|
+
# Intentionally skip enabling FD here. If the user wants FD, they
|
|
302
|
+
# can enable it for this particular distribution before forming
|
|
303
|
+
# the joint distribution.
|
|
304
|
+
return self._add_constants_to_density(self._distributions[0])
|
|
305
|
+
|
|
225
306
|
# If no distributions and exactly one likelihood its a Likelihood
|
|
226
307
|
if n_likelihood == 1 and n_dist == 0:
|
|
227
|
-
|
|
308
|
+
# This case seems to not happen in practice, but we include it for
|
|
309
|
+
# completeness.
|
|
310
|
+
reduced_distribution = self._likelihoods[0]
|
|
311
|
+
reduced_FD_epsilon = self.FD_epsilon[par_name]
|
|
312
|
+
|
|
313
|
+
if self.FD_enabled[par_name]:
|
|
314
|
+
reduced_distribution.enable_FD(epsilon=reduced_FD_epsilon)
|
|
315
|
+
|
|
316
|
+
return reduced_distribution
|
|
228
317
|
|
|
229
|
-
# If only evaluated densities left return joint to ensure logd method is available
|
|
230
|
-
if n_dist == 0 and n_likelihood == 0:
|
|
231
|
-
return self
|
|
232
|
-
|
|
233
318
|
def _add_constants_to_density(self, density: Density):
|
|
234
319
|
""" Add the constants (evaluated densities) to a single density. Used when reducing to single density. """
|
|
235
320
|
|
|
@@ -274,7 +359,7 @@ class JointDistribution:
|
|
|
274
359
|
if len(cond_vars) > 0:
|
|
275
360
|
msg += f"|{cond_vars}"
|
|
276
361
|
msg += ")"
|
|
277
|
-
|
|
362
|
+
|
|
278
363
|
msg += "\n"
|
|
279
364
|
msg += " Densities: \n"
|
|
280
365
|
|
|
@@ -3,7 +3,7 @@ import inspect
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
|
|
5
5
|
# This import makes suggest_sampler easier to read
|
|
6
|
-
import cuqi.
|
|
6
|
+
import cuqi.sampler as samplers
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class SamplerRecommender(object):
|
|
@@ -15,7 +15,7 @@ class SamplerRecommender(object):
|
|
|
15
15
|
target: Density or JointDistribution
|
|
16
16
|
Distribution to get sampler recommendations for.
|
|
17
17
|
|
|
18
|
-
exceptions: list[cuqi.
|
|
18
|
+
exceptions: list[cuqi.sampler.Sampler], *optional*
|
|
19
19
|
Samplers not to be recommended.
|
|
20
20
|
|
|
21
21
|
Example
|
|
@@ -104,7 +104,7 @@ class SamplerRecommender(object):
|
|
|
104
104
|
|
|
105
105
|
"""
|
|
106
106
|
|
|
107
|
-
all_samplers = [(name, cls) for name, cls in inspect.getmembers(cuqi.
|
|
107
|
+
all_samplers = [(name, cls) for name, cls in inspect.getmembers(cuqi.sampler, inspect.isclass) if issubclass(cls, cuqi.sampler.Sampler)]
|
|
108
108
|
valid_samplers = []
|
|
109
109
|
|
|
110
110
|
for name, sampler in all_samplers:
|
|
@@ -116,7 +116,7 @@ class SamplerRecommender(object):
|
|
|
116
116
|
|
|
117
117
|
# Need a separate case for HybridGibbs
|
|
118
118
|
if self.valid_HybridGibbs_sampling_strategy() is not None:
|
|
119
|
-
valid_samplers += [cuqi.
|
|
119
|
+
valid_samplers += [cuqi.sampler.HybridGibbs.__name__ if as_string else cuqi.sampler.HybridGibbs]
|
|
120
120
|
|
|
121
121
|
return valid_samplers
|
|
122
122
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import numpy as np
|
|
2
2
|
import cuqi
|
|
3
|
-
from cuqi.sampler import ProposalBasedSampler
|
|
3
|
+
from cuqi.legacy.sampler import ProposalBasedSampler
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class CWMH(ProposalBasedSampler):
|
|
@@ -48,7 +48,7 @@ class CWMH(ProposalBasedSampler):
|
|
|
48
48
|
target = cuqi.distribution.UserDefinedDistribution(dim=dim, logpdf_func=logpdf_func)
|
|
49
49
|
|
|
50
50
|
# Set up sampler
|
|
51
|
-
sampler = cuqi.sampler.CWMH(target, scale=1)
|
|
51
|
+
sampler = cuqi.legacy.sampler.CWMH(target, scale=1)
|
|
52
52
|
|
|
53
53
|
# Sample
|
|
54
54
|
samples = sampler.sample(2000)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
from cuqi.distribution import JointDistribution
|
|
2
|
-
from cuqi.sampler import Sampler
|
|
2
|
+
from cuqi.legacy.sampler import Sampler
|
|
3
3
|
from cuqi.samples import Samples
|
|
4
4
|
from typing import Dict, Union
|
|
5
5
|
import numpy as np
|
|
6
6
|
import sys
|
|
7
|
-
|
|
7
|
+
import warnings
|
|
8
8
|
|
|
9
9
|
class Gibbs:
|
|
10
10
|
"""
|
|
@@ -52,12 +52,12 @@ class Gibbs:
|
|
|
52
52
|
|
|
53
53
|
# Define sampling strategy
|
|
54
54
|
sampling_strategy = {
|
|
55
|
-
'x': cuqi.sampler.LinearRTO,
|
|
56
|
-
('d', 'l'): cuqi.sampler.Conjugate,
|
|
55
|
+
'x': cuqi.legacy.sampler.LinearRTO,
|
|
56
|
+
('d', 'l'): cuqi.legacy.sampler.Conjugate,
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
# Define Gibbs sampler
|
|
60
|
-
sampler = cuqi.sampler.Gibbs(posterior, sampling_strategy)
|
|
60
|
+
sampler = cuqi.legacy.sampler.Gibbs(posterior, sampling_strategy)
|
|
61
61
|
|
|
62
62
|
# Run sampler
|
|
63
63
|
samples = sampler.sample(Ns=1000, Nb=200)
|
|
@@ -71,6 +71,10 @@ class Gibbs:
|
|
|
71
71
|
|
|
72
72
|
def __init__(self, target: JointDistribution, sampling_strategy: Dict[Union[str,tuple], Sampler]):
|
|
73
73
|
|
|
74
|
+
warnings.warn(f"\nYou are using the legacy sampler '{self.__class__.__name__}'.\n"
|
|
75
|
+
f"This will be removed in a future release of CUQIpy.\n"
|
|
76
|
+
f"Please consider using the new samplers in the 'cuqi.sampler' module.\n", UserWarning, stacklevel=2)
|
|
77
|
+
|
|
74
78
|
# Store target and allow conditioning to reduce to a single density
|
|
75
79
|
self.target = target() # Create a copy of target distribution (to avoid modifying the original)
|
|
76
80
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import numpy as np
|
|
2
|
-
from cuqi.sampler import Sampler
|
|
2
|
+
from cuqi.legacy.sampler import Sampler
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
# another implementation is in https://github.com/mfouesneau/NUTS
|
|
@@ -50,7 +50,7 @@ class NUTS(Sampler):
|
|
|
50
50
|
target = tp.posterior
|
|
51
51
|
|
|
52
52
|
# Set up sampler
|
|
53
|
-
sampler = cuqi.sampler.NUTS(target)
|
|
53
|
+
sampler = cuqi.legacy.sampler.NUTS(target)
|
|
54
54
|
|
|
55
55
|
# Sample
|
|
56
56
|
samples = sampler.sample(10000, 5000)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import numpy as np
|
|
2
2
|
import cuqi
|
|
3
|
-
from cuqi.sampler import Sampler
|
|
3
|
+
from cuqi.legacy.sampler import Sampler
|
|
4
4
|
|
|
5
5
|
class ULA(Sampler):
|
|
6
6
|
"""Unadjusted Langevin algorithm (ULA) (Roberts and Tweedie, 1996)
|
|
@@ -55,7 +55,7 @@ class ULA(Sampler):
|
|
|
55
55
|
gradient_func=gradient_func)
|
|
56
56
|
|
|
57
57
|
# Set up sampler
|
|
58
|
-
sampler = cuqi.sampler.ULA(target, scale=1/dim**2)
|
|
58
|
+
sampler = cuqi.legacy.sampler.ULA(target, scale=1/dim**2)
|
|
59
59
|
|
|
60
60
|
# Sample
|
|
61
61
|
samples = sampler.sample(2000)
|
|
@@ -162,7 +162,7 @@ class MALA(ULA):
|
|
|
162
162
|
gradient_func=gradient_func)
|
|
163
163
|
|
|
164
164
|
# Set up sampler
|
|
165
|
-
sampler = cuqi.sampler.MALA(target, scale=1/5**2)
|
|
165
|
+
sampler = cuqi.legacy.sampler.MALA(target, scale=1/5**2)
|
|
166
166
|
|
|
167
167
|
# Sample
|
|
168
168
|
samples = sampler.sample(2000)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import numpy as np
|
|
2
2
|
import cuqi
|
|
3
|
-
from cuqi.sampler import ProposalBasedSampler
|
|
3
|
+
from cuqi.legacy.sampler import ProposalBasedSampler
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class MH(ProposalBasedSampler):
|
|
@@ -48,7 +48,7 @@ class MH(ProposalBasedSampler):
|
|
|
48
48
|
target = cuqi.distribution.UserDefinedDistribution(dim=dim, logpdf_func=logpdf_func)
|
|
49
49
|
|
|
50
50
|
# Set up sampler
|
|
51
|
-
sampler = cuqi.sampler.MH(target, scale=1)
|
|
51
|
+
sampler = cuqi.legacy.sampler.MH(target, scale=1)
|
|
52
52
|
|
|
53
53
|
# Sample
|
|
54
54
|
samples = sampler.sample(2000)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import numpy as np
|
|
2
2
|
import cuqi
|
|
3
|
-
from cuqi.sampler import Sampler
|
|
3
|
+
from cuqi.legacy.sampler import Sampler
|
|
4
4
|
|
|
5
5
|
class pCN(Sampler):
|
|
6
6
|
#Samples target*proposal
|
|
@@ -48,7 +48,7 @@ class pCN(Sampler):
|
|
|
48
48
|
prior = cuqi.distribution.UserDefinedDistribution(dim=dim, sample_func=sample_func)
|
|
49
49
|
|
|
50
50
|
# Set up sampler
|
|
51
|
-
sampler = cuqi.sampler.pCN((likelihood,prior), scale = 0.1)
|
|
51
|
+
sampler = cuqi.legacy.sampler.pCN((likelihood,prior), scale = 0.1)
|
|
52
52
|
|
|
53
53
|
# Sample
|
|
54
54
|
samples = sampler.sample(5000)
|
|
@@ -73,7 +73,7 @@ class pCN(Sampler):
|
|
|
73
73
|
target = cuqi.distribution.Posterior(likelihood, prior)
|
|
74
74
|
|
|
75
75
|
# Set up sampler
|
|
76
|
-
sampler = cuqi.sampler.pCN(target, scale = 0.1)
|
|
76
|
+
sampler = cuqi.legacy.sampler.pCN(target, scale = 0.1)
|
|
77
77
|
|
|
78
78
|
# Sample
|
|
79
79
|
samples = sampler.sample(5000)
|
|
@@ -4,7 +4,7 @@ from scipy.sparse.linalg import LinearOperator as scipyLinearOperator
|
|
|
4
4
|
import numpy as np
|
|
5
5
|
import cuqi
|
|
6
6
|
from cuqi.solver import CGLS, FISTA
|
|
7
|
-
from cuqi.sampler import Sampler
|
|
7
|
+
from cuqi.legacy.sampler import Sampler
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class LinearRTO(Sampler):
|
|
@@ -209,7 +209,7 @@ class RegularizedLinearRTO(LinearRTO):
|
|
|
209
209
|
Parameters
|
|
210
210
|
------------
|
|
211
211
|
target : `cuqi.distribution.Posterior`
|
|
212
|
-
See `cuqi.sampler.LinearRTO`
|
|
212
|
+
See `cuqi.legacy.sampler.LinearRTO`
|
|
213
213
|
|
|
214
214
|
x0 : `np.ndarray`
|
|
215
215
|
Initial point for the sampler. *Optional*.
|
|
@@ -3,11 +3,16 @@ import sys
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
import cuqi
|
|
5
5
|
from cuqi.samples import Samples
|
|
6
|
+
import warnings
|
|
6
7
|
|
|
7
8
|
class Sampler(ABC):
|
|
8
9
|
|
|
9
10
|
def __init__(self, target, x0=None, dim=None, callback=None):
|
|
10
11
|
|
|
12
|
+
warnings.warn(f"\nYou are using the legacy sampler '{self.__class__.__name__}'.\n"
|
|
13
|
+
f"This will be removed in a future release of CUQIpy.\n"
|
|
14
|
+
f"Please consider using the new samplers in the 'cuqi.sampler' module.\n", UserWarning, stacklevel=2)
|
|
15
|
+
|
|
11
16
|
self._dim = dim
|
|
12
17
|
if hasattr(target,'dim'):
|
|
13
18
|
if self._dim is None:
|