CUQIpy 1.1.1.post0.dev57__tar.gz → 1.1.1.post0.dev86__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.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/CUQIpy.egg-info/PKG-INFO +1 -1
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/PKG-INFO +1 -1
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/_version.py +3 -3
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/array/_array.py +4 -13
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_beta.py +6 -10
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_custom.py +0 -6
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_distribution.py +2 -31
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_gamma.py +7 -3
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_gaussian.py +2 -12
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_inverse_gamma.py +4 -10
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_lognormal.py +0 -7
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_modifiedhalfnormal.py +10 -7
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_normal.py +0 -7
- cuqipy-1.1.1.post0.dev86/cuqi/experimental/mcmc/__init__.py +123 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/experimental/mcmc/_gibbs.py +2 -2
- cuqipy-1.1.1.post0.dev86/cuqi/samples/__init__.py +1 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/samples/_samples.py +24 -18
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/solver/_solver.py +5 -2
- cuqipy-1.1.1.post0.dev57/cuqi/experimental/mcmc/__init__.py +0 -15
- cuqipy-1.1.1.post0.dev57/cuqi/samples/__init__.py +0 -1
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/CUQIpy.egg-info/SOURCES.txt +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/CUQIpy.egg-info/dependency_links.txt +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/CUQIpy.egg-info/requires.txt +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/CUQIpy.egg-info/top_level.txt +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/LICENSE +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/README.md +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/__init__.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/_messages.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/array/__init__.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/config.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/data/__init__.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/data/_data.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/data/astronaut.npz +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/data/camera.npz +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/data/cat.npz +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/data/cookie.png +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/data/satellite.mat +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/density/__init__.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/density/_density.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/diagnostics.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/__init__.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_cauchy.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_cmrf.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_gmrf.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_joint_distribution.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_laplace.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_lmrf.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_posterior.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_smoothed_laplace.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_uniform.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/experimental/__init__.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/experimental/mcmc/_conjugate.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/experimental/mcmc/_conjugate_approx.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/experimental/mcmc/_cwmh.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/experimental/mcmc/_direct.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/experimental/mcmc/_hmc.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/experimental/mcmc/_langevin_algorithm.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/experimental/mcmc/_laplace_approximation.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/experimental/mcmc/_mh.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/experimental/mcmc/_pcn.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/experimental/mcmc/_rto.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/experimental/mcmc/_sampler.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/experimental/mcmc/_utilities.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/geometry/__init__.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/geometry/_geometry.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/implicitprior/__init__.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/implicitprior/_regularizedGMRF.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/implicitprior/_regularizedGaussian.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/implicitprior/_regularizedUnboundedUniform.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/likelihood/__init__.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/likelihood/_likelihood.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/model/__init__.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/model/_model.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/operator/__init__.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/operator/_operator.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/pde/__init__.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/pde/_pde.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/problem/__init__.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/problem/_problem.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/sampler/__init__.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/sampler/_conjugate.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/sampler/_conjugate_approx.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/sampler/_cwmh.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/sampler/_gibbs.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/sampler/_hmc.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/sampler/_langevin_algorithm.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/sampler/_laplace_approximation.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/sampler/_mh.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/sampler/_pcn.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/sampler/_rto.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/sampler/_sampler.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/solver/__init__.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/testproblem/__init__.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/testproblem/_testproblem.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/utilities/__init__.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/utilities/_get_python_variable_name.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/utilities/_utilities.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/pyproject.toml +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/requirements.txt +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/setup.cfg +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/setup.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_MRFs.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_abstract_distribution_density.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_bayesian_inversion.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_density.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_distribution.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_distributions_shape.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_geometry.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_implicit_priors.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_joint_distribution.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_likelihood.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_model.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_pde.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_posterior.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_problem.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_sampler.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_samples.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_solver.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_testproblem.py +0 -0
- {cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_utilities.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: CUQIpy
|
|
3
|
-
Version: 1.1.1.post0.
|
|
3
|
+
Version: 1.1.1.post0.dev86
|
|
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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: CUQIpy
|
|
3
|
-
Version: 1.1.1.post0.
|
|
3
|
+
Version: 1.1.1.post0.dev86
|
|
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": "2024-09-
|
|
11
|
+
"date": "2024-09-12T20:00:34+0200",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "1.1.1.post0.
|
|
14
|
+
"full-revisionid": "464aa149f16618852db3d404a3d6702f34ffed0d",
|
|
15
|
+
"version": "1.1.1.post0.dev86"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -15,19 +15,7 @@ class CUQIarray(np.ndarray):
|
|
|
15
15
|
Boolean flag whether input_array is to be interpreted as parameter (True) or function values (False).
|
|
16
16
|
|
|
17
17
|
geometry : cuqi.geometry.Geometry, default None
|
|
18
|
-
Contains the geometry related of the data
|
|
19
|
-
|
|
20
|
-
Attributes
|
|
21
|
-
----------
|
|
22
|
-
funvals : CUQIarray
|
|
23
|
-
Returns itself as function values.
|
|
24
|
-
|
|
25
|
-
parameters : CUQIarray
|
|
26
|
-
Returns itself as parameters.
|
|
27
|
-
|
|
28
|
-
Methods
|
|
29
|
-
----------
|
|
30
|
-
:meth:`plot`: Plots the data as function or parameters.
|
|
18
|
+
Contains the geometry related of the data.
|
|
31
19
|
"""
|
|
32
20
|
|
|
33
21
|
def __repr__(self) -> str:
|
|
@@ -62,6 +50,7 @@ class CUQIarray(np.ndarray):
|
|
|
62
50
|
|
|
63
51
|
@property
|
|
64
52
|
def funvals(self):
|
|
53
|
+
""" Returns itself as function values. """
|
|
65
54
|
if self.is_par is True:
|
|
66
55
|
vals = self.geometry.par2fun(self)
|
|
67
56
|
else:
|
|
@@ -82,6 +71,7 @@ class CUQIarray(np.ndarray):
|
|
|
82
71
|
|
|
83
72
|
@property
|
|
84
73
|
def parameters(self):
|
|
74
|
+
""" Returns itself as parameters. """
|
|
85
75
|
if self.is_par is False:
|
|
86
76
|
if self.dtype == np.dtype('O'):
|
|
87
77
|
# If the current state if the CUQIarray is function values, and
|
|
@@ -109,6 +99,7 @@ class CUQIarray(np.ndarray):
|
|
|
109
99
|
f"Cannot convert {self.__class__.__name__} to numpy array")
|
|
110
100
|
|
|
111
101
|
def plot(self, plot_par=False, **kwargs):
|
|
102
|
+
""" Plot the data as function or parameters. """
|
|
112
103
|
if plot_par:
|
|
113
104
|
kwargs["is_par"]=True
|
|
114
105
|
return self.geometry.plot(self.parameters, plot_par=plot_par, **kwargs)
|
|
@@ -9,23 +9,19 @@ class Beta(Distribution):
|
|
|
9
9
|
"""
|
|
10
10
|
Multivariate beta distribution of independent random variables x_i. Each is distributed according to the PDF function
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
.. math::
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
f(x) = x^{(\\alpha-1)}(1-x)^{(\\beta-1)}\Gamma(\\alpha+\\beta) / (\Gamma(\\alpha)\Gamma(\\beta))
|
|
15
|
+
|
|
16
|
+
where :math:`\Gamma` is the Gamma function.
|
|
15
17
|
|
|
16
18
|
Parameters
|
|
17
19
|
------------
|
|
18
20
|
alpha: float or array_like
|
|
21
|
+
The shape parameter :math:`\\alpha` of the beta distribution.
|
|
19
22
|
|
|
20
23
|
beta: float or array_like
|
|
21
|
-
|
|
22
|
-
Methods
|
|
23
|
-
-----------
|
|
24
|
-
sample: generate one or more random samples
|
|
25
|
-
pdf: evaluate probability density function
|
|
26
|
-
logpdf: evaluate log probability density function
|
|
27
|
-
cdf: evaluate cumulative probability function
|
|
28
|
-
gradient: evaluate the gradient of the logpdf
|
|
24
|
+
The shape parameter :math:`\\beta` of the beta distribution.
|
|
29
25
|
|
|
30
26
|
Example
|
|
31
27
|
-------
|
|
@@ -12,12 +12,6 @@ class UserDefinedDistribution(Distribution):
|
|
|
12
12
|
gradient_func: Function evaluating the gradient of the logpdf. Callable.
|
|
13
13
|
sample_func: Function drawing samples from distribution. Callable.
|
|
14
14
|
|
|
15
|
-
Methods
|
|
16
|
-
-----------
|
|
17
|
-
sample: generate one or more random samples
|
|
18
|
-
logpdf: evaluate log probability density function
|
|
19
|
-
gradient: evaluate gradient of logpdf
|
|
20
|
-
|
|
21
15
|
Example
|
|
22
16
|
-----------
|
|
23
17
|
.. code-block:: python
|
|
@@ -28,37 +28,6 @@ class Distribution(Density, ABC):
|
|
|
28
28
|
is_symmetric : bool, default None
|
|
29
29
|
Indicator if distribution is symmetric.
|
|
30
30
|
|
|
31
|
-
Attributes
|
|
32
|
-
----------
|
|
33
|
-
dim : int or None
|
|
34
|
-
Dimension of distribution.
|
|
35
|
-
|
|
36
|
-
name : str or None
|
|
37
|
-
Name of distribution.
|
|
38
|
-
|
|
39
|
-
geometry : Geometry or None
|
|
40
|
-
Geometry of distribution.
|
|
41
|
-
|
|
42
|
-
is_cond : bool
|
|
43
|
-
Indicator if distribution is conditional.
|
|
44
|
-
|
|
45
|
-
Methods
|
|
46
|
-
-------
|
|
47
|
-
pdf():
|
|
48
|
-
Evaluate the probability density function.
|
|
49
|
-
|
|
50
|
-
logpdf():
|
|
51
|
-
Evaluate the log probability density function.
|
|
52
|
-
|
|
53
|
-
sample():
|
|
54
|
-
Generate one or more random samples.
|
|
55
|
-
|
|
56
|
-
get_conditioning_variables():
|
|
57
|
-
Return the conditioning variables of distribution.
|
|
58
|
-
|
|
59
|
-
get_mutable_variables():
|
|
60
|
-
Return the mutable variables (attributes and properties) of distribution.
|
|
61
|
-
|
|
62
31
|
Notes
|
|
63
32
|
-----
|
|
64
33
|
A distribution can be conditional if one or more mutable variables are unspecified.
|
|
@@ -239,6 +208,7 @@ class Distribution(Density, ABC):
|
|
|
239
208
|
"enable_FD().")
|
|
240
209
|
|
|
241
210
|
def sample(self,N=1,*args,**kwargs):
|
|
211
|
+
""" Sample from the distribution. """
|
|
242
212
|
|
|
243
213
|
if self.is_cond:
|
|
244
214
|
raise ValueError(f"Cannot sample from conditional distribution. Missing conditioning variables: {self.get_conditioning_variables()}")
|
|
@@ -263,6 +233,7 @@ class Distribution(Density, ABC):
|
|
|
263
233
|
pass
|
|
264
234
|
|
|
265
235
|
def pdf(self,x):
|
|
236
|
+
""" Evaluate the log probability density function of the distribution. """
|
|
266
237
|
return np.exp(self.logpdf(x))
|
|
267
238
|
|
|
268
239
|
def _condition(self, *args, **kwargs):
|
|
@@ -6,14 +6,18 @@ from cuqi.utilities import force_ndarray
|
|
|
6
6
|
class Gamma(Distribution):
|
|
7
7
|
"""
|
|
8
8
|
Represents a multivariate Gamma distribution characterized by shape and rate parameters of independent random variables x_i. Each is distributed according to the PDF function
|
|
9
|
+
|
|
10
|
+
.. math::
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
f(x_i; \\alpha, \\beta) = \\beta^\\alpha x_i^{\\alpha-1} \\exp(-\\beta x_i) / \Gamma(\\alpha)
|
|
11
13
|
|
|
12
|
-
where
|
|
14
|
+
where shape :math:`\\alpha` and rate :math:`\\beta` are the parameters of the distribution, and :math:`\Gamma` is the Gamma function.
|
|
13
15
|
|
|
14
16
|
In case shape and/or rate are arrays, the pdf looks like
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
.. math::
|
|
19
|
+
|
|
20
|
+
f(x_i; \\alpha_i, \\beta_i) = \\beta_i^{\\alpha_i} x_i^{\\alpha_i-1} \\exp(-\\beta_i x_i) / \Gamma(\\alpha_i)
|
|
17
21
|
|
|
18
22
|
Parameters
|
|
19
23
|
----------
|
|
@@ -730,18 +730,6 @@ class JointGaussianSqrtPrec(Distribution):
|
|
|
730
730
|
------------
|
|
731
731
|
means: List of means for each Gaussian distribution.
|
|
732
732
|
sqrtprecs: List of sqrt precision matricies for each Gaussian distribution.
|
|
733
|
-
|
|
734
|
-
Attributes
|
|
735
|
-
------------
|
|
736
|
-
sqrtprec: Returns the sqrt precision matrix of the joined gaussian in stacked form.
|
|
737
|
-
sqrtprecTimesMean: Returns the sqrt precision matrix times the mean of the distribution.
|
|
738
|
-
|
|
739
|
-
Methods
|
|
740
|
-
-----------
|
|
741
|
-
sample: generate one or more random samples (NotImplemented)
|
|
742
|
-
pdf: evaluate probability density function (NotImplemented)
|
|
743
|
-
logpdf: evaluate log probability density function (NotImplemented)
|
|
744
|
-
cdf: evaluate cumulative probability function (NotImplemented)
|
|
745
733
|
"""
|
|
746
734
|
def __init__(self,means=None,sqrtprecs=None,is_symmetric=True,**kwargs):
|
|
747
735
|
|
|
@@ -783,6 +771,7 @@ class JointGaussianSqrtPrec(Distribution):
|
|
|
783
771
|
|
|
784
772
|
@property
|
|
785
773
|
def sqrtprec(self):
|
|
774
|
+
""" Returns the sqrt precision matrix of the joined gaussian in stacked form. """
|
|
786
775
|
if spa.issparse(self._sqrtprecs[0]):
|
|
787
776
|
return spa.vstack((self._sqrtprecs))
|
|
788
777
|
else:
|
|
@@ -790,6 +779,7 @@ class JointGaussianSqrtPrec(Distribution):
|
|
|
790
779
|
|
|
791
780
|
@property
|
|
792
781
|
def sqrtprecTimesMean(self):
|
|
782
|
+
""" Returns the sqrt precision matrix times the mean of the distribution."""
|
|
793
783
|
result = []
|
|
794
784
|
for i in range(len(self._means)):
|
|
795
785
|
result.append((self._sqrtprecs[i]@self._means[i]).flatten())
|
|
@@ -8,9 +8,11 @@ class InverseGamma(Distribution):
|
|
|
8
8
|
"""
|
|
9
9
|
Multivariate inverse gamma distribution of independent random variables x_i. Each is distributed according to the PDF function
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
.. math::
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
f(x) = (x-\\beta)^{(-\\alpha-1)} * \exp(-\\gamma/(x-\\beta)) / (\\gamma^{(-\\alpha)}*\Gamma(\\alpha))
|
|
14
|
+
|
|
15
|
+
where shape :math:`\\alpha`, location :math:`\\beta` and scale :math:`\\gamma` are the shape, location and scale of x_i, respectively. And :math:`\Gamma` is the Gamma function.
|
|
14
16
|
|
|
15
17
|
Parameters
|
|
16
18
|
------------
|
|
@@ -23,14 +25,6 @@ class InverseGamma(Distribution):
|
|
|
23
25
|
scale: float or array_like
|
|
24
26
|
The scale of the inverse gamma distribution (non-negative)
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
Methods
|
|
28
|
-
-----------
|
|
29
|
-
sample: generate one or more random samples
|
|
30
|
-
pdf: evaluate probability density function
|
|
31
|
-
logpdf: evaluate log probability density function
|
|
32
|
-
cdf: evaluate cumulative probability function
|
|
33
|
-
|
|
34
28
|
Example
|
|
35
29
|
-------
|
|
36
30
|
.. code-block:: python
|
|
@@ -16,13 +16,6 @@ class Lognormal(Distribution):
|
|
|
16
16
|
cov: np.ndarray
|
|
17
17
|
Covariance matrix of the normal distribution used to define the lognormal distribution
|
|
18
18
|
|
|
19
|
-
Methods
|
|
20
|
-
-----------
|
|
21
|
-
sample: generate one or more random samples
|
|
22
|
-
pdf: evaluate probability density function
|
|
23
|
-
logpdf: evaluate log probability density function
|
|
24
|
-
cdf: evaluate cumulative probability function
|
|
25
|
-
|
|
26
19
|
Example
|
|
27
20
|
-------
|
|
28
21
|
.. code-block:: python
|
{cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_modifiedhalfnormal.py
RENAMED
|
@@ -7,14 +7,17 @@ from cuqi.utilities import force_ndarray
|
|
|
7
7
|
class ModifiedHalfNormal(Distribution):
|
|
8
8
|
"""
|
|
9
9
|
Represents a modified half-normal (MHN) distribution, a three-parameter family of distributions generalizing the Gamma distribution.
|
|
10
|
-
The distribution is continuous with pdf
|
|
11
|
-
|
|
10
|
+
The distribution is continuous with pdf
|
|
11
|
+
|
|
12
|
+
.. math::
|
|
13
|
+
|
|
14
|
+
f(x; \\alpha, \\beta, \\gamma) \propto x^{(\\alpha-1)} * \exp(-\\beta * x^2 + \\gamma * x)
|
|
12
15
|
|
|
13
16
|
The MHN generalizes the half-normal distribution, because
|
|
14
|
-
f(x; 1, beta, 0) propto exp(
|
|
17
|
+
:math:`f(x; 1, \\beta, 0) \propto \exp(-\\beta * x^2)`
|
|
15
18
|
|
|
16
19
|
The MHN generalizes the gamma distribution because
|
|
17
|
-
f(x; alpha, 0,
|
|
20
|
+
:math:`f(x; \\alpha, 0, -\\gamma) \propto x^{(\\alpha-1)} * \exp(- \\gamma * x)`
|
|
18
21
|
|
|
19
22
|
Reference:
|
|
20
23
|
[1] Sun, et al. "The Modified-Half-Normal distribution: Properties and an efficient sampling scheme." Communications in Statistics-Theory and Methods
|
|
@@ -22,13 +25,13 @@ class ModifiedHalfNormal(Distribution):
|
|
|
22
25
|
Parameters
|
|
23
26
|
----------
|
|
24
27
|
alpha : float
|
|
25
|
-
The polynomial exponent parameter of the MHN distribution. Must be positive.
|
|
28
|
+
The polynomial exponent parameter :math:`\\alpha` of the MHN distribution. Must be positive.
|
|
26
29
|
|
|
27
30
|
beta : float
|
|
28
|
-
The quadratic exponential parameter of the MHN distribution. Must be positive.
|
|
31
|
+
The quadratic exponential parameter :math:`\\beta` of the MHN distribution. Must be positive.
|
|
29
32
|
|
|
30
33
|
gamma : float
|
|
31
|
-
The linear exponential parameter of the MHN distribution.
|
|
34
|
+
The linear exponential parameter :math:`\\gamma` of the MHN distribution.
|
|
32
35
|
|
|
33
36
|
"""
|
|
34
37
|
def __init__(self, alpha=None, beta=None, gamma=None, is_symmetric=False, **kwargs):
|
|
@@ -12,13 +12,6 @@ class Normal(Distribution):
|
|
|
12
12
|
mean: mean of distribution
|
|
13
13
|
std: standard deviation
|
|
14
14
|
|
|
15
|
-
Methods
|
|
16
|
-
-----------
|
|
17
|
-
sample: generate one or more random samples
|
|
18
|
-
pdf: evaluate probability density function
|
|
19
|
-
logpdf: evaluate log probability density function
|
|
20
|
-
cdf: evaluate cumulative probability function
|
|
21
|
-
|
|
22
15
|
Example
|
|
23
16
|
-----------
|
|
24
17
|
.. code-block:: python
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Re-implementation of sampler module in a more object-oriented way.
|
|
3
|
+
|
|
4
|
+
Main changes for users
|
|
5
|
+
----------------------
|
|
6
|
+
|
|
7
|
+
1. Sampling API
|
|
8
|
+
^^^^^^^^^^^^
|
|
9
|
+
|
|
10
|
+
Previously one would call the `.sample` or `sample_adapt` methods of a sampler instance at :py:mod:`cuqi.sampler` to sample from a target distribution and store the samples as the output as follows:
|
|
11
|
+
|
|
12
|
+
.. code-block:: python
|
|
13
|
+
|
|
14
|
+
from cuqi.sampler import MH
|
|
15
|
+
from cuqi.distribution import DistributionGallery
|
|
16
|
+
|
|
17
|
+
# Target distribution
|
|
18
|
+
target = DistributionGallery("donut")
|
|
19
|
+
|
|
20
|
+
# Set up sampler
|
|
21
|
+
sampler = MH(target)
|
|
22
|
+
|
|
23
|
+
# Sample from the target distribution (Alternatively calling sample with explicit scale parameter set in sampler)
|
|
24
|
+
samples = sampler.sample_adapt(Ns=100, Nb=100) # Burn-in (Nb) removed by default
|
|
25
|
+
|
|
26
|
+
This has now changed to to a more object-oriented API which provides more flexibility and control over the sampling process.
|
|
27
|
+
|
|
28
|
+
For example one can now more explicitly control when the sampler is tuned (warmup) and when it is sampling with fixed parameters.
|
|
29
|
+
|
|
30
|
+
.. code-block:: python
|
|
31
|
+
|
|
32
|
+
from cuqi.experimental.mcmc import MH
|
|
33
|
+
from cuqi.distribution import DistributionGallery
|
|
34
|
+
|
|
35
|
+
# Target distribution
|
|
36
|
+
target = DistributionGallery("donut")
|
|
37
|
+
|
|
38
|
+
# Set up sampler
|
|
39
|
+
sampler = MH(target)
|
|
40
|
+
|
|
41
|
+
# Sample from the target distribution
|
|
42
|
+
sampler.warmup(Nb=100) # Explicit warmup (tuning) of sampler
|
|
43
|
+
sampler.sample(Ns=100) # Sampling with fixed parameters
|
|
44
|
+
samples = sampler.get_samples().burnthin(Nb=100) # Getting samples and removing burn-in from warmup
|
|
45
|
+
|
|
46
|
+
Importantly, the removal of burn-in from e.g. warmup is now a separate step that is done after the sampling process is complete.
|
|
47
|
+
|
|
48
|
+
2. Sampling API for BayesianProblem
|
|
49
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
50
|
+
|
|
51
|
+
:py:class:`cuqi.problem.BayesianProblem` continues to have the same API for `sample_posterior` and the `UQ` method.
|
|
52
|
+
|
|
53
|
+
There is now a flag `experimental` that can be set to `True` to use the new MCMC samplers.
|
|
54
|
+
|
|
55
|
+
By default, the flag is set to `False` and the old samplers are used.
|
|
56
|
+
|
|
57
|
+
For this more high-level interface, burn-in is automatically removed from the samples as was the case before.
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
3. More options for Gibbs sampling
|
|
61
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
62
|
+
|
|
63
|
+
There are now more options for Gibbs sampling. Previously it was only possible to sample with Gibbs for samplers :py:class:`cuqi.sampler.LinearRTO`, :py:class:`cuqi.sampler.RegularizedLinearRTO`, :py:class:`cuqi.sampler.Conjugate`, and :py:class:`cuqi.sampler.ConjugateApprox`.
|
|
64
|
+
|
|
65
|
+
Now, it is possible to define a Gibbs sampling scheme using any sampler from the :py:mod:`cuqi.experimental.mcmc` module.
|
|
66
|
+
|
|
67
|
+
**Example using a NUTS-within-Gibbs scheme for a 1D deconvolution problem:**
|
|
68
|
+
|
|
69
|
+
.. code-block:: python
|
|
70
|
+
|
|
71
|
+
import cuqi
|
|
72
|
+
import numpy as np
|
|
73
|
+
from cuqi.distribution import Gamma, Gaussian, GMRF, JointDistribution
|
|
74
|
+
from cuqi.experimental.mcmc import NUTS, HybridGibbs, Conjugate
|
|
75
|
+
from cuqi.testproblem import Deconvolution1D
|
|
76
|
+
|
|
77
|
+
# Forward problem
|
|
78
|
+
A, y_data, info = Deconvolution1D(dim=128, phantom='sinc', noise_std=0.001).get_components()
|
|
79
|
+
|
|
80
|
+
# Bayesian Inverse Problem
|
|
81
|
+
s = Gamma(1, 1e-4)
|
|
82
|
+
x = GMRF(np.zeros(A.domain_dim), 50)
|
|
83
|
+
y = Gaussian(A @ x, lambda s: 1 / s)
|
|
84
|
+
|
|
85
|
+
# Posterior
|
|
86
|
+
target = JointDistribution(y, x, s)(y=y_data)
|
|
87
|
+
|
|
88
|
+
# Gibbs sampling strategy. Note we can define initial_points and various parameters for each sampler
|
|
89
|
+
sampling_strategy = {
|
|
90
|
+
"x": NUTS(max_depth=10, initial_point=np.zeros(A.domain_dim)),
|
|
91
|
+
"s": Conjugate()
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
# Here we do 10 internal steps with NUTS for each Gibbs step
|
|
95
|
+
num_sampling_steps = {
|
|
96
|
+
"x": 10,
|
|
97
|
+
"s": 1
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
sampler = HybridGibbs(target, sampling_strategy, num_sampling_steps)
|
|
101
|
+
|
|
102
|
+
sampler.warmup(50)
|
|
103
|
+
sampler.sample(200)
|
|
104
|
+
samples = sampler.get_samples().burnthin(Nb=50)
|
|
105
|
+
|
|
106
|
+
samples["x"].plot_ci(exact=info.exactSolution)
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
from ._sampler import Sampler, ProposalBasedSampler
|
|
112
|
+
from ._langevin_algorithm import ULA, MALA
|
|
113
|
+
from ._mh import MH
|
|
114
|
+
from ._pcn import PCN
|
|
115
|
+
from ._rto import LinearRTO, RegularizedLinearRTO
|
|
116
|
+
from ._cwmh import CWMH
|
|
117
|
+
from ._laplace_approximation import UGLA
|
|
118
|
+
from ._hmc import NUTS
|
|
119
|
+
from ._gibbs import HybridGibbs
|
|
120
|
+
from ._conjugate import Conjugate
|
|
121
|
+
from ._conjugate_approx import ConjugateApprox
|
|
122
|
+
from ._direct import Direct
|
|
123
|
+
from ._utilities import find_valid_samplers
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from cuqi.distribution import JointDistribution
|
|
2
2
|
from cuqi.experimental.mcmc import Sampler
|
|
3
|
-
from cuqi.samples import Samples
|
|
3
|
+
from cuqi.samples import Samples, JointSamples
|
|
4
4
|
from cuqi.experimental.mcmc import NUTS
|
|
5
5
|
from typing import Dict
|
|
6
6
|
import numpy as np
|
|
@@ -197,7 +197,7 @@ class HybridGibbs:
|
|
|
197
197
|
return self
|
|
198
198
|
|
|
199
199
|
def get_samples(self) -> Dict[str, Samples]:
|
|
200
|
-
samples_object =
|
|
200
|
+
samples_object = JointSamples()
|
|
201
201
|
for par_name in self.par_names:
|
|
202
202
|
samples_array = np.array(self.samples[par_name]).T
|
|
203
203
|
samples_object[par_name] = Samples(samples_array, self.target.get_density(par_name).geometry)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from ._samples import Samples, JointSamples
|
|
@@ -36,24 +36,6 @@ class Samples(object):
|
|
|
36
36
|
geometry : cuqi.geometry.Geometry, default None
|
|
37
37
|
Contains the geometry related of the samples
|
|
38
38
|
|
|
39
|
-
Attributes
|
|
40
|
-
----------
|
|
41
|
-
shape : tuple
|
|
42
|
-
Returns the shape of samples.
|
|
43
|
-
|
|
44
|
-
Ns : int
|
|
45
|
-
Returns the number of samples
|
|
46
|
-
|
|
47
|
-
Methods
|
|
48
|
-
----------
|
|
49
|
-
:meth:`plot`: Plots one or more samples.
|
|
50
|
-
:meth:`plot_ci`: Plots a credibility interval for the samples.
|
|
51
|
-
:meth:`plot_mean`: Plots the mean of the samples.
|
|
52
|
-
:meth:`plot_std`: Plots the std of the samples.
|
|
53
|
-
:meth:`plot_chain`: Plots all samples of one or more variables (MCMC chain).
|
|
54
|
-
:meth:`hist_chain`: Plots histogram of all samples of a single variable (MCMC chain).
|
|
55
|
-
:meth:`burnthin`: Removes burn-in and thins samples.
|
|
56
|
-
:meth:`diagnostics`: Conducts diagnostics on the chain.
|
|
57
39
|
"""
|
|
58
40
|
def __init__(self, samples, geometry=None, is_par=True, is_vec=True):
|
|
59
41
|
self.geometry = geometry
|
|
@@ -83,6 +65,7 @@ class Samples(object):
|
|
|
83
65
|
|
|
84
66
|
@property
|
|
85
67
|
def shape(self):
|
|
68
|
+
"""Returns the shape of samples."""
|
|
86
69
|
return self.samples.shape
|
|
87
70
|
|
|
88
71
|
@property
|
|
@@ -408,6 +391,7 @@ class Samples(object):
|
|
|
408
391
|
return ax
|
|
409
392
|
|
|
410
393
|
def plot(self,sample_indices=None,*args,**kwargs):
|
|
394
|
+
""" Plots one or more samples. """
|
|
411
395
|
Ns = self.Ns
|
|
412
396
|
Np = 5 # Number of samples to plot if Ns > 5
|
|
413
397
|
|
|
@@ -447,6 +431,7 @@ class Samples(object):
|
|
|
447
431
|
return lines
|
|
448
432
|
|
|
449
433
|
def hist_chain(self,variable_indices,*args,**kwargs):
|
|
434
|
+
""" Plots samples histogram of variables with indices specified in variable_indices. """
|
|
450
435
|
|
|
451
436
|
self._raise_error_if_not_vec(self.hist_chain.__name__)
|
|
452
437
|
|
|
@@ -580,6 +565,7 @@ class Samples(object):
|
|
|
580
565
|
|
|
581
566
|
|
|
582
567
|
def diagnostics(self):
|
|
568
|
+
""" Conducts diagnostics on the chain (Geweke test). """
|
|
583
569
|
# Geweke test
|
|
584
570
|
Geweke(self.samples.T)
|
|
585
571
|
|
|
@@ -881,3 +867,23 @@ class Samples(object):
|
|
|
881
867
|
"Geometry:\n {}\n\n".format(self.geometry) + \
|
|
882
868
|
"Shape:\n {}\n\n".format(self.shape) + \
|
|
883
869
|
"Samples:\n {}\n\n".format(self.samples)
|
|
870
|
+
|
|
871
|
+
class JointSamples(dict):
|
|
872
|
+
""" An object used to store samples from :class:`cuqi.distribution.JointDistribution`.
|
|
873
|
+
|
|
874
|
+
This object is a simple overload of the dictionary class to allow easy access to certain methods
|
|
875
|
+
of Samples objects without having to iterate over each key in the dictionary.
|
|
876
|
+
|
|
877
|
+
"""
|
|
878
|
+
|
|
879
|
+
def burnthin(self, Nb, Nt=1):
|
|
880
|
+
""" Remove burn-in and thin samples for all samples in the dictionary. Returns a copy of the samples stored in the dictionary. """
|
|
881
|
+
return JointSamples({key: samples.burnthin(Nb, Nt) for key, samples in self.items()})
|
|
882
|
+
|
|
883
|
+
def __repr__(self) -> str:
|
|
884
|
+
return "CUQIpy JointSamples Dict:\n" + \
|
|
885
|
+
"-------------------------\n\n" + \
|
|
886
|
+
"Keys:\n {}\n\n".format(list(self.keys())) + \
|
|
887
|
+
"Ns (number of samples):\n {}\n\n".format({key: samples.Ns for key, samples in self.items()}) + \
|
|
888
|
+
"Geometry:\n {}\n\n".format({key: samples.geometry for key, samples in self.items()}) + \
|
|
889
|
+
"Shape:\n {}\n\n".format({key: samples.shape for key, samples in self.items()})
|
|
@@ -174,9 +174,12 @@ class LS(object):
|
|
|
174
174
|
"""Wrapper for :meth:`scipy.optimize.least_squares`.
|
|
175
175
|
|
|
176
176
|
Solve nonlinear least-squares problems with bounds:
|
|
177
|
+
|
|
178
|
+
.. math::
|
|
177
179
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
+
\min F(x) = 0.5 * \sum(\\rho(f_i(x)^2), i = 0, ..., m-1)
|
|
181
|
+
|
|
182
|
+
subject to :math:`lb <= x <= ub`.
|
|
180
183
|
|
|
181
184
|
Parameters
|
|
182
185
|
----------
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
""" Re-implementation of sampler module in a more object oriented way. """
|
|
2
|
-
|
|
3
|
-
from ._sampler import Sampler, ProposalBasedSampler
|
|
4
|
-
from ._langevin_algorithm import ULA, MALA
|
|
5
|
-
from ._mh import MH
|
|
6
|
-
from ._pcn import PCN
|
|
7
|
-
from ._rto import LinearRTO, RegularizedLinearRTO
|
|
8
|
-
from ._cwmh import CWMH
|
|
9
|
-
from ._laplace_approximation import UGLA
|
|
10
|
-
from ._hmc import NUTS
|
|
11
|
-
from ._gibbs import HybridGibbs
|
|
12
|
-
from ._conjugate import Conjugate
|
|
13
|
-
from ._conjugate_approx import ConjugateApprox
|
|
14
|
-
from ._direct import Direct
|
|
15
|
-
from ._utilities import find_valid_samplers
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from ._samples import Samples
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_joint_distribution.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/distribution/_smoothed_laplace.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/experimental/mcmc/_conjugate_approx.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/experimental/mcmc/_langevin_algorithm.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/implicitprior/_regularizedGMRF.py
RENAMED
|
File without changes
|
{cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/implicitprior/_regularizedGaussian.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/sampler/_laplace_approximation.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/cuqi/utilities/_get_python_variable_name.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cuqipy-1.1.1.post0.dev57 → cuqipy-1.1.1.post0.dev86}/tests/test_abstract_distribution_density.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|