CUQIpy 1.1.0.post0.dev6__py3-none-any.whl → 1.1.0.post0.dev21__py3-none-any.whl
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.
- {CUQIpy-1.1.0.post0.dev6.dist-info → CUQIpy-1.1.0.post0.dev21.dist-info}/METADATA +1 -1
- {CUQIpy-1.1.0.post0.dev6.dist-info → CUQIpy-1.1.0.post0.dev21.dist-info}/RECORD +12 -12
- {CUQIpy-1.1.0.post0.dev6.dist-info → CUQIpy-1.1.0.post0.dev21.dist-info}/WHEEL +1 -1
- cuqi/_version.py +3 -3
- cuqi/experimental/mcmc/_cwmh.py +1 -1
- cuqi/experimental/mcmc/_gibbs.py +5 -4
- cuqi/experimental/mcmc/_laplace_approximation.py +2 -3
- cuqi/experimental/mcmc/_mh.py +1 -1
- cuqi/experimental/mcmc/_rto.py +2 -3
- cuqi/experimental/mcmc/_sampler.py +4 -5
- {CUQIpy-1.1.0.post0.dev6.dist-info → CUQIpy-1.1.0.post0.dev21.dist-info}/LICENSE +0 -0
- {CUQIpy-1.1.0.post0.dev6.dist-info → CUQIpy-1.1.0.post0.dev21.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: CUQIpy
|
|
3
|
-
Version: 1.1.0.post0.
|
|
3
|
+
Version: 1.1.0.post0.dev21
|
|
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
|
cuqi/__init__.py,sha256=LsGilhl-hBLEn6Glt8S_l0OJzAA1sKit_rui8h-D-p0,488
|
|
2
2
|
cuqi/_messages.py,sha256=fzEBrZT2kbmfecBBPm7spVu7yHdxGARQB4QzXhJbCJ0,415
|
|
3
|
-
cuqi/_version.py,sha256=
|
|
3
|
+
cuqi/_version.py,sha256=pquuWWNWYDJTUFSDbH_S09M9kXQmP_DnjYFj4pEcm7k,509
|
|
4
4
|
cuqi/config.py,sha256=wcYvz19wkeKW2EKCGIKJiTpWt5kdaxyt4imyRkvtTRA,526
|
|
5
5
|
cuqi/diagnostics.py,sha256=5OrbJeqpynqRXOe5MtOKKhe7EAVdOEpHIqHnlMW9G_c,3029
|
|
6
6
|
cuqi/array/__init__.py,sha256=-EeiaiWGNsE3twRS4dD814BIlfxEsNkTCZUc5gjOXb0,30
|
|
@@ -37,16 +37,16 @@ cuqi/experimental/__init__.py,sha256=vhZvyMX6rl8Y0haqCzGLPz6PSUKyu75XMQbeDHqTTrw
|
|
|
37
37
|
cuqi/experimental/mcmc/__init__.py,sha256=8Ce1mHvfbKPe0A5gCDl5Bj4ok8bvbn90LEDvfePfNT4,536
|
|
38
38
|
cuqi/experimental/mcmc/_conjugate.py,sha256=VNPQkGity0mposcqxrx4UIeXm35EvJvZED4p2stffvA,9924
|
|
39
39
|
cuqi/experimental/mcmc/_conjugate_approx.py,sha256=uEnY2ea9su5ivcNagyRAwpQP2gBY98sXU7N0y5hTADo,3653
|
|
40
|
-
cuqi/experimental/mcmc/_cwmh.py,sha256=
|
|
40
|
+
cuqi/experimental/mcmc/_cwmh.py,sha256=BQE7-4kbiC32TJ38rlVtfSQieoKBK5GDca3HCqHJ7zE,7135
|
|
41
41
|
cuqi/experimental/mcmc/_direct.py,sha256=9pQS_2Qk2-ybt6m8WTfPoKetcxQ00WaTRN85-Z0FrBY,777
|
|
42
|
-
cuqi/experimental/mcmc/_gibbs.py,sha256=
|
|
42
|
+
cuqi/experimental/mcmc/_gibbs.py,sha256=IxZLDeRGZUhZMDCRyDoII67kcuClIeJoMoYKoICAaSU,10619
|
|
43
43
|
cuqi/experimental/mcmc/_hmc.py,sha256=h63KT0jYq86H541hQzhHHzuLEn7vrRE_2r1o1mTEcZo,19261
|
|
44
44
|
cuqi/experimental/mcmc/_langevin_algorithm.py,sha256=GKC_mlix3si_3J8E6I58ozh3ErB0XPmHMjV7sFyKLEQ,8200
|
|
45
|
-
cuqi/experimental/mcmc/_laplace_approximation.py,sha256=
|
|
46
|
-
cuqi/experimental/mcmc/_mh.py,sha256=
|
|
45
|
+
cuqi/experimental/mcmc/_laplace_approximation.py,sha256=rdiE3cMQFq6FLQcOQwPpuGIxrTAp3aoGPxMDSdeopV0,5688
|
|
46
|
+
cuqi/experimental/mcmc/_mh.py,sha256=W5hOraHqfEW4_havtC9Ib2SinJtNV-NvxcOAENeTYUY,2841
|
|
47
47
|
cuqi/experimental/mcmc/_pcn.py,sha256=wqJBZLuRFSwxihaI53tumAg6AWVuceLMOmXssTetd1A,3374
|
|
48
|
-
cuqi/experimental/mcmc/_rto.py,sha256=
|
|
49
|
-
cuqi/experimental/mcmc/_sampler.py,sha256=
|
|
48
|
+
cuqi/experimental/mcmc/_rto.py,sha256=OtzgiYCxDoTdXp7y4mkLa2upj74qadesoqHYpr11ZCg,10061
|
|
49
|
+
cuqi/experimental/mcmc/_sampler.py,sha256=_ZE0kJZYlo8heolAA0rTgO1sQZ7uwV-lNqCYHxnihFk,20067
|
|
50
50
|
cuqi/experimental/mcmc/_utilities.py,sha256=kUzHbhIS3HYZRbneNBK41IogUYX5dS_bJxqEGm7TQBI,525
|
|
51
51
|
cuqi/geometry/__init__.py,sha256=Tz1WGzZBY-QGH3c0GiyKm9XHN8MGGcnU6TUHLZkzB3o,842
|
|
52
52
|
cuqi/geometry/_geometry.py,sha256=WYFC-4_VBTW73b2ldsnfGYKvdSiCE8plr89xTSmkadg,46804
|
|
@@ -85,8 +85,8 @@ cuqi/testproblem/_testproblem.py,sha256=x769LwwRdJdzIiZkcQUGb_5-vynNTNALXWKato7s
|
|
|
85
85
|
cuqi/utilities/__init__.py,sha256=T4tLsC215MknBCsw_C0Qeeg_ox26aDUrCA5hbWvNQkU,387
|
|
86
86
|
cuqi/utilities/_get_python_variable_name.py,sha256=QwlBVj2koJRA8s8pWd554p7-ElcI7HUwY32HknaR92E,1827
|
|
87
87
|
cuqi/utilities/_utilities.py,sha256=MWAqV6L5btMpWwlUzrZYuV2VeSpfTbOaLRMRkuw2WIA,8509
|
|
88
|
-
CUQIpy-1.1.0.post0.
|
|
89
|
-
CUQIpy-1.1.0.post0.
|
|
90
|
-
CUQIpy-1.1.0.post0.
|
|
91
|
-
CUQIpy-1.1.0.post0.
|
|
92
|
-
CUQIpy-1.1.0.post0.
|
|
88
|
+
CUQIpy-1.1.0.post0.dev21.dist-info/LICENSE,sha256=kJWRPrtRoQoZGXyyvu50Uc91X6_0XRaVfT0YZssicys,10799
|
|
89
|
+
CUQIpy-1.1.0.post0.dev21.dist-info/METADATA,sha256=rMz9rRNyTGpXZ9HSCjmlmKmZhBx4tp6oGXGT94UIdxE,18390
|
|
90
|
+
CUQIpy-1.1.0.post0.dev21.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
|
|
91
|
+
CUQIpy-1.1.0.post0.dev21.dist-info/top_level.txt,sha256=AgmgMc6TKfPPqbjV0kvAoCBN334i_Lwwojc7HE3ZwD0,5
|
|
92
|
+
CUQIpy-1.1.0.post0.dev21.dist-info/RECORD,,
|
cuqi/_version.py
CHANGED
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "2024-08-
|
|
11
|
+
"date": "2024-08-26T11:10:44+0200",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "1.1.0.post0.
|
|
14
|
+
"full-revisionid": "d8a5799ec1e1e581a09e032cbf01bd3eab1b960d",
|
|
15
|
+
"version": "1.1.0.post0.dev21"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
cuqi/experimental/mcmc/_cwmh.py
CHANGED
|
@@ -101,7 +101,7 @@ class CWMH(ProposalBasedSampler):
|
|
|
101
101
|
"Target should be an instance of "+\
|
|
102
102
|
f"{cuqi.density.Density.__class__.__name__}")
|
|
103
103
|
# Fail when there is no log density, which is currently assumed to be the case in case NaN is returned.
|
|
104
|
-
if np.isnan(self.target.logd(self.
|
|
104
|
+
if np.isnan(self.target.logd(self._get_default_initial_point(self.dim))):
|
|
105
105
|
raise ValueError("Target does not have valid logd")
|
|
106
106
|
|
|
107
107
|
def validate_proposal(self):
|
cuqi/experimental/mcmc/_gibbs.py
CHANGED
|
@@ -255,10 +255,11 @@ class HybridGibbs:
|
|
|
255
255
|
""" Get initial points for each parameter """
|
|
256
256
|
initial_points = {}
|
|
257
257
|
for par_name in self.par_names:
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
258
|
+
sampler = self.samplers[par_name]
|
|
259
|
+
if sampler.initial_point is None:
|
|
260
|
+
sampler.initial_point = sampler._get_default_initial_point(self.target.get_density(par_name).dim)
|
|
261
|
+
initial_points[par_name] = sampler.initial_point
|
|
262
|
+
|
|
262
263
|
return initial_points
|
|
263
264
|
|
|
264
265
|
def _store_samples(self):
|
|
@@ -151,7 +151,6 @@ class UGLA(Sampler):
|
|
|
151
151
|
if not isinstance(self.prior, cuqi.distribution.LMRF):
|
|
152
152
|
raise ValueError('Unadjusted Gaussian Laplace approximation (UGLA) requires LMRF prior')
|
|
153
153
|
|
|
154
|
-
|
|
155
|
-
def _default_initial_point(self):
|
|
154
|
+
def _get_default_initial_point(self, dim):
|
|
156
155
|
""" Get the default initial point for the sampler. Defaults to an array of zeros. """
|
|
157
|
-
return np.zeros(
|
|
156
|
+
return np.zeros(dim)
|
cuqi/experimental/mcmc/_mh.py
CHANGED
|
@@ -33,7 +33,7 @@ class MH(ProposalBasedSampler):
|
|
|
33
33
|
|
|
34
34
|
def validate_target(self):
|
|
35
35
|
# Fail only when there is no log density, which is currently assumed to be the case in case NaN is returned.
|
|
36
|
-
if np.isnan(self.target.logd(self.
|
|
36
|
+
if np.isnan(self.target.logd(self._get_default_initial_point(self.dim))):
|
|
37
37
|
raise ValueError("Target does not have valid logd")
|
|
38
38
|
|
|
39
39
|
def validate_proposal(self):
|
cuqi/experimental/mcmc/_rto.py
CHANGED
|
@@ -150,10 +150,9 @@ class LinearRTO(Sampler):
|
|
|
150
150
|
if not hasattr(self.prior, "sqrtprecTimesMean"):
|
|
151
151
|
raise TypeError("Prior must contain a sqrtprecTimesMean attribute")
|
|
152
152
|
|
|
153
|
-
|
|
154
|
-
def _default_initial_point(self):
|
|
153
|
+
def _get_default_initial_point(self, dim):
|
|
155
154
|
""" Get the default initial point for the sampler. Defaults to an array of zeros. """
|
|
156
|
-
return np.zeros(
|
|
155
|
+
return np.zeros(dim)
|
|
157
156
|
|
|
158
157
|
class RegularizedLinearRTO(LinearRTO):
|
|
159
158
|
"""
|
|
@@ -80,7 +80,7 @@ class Sampler(ABC):
|
|
|
80
80
|
|
|
81
81
|
# Default values
|
|
82
82
|
if self.initial_point is None:
|
|
83
|
-
self.initial_point = self.
|
|
83
|
+
self.initial_point = self._get_default_initial_point(self.dim)
|
|
84
84
|
|
|
85
85
|
# State variables
|
|
86
86
|
self.current_point = self.initial_point
|
|
@@ -386,10 +386,9 @@ class Sampler(ABC):
|
|
|
386
386
|
if not self._is_initialized:
|
|
387
387
|
self.initialize()
|
|
388
388
|
|
|
389
|
-
|
|
390
|
-
def _default_initial_point(self):
|
|
389
|
+
def _get_default_initial_point(self, dim):
|
|
391
390
|
""" Return the default initial point for the sampler. Defaults to an array of ones. """
|
|
392
|
-
return np.ones(
|
|
391
|
+
return np.ones(dim)
|
|
393
392
|
|
|
394
393
|
def __repr__(self):
|
|
395
394
|
""" Return a string representation of the sampler. """
|
|
@@ -452,7 +451,7 @@ class ProposalBasedSampler(Sampler, ABC):
|
|
|
452
451
|
|
|
453
452
|
# Default values
|
|
454
453
|
if self.initial_point is None:
|
|
455
|
-
self.initial_point = self.
|
|
454
|
+
self.initial_point = self._get_default_initial_point(self.dim)
|
|
456
455
|
|
|
457
456
|
if self.proposal is None:
|
|
458
457
|
self.proposal = self._default_proposal
|
|
File without changes
|
|
File without changes
|