CUQIpy 1.1.1.post0.dev36__py3-none-any.whl → 1.4.1.post0.dev124__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.

Potentially problematic release.


This version of CUQIpy might be problematic. Click here for more details.

Files changed (92) hide show
  1. cuqi/__init__.py +2 -0
  2. cuqi/_version.py +3 -3
  3. cuqi/algebra/__init__.py +2 -0
  4. cuqi/algebra/_abstract_syntax_tree.py +358 -0
  5. cuqi/algebra/_ordered_set.py +82 -0
  6. cuqi/algebra/_random_variable.py +457 -0
  7. cuqi/array/_array.py +4 -13
  8. cuqi/config.py +7 -0
  9. cuqi/density/_density.py +9 -1
  10. cuqi/distribution/__init__.py +3 -2
  11. cuqi/distribution/_beta.py +7 -11
  12. cuqi/distribution/_cauchy.py +2 -2
  13. cuqi/distribution/_custom.py +0 -6
  14. cuqi/distribution/_distribution.py +31 -45
  15. cuqi/distribution/_gamma.py +7 -3
  16. cuqi/distribution/_gaussian.py +2 -12
  17. cuqi/distribution/_inverse_gamma.py +4 -10
  18. cuqi/distribution/_joint_distribution.py +112 -15
  19. cuqi/distribution/_lognormal.py +0 -7
  20. cuqi/distribution/{_modifiedhalfnormal.py → _modified_half_normal.py} +23 -23
  21. cuqi/distribution/_normal.py +34 -7
  22. cuqi/distribution/_posterior.py +9 -0
  23. cuqi/distribution/_truncated_normal.py +129 -0
  24. cuqi/distribution/_uniform.py +47 -1
  25. cuqi/experimental/__init__.py +2 -2
  26. cuqi/experimental/_recommender.py +216 -0
  27. cuqi/geometry/__init__.py +2 -0
  28. cuqi/geometry/_geometry.py +15 -1
  29. cuqi/geometry/_product_geometry.py +181 -0
  30. cuqi/implicitprior/__init__.py +5 -3
  31. cuqi/implicitprior/_regularized_gaussian.py +483 -0
  32. cuqi/implicitprior/{_regularizedGMRF.py → _regularized_gmrf.py} +4 -2
  33. cuqi/implicitprior/{_regularizedUnboundedUniform.py → _regularized_unbounded_uniform.py} +3 -2
  34. cuqi/implicitprior/_restorator.py +269 -0
  35. cuqi/legacy/__init__.py +2 -0
  36. cuqi/{experimental/mcmc → legacy/sampler}/__init__.py +7 -11
  37. cuqi/legacy/sampler/_conjugate.py +55 -0
  38. cuqi/legacy/sampler/_conjugate_approx.py +52 -0
  39. cuqi/legacy/sampler/_cwmh.py +196 -0
  40. cuqi/legacy/sampler/_gibbs.py +231 -0
  41. cuqi/legacy/sampler/_hmc.py +335 -0
  42. cuqi/{experimental/mcmc → legacy/sampler}/_langevin_algorithm.py +82 -111
  43. cuqi/legacy/sampler/_laplace_approximation.py +184 -0
  44. cuqi/legacy/sampler/_mh.py +190 -0
  45. cuqi/legacy/sampler/_pcn.py +244 -0
  46. cuqi/{experimental/mcmc → legacy/sampler}/_rto.py +132 -90
  47. cuqi/legacy/sampler/_sampler.py +182 -0
  48. cuqi/likelihood/_likelihood.py +9 -1
  49. cuqi/model/__init__.py +1 -1
  50. cuqi/model/_model.py +1361 -359
  51. cuqi/pde/__init__.py +4 -0
  52. cuqi/pde/_observation_map.py +36 -0
  53. cuqi/pde/_pde.py +134 -33
  54. cuqi/problem/_problem.py +93 -87
  55. cuqi/sampler/__init__.py +120 -8
  56. cuqi/sampler/_conjugate.py +376 -35
  57. cuqi/sampler/_conjugate_approx.py +40 -16
  58. cuqi/sampler/_cwmh.py +132 -138
  59. cuqi/{experimental/mcmc → sampler}/_direct.py +1 -1
  60. cuqi/sampler/_gibbs.py +288 -130
  61. cuqi/sampler/_hmc.py +328 -201
  62. cuqi/sampler/_langevin_algorithm.py +284 -100
  63. cuqi/sampler/_laplace_approximation.py +87 -117
  64. cuqi/sampler/_mh.py +47 -157
  65. cuqi/sampler/_pcn.py +65 -213
  66. cuqi/sampler/_rto.py +211 -142
  67. cuqi/sampler/_sampler.py +553 -136
  68. cuqi/samples/__init__.py +1 -1
  69. cuqi/samples/_samples.py +24 -18
  70. cuqi/solver/__init__.py +6 -4
  71. cuqi/solver/_solver.py +230 -26
  72. cuqi/testproblem/_testproblem.py +2 -3
  73. cuqi/utilities/__init__.py +6 -1
  74. cuqi/utilities/_get_python_variable_name.py +2 -2
  75. cuqi/utilities/_utilities.py +182 -2
  76. {CUQIpy-1.1.1.post0.dev36.dist-info → cuqipy-1.4.1.post0.dev124.dist-info}/METADATA +10 -6
  77. cuqipy-1.4.1.post0.dev124.dist-info/RECORD +101 -0
  78. {CUQIpy-1.1.1.post0.dev36.dist-info → cuqipy-1.4.1.post0.dev124.dist-info}/WHEEL +1 -1
  79. CUQIpy-1.1.1.post0.dev36.dist-info/RECORD +0 -92
  80. cuqi/experimental/mcmc/_conjugate.py +0 -197
  81. cuqi/experimental/mcmc/_conjugate_approx.py +0 -81
  82. cuqi/experimental/mcmc/_cwmh.py +0 -191
  83. cuqi/experimental/mcmc/_gibbs.py +0 -268
  84. cuqi/experimental/mcmc/_hmc.py +0 -470
  85. cuqi/experimental/mcmc/_laplace_approximation.py +0 -156
  86. cuqi/experimental/mcmc/_mh.py +0 -78
  87. cuqi/experimental/mcmc/_pcn.py +0 -89
  88. cuqi/experimental/mcmc/_sampler.py +0 -561
  89. cuqi/experimental/mcmc/_utilities.py +0 -17
  90. cuqi/implicitprior/_regularizedGaussian.py +0 -323
  91. {CUQIpy-1.1.1.post0.dev36.dist-info → cuqipy-1.4.1.post0.dev124.dist-info/licenses}/LICENSE +0 -0
  92. {CUQIpy-1.1.1.post0.dev36.dist-info → cuqipy-1.4.1.post0.dev124.dist-info}/top_level.txt +0 -0
@@ -188,7 +188,7 @@ def approx_derivative(func, wrt, direction=None, epsilon=np.sqrt(np.finfo(float)
188
188
  # We compute the Jacobian matrix of func using forward differences.
189
189
  # If the function is scalar-valued, we compute the gradient instead.
190
190
  # If the direction is provided, we compute the direction-Jacobian product.
191
- wrt = np.asfarray(wrt)
191
+ wrt = force_ndarray(wrt, flatten=True)
192
192
  f0 = func(wrt)
193
193
  Matr = np.zeros([infer_len(wrt), infer_len(f0)])
194
194
  dx = np.zeros(len(wrt))
@@ -344,4 +344,184 @@ def plot_2D_density(density: Density,
344
344
  extent = (v1_min-hp_x, v1_max+hp_x, v2_min-hp_y, v2_max+hp_y)
345
345
 
346
346
  im = plt.imshow(evaluated_density, origin='lower', extent=extent, **kwargs)
347
- return im
347
+ return im
348
+
349
+
350
+
351
+ def count_nonzero(x, threshold = 1e-6):
352
+ """ Returns the number of values in an array whose absolute value is larger than a specified threshold
353
+
354
+ Parameters
355
+ ----------
356
+ x : `np.ndarray`
357
+ Array to count nonzero elements of.
358
+
359
+ threshold : float
360
+ Theshold for considering a value as nonzero.
361
+ """
362
+ return np.sum([np.abs(v) >= threshold for v in x])
363
+
364
+
365
+ def count_within_bounds(x, lower_bounds, upper_bounds, threshold = 1e-6, exception = np.nan):
366
+ """ Returns the number of values in an array whose value lies between the provided lower and upper bounds.
367
+
368
+ Parameters
369
+ ----------
370
+ x : `np.ndarray`
371
+ Array to count elements of.
372
+
373
+ lower_bounds : `np.ndarray`
374
+ Lower bound on values to disregard when counting.
375
+
376
+ upper_bounds : `np.ndarray`
377
+ Upper bound on values to disregard.
378
+
379
+ threshold : float
380
+ Theshold for considering a value as nonzero.
381
+ """
382
+ return np.sum([l + threshold <= v and v <= u - threshold and not (exception - threshold <= v and v <= exception + threshold) for v, l, u in zip(x, lower_bounds, upper_bounds)])
383
+
384
+
385
+ def count_constant_components_1D(x, threshold = 1e-2, lower = -np.inf, upper = np.inf, exception = np.nan):
386
+ """ Returns the number of piecewise constant components in a one-dimensional array
387
+
388
+ Parameters
389
+ ----------
390
+ x : `np.ndarray`
391
+ 1D Array to count components of.
392
+
393
+ threshold : float
394
+ Strict theshold on when the difference of neighbouring values is considered zero.
395
+
396
+ lower : float or numpy.ndarray
397
+ Piecewise constant components below this value are not counted.
398
+
399
+ upper : float or numpy.ndarray
400
+ Piecewise constant components above this value are not counted.
401
+ """
402
+
403
+ if not isinstance(lower, np.ndarray):
404
+ lower = lower*np.ones_like(x)
405
+
406
+ if not isinstance(upper, np.ndarray):
407
+ upper = upper*np.ones_like(x)
408
+
409
+ counter = 0
410
+ index = 0
411
+ if (x[index] > lower[index] and
412
+ x[index] < upper[index] and
413
+ not (exception - threshold <= x[index] and x[index] <= exception + threshold)):
414
+ counter += 1
415
+
416
+ x_previous = x[0]
417
+
418
+ for x_current in x[1:]:
419
+ index += 1
420
+ if (abs(x_previous - x_current) >= threshold and
421
+ x_current > lower[index] and
422
+ x_current < upper[index] and
423
+ not (exception - threshold <= x_current and x_current <= exception + threshold)):
424
+ counter += 1
425
+
426
+ x_previous = x_current
427
+
428
+ return counter
429
+
430
+ def count_constant_components_2D(x, threshold = 1e-2, lower = -np.inf, upper = np.inf):
431
+ """ Returns the number of piecewise constant components in a two-dimensional array
432
+
433
+ Parameters
434
+ ----------
435
+ x : `np.ndarray`
436
+ 2D Array to count components of.
437
+
438
+ threshold : float
439
+ Strict theshold on when the difference of neighbouring values is considered zero.
440
+
441
+ lower : float or numpy.ndarray
442
+ Piecewise constant components below this value are not counted.
443
+
444
+ upper : float or numpy.ndarray
445
+ Piecewise constant components above this value are not counted.
446
+ """
447
+
448
+ if not isinstance(lower, np.ndarray):
449
+ lower = lower*np.ones_like(x)
450
+
451
+ if not isinstance(upper, np.ndarray):
452
+ upper = upper*np.ones_like(x)
453
+
454
+ filled = np.zeros_like(x, dtype = int)
455
+ counter = 0
456
+
457
+ def process(i, j):
458
+ queue = []
459
+ queue.append((i,j))
460
+ filled[i, j] = 1
461
+ while len(queue) != 0:
462
+ (icur, jcur) = queue.pop(0)
463
+
464
+ if icur > 0 and filled[icur - 1, jcur] == 0 and abs(x[icur, jcur] - x[icur - 1, jcur]) <= threshold:
465
+ filled[icur - 1, jcur] = 1
466
+ queue.append((icur-1, jcur))
467
+ if jcur > 0 and filled[icur, jcur-1] == 0 and abs(x[icur, jcur] - x[icur, jcur - 1]) <= threshold:
468
+ filled[icur, jcur-1] = 1
469
+ queue.append((icur, jcur-1))
470
+ if icur < x.shape[0]-1 and filled[icur + 1, jcur] == 0 and abs(x[icur, jcur] - x[icur + 1, jcur]) <= threshold:
471
+ filled[icur + 1, jcur] = 1
472
+ queue.append((icur+1, jcur))
473
+ if jcur < x.shape[1]-1 and filled[icur, jcur + 1] == 0 and abs(x[icur, jcur] - x[icur, jcur + 1]) <= threshold:
474
+ filled[icur, jcur + 1] = 1
475
+ queue.append((icur, jcur+1))
476
+
477
+ for i in range(x.shape[0]):
478
+ for j in range(x.shape[1]):
479
+ if filled[i,j] == 0:
480
+ if x[i,j] > lower[i,j] and x[i,j] < upper[i,j]:
481
+ counter += 1
482
+ process(i, j)
483
+ return counter
484
+
485
+
486
+
487
+ def piecewise_linear_1D_DoF(x, threshold = 1e-5, exception_zero = False, exception_flat = False):
488
+ """ Returns the degrees of freedom of a piecewise linear signal.
489
+ Assuming linear interpolation, this corresponds to the number of non-differentiable points, including end-points.
490
+
491
+ Parameters
492
+ ----------
493
+ x : `np.ndarray`
494
+ 1D Array to compute degrees of freedom of.
495
+
496
+ threshold : float
497
+ Strict theshold on when values are considered zero.
498
+
499
+ exception_zero : Boolean
500
+ Whether a zero piecewise linear components should be considered.
501
+
502
+ exception_flat : Boolean
503
+ Whether a flat piecewise linear components should be considered.
504
+ """
505
+
506
+ differences = x[1:] - x[:-1]
507
+ double_differences = differences[1:] - differences[:-1]
508
+
509
+ joints = [True] + [np.abs(d) >= threshold for d in double_differences] + [True]
510
+
511
+ if not exception_zero and not exception_flat:
512
+ return np.sum(joints)
513
+ elif exception_zero:
514
+ return np.sum(joints and [np.abs(v) < threshold for v in x])
515
+ elif exception_flat:
516
+ prev_joint = None
517
+ counter = 0
518
+ for i in range(len(joints)):
519
+ if joints[i]:
520
+ counter += 1
521
+ if prev_joint is None:
522
+ prev_joint = i
523
+ else:
524
+ if np.abs(x[i] - x[prev_joint]) < threshold:
525
+ counter -= 1
526
+ prev_joint = i
527
+ return counter
@@ -1,9 +1,9 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: CUQIpy
3
- Version: 1.1.1.post0.dev36
3
+ Version: 1.4.1.post0.dev124
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
- License: Apache License
6
+ License: Apache License
7
7
  Version 2.0, January 2004
8
8
  http://www.apache.org/licenses/
9
9
 
@@ -197,13 +197,16 @@ Project-URL: Source, https://github.com/CUQI-DTU/CUQIpy
197
197
  Project-URL: Documentation, https://cuqi-dtu.github.io/CUQIpy/
198
198
  Project-URL: Download, https://github.com/CUQI-DTU/CUQIpy/releases
199
199
  Project-URL: Tracker, https://github.com/CUQI-DTU/CUQIpy/issues
200
- Requires-Python: >=3.8
200
+ Requires-Python: >=3.9
201
201
  Description-Content-Type: text/markdown
202
202
  License-File: LICENSE
203
203
  Requires-Dist: matplotlib
204
204
  Requires-Dist: numpy>=1.17.0
205
- Requires-Dist: scipy<1.13
205
+ Requires-Dist: scipy==1.12.0; python_version <= "3.9"
206
+ Requires-Dist: scipy; python_version > "3.9"
206
207
  Requires-Dist: arviz
208
+ Requires-Dist: tqdm
209
+ Dynamic: license-file
207
210
 
208
211
  <div align="center">
209
212
  <img src="https://cuqi-dtu.github.io/CUQIpy/_static/logo.png" alt="CUQIpy logo" width="250"/>
@@ -230,8 +233,9 @@ CUQIpy is part of the [CUQI project](https://www.compute.dtu.dk/english/cuqi) su
230
233
 
231
234
  - **Papers:** CUQIpy on ArXiv - [Part I](https://arxiv.org/abs/2305.16949) & [Part II](https://arxiv.org/abs/2305.16951)
232
235
 
233
- - **Training:** [Demo & training notebooks](https://github.com/CUQI-DTU/CUQIpy-demos)
236
+ - **CUQI book:** [CUQI book website](https://cuqi-dtu.github.io/CUQI-Book/)
234
237
 
238
+ - **User showcases:** [Showcase repository](https://github.com/CUQI-DTU/CUQIpy-User-Showcase/)
235
239
 
236
240
  ## 🚀 Quickstart
237
241
  Install CUQIpy using pip:
@@ -0,0 +1,101 @@
1
+ cuqi/__init__.py,sha256=gs3F4QTPPvZe1sGbPcHn9U4eIyYJHXCJuwK4-eLe0qs,531
2
+ cuqi/_messages.py,sha256=fzEBrZT2kbmfecBBPm7spVu7yHdxGARQB4QzXhJbCJ0,415
3
+ cuqi/_version.py,sha256=tdHpMrwKv90ZBXtaIMTh3hJmXK6ZtO4sqYFgOh1jWc0,510
4
+ cuqi/config.py,sha256=PJ2OHq1aAtLVUORwPAtLyyxlnCY3salCXkYD6BBMZYs,800
5
+ cuqi/diagnostics.py,sha256=5OrbJeqpynqRXOe5MtOKKhe7EAVdOEpHIqHnlMW9G_c,3029
6
+ cuqi/algebra/__init__.py,sha256=2uWq2_H1XpXg1TLheTzLL3ySG5tFiNQkZCd9TcZeaEI,99
7
+ cuqi/algebra/_abstract_syntax_tree.py,sha256=PdPz19cJMjvnMx4KEzhn4gvxIZX_UViE33Mbttj_5Xw,9873
8
+ cuqi/algebra/_ordered_set.py,sha256=fKysh4pmI4xF7Y5Z6O86ABzg20o4uBs-v8jmLBMrdpo,2849
9
+ cuqi/algebra/_random_variable.py,sha256=owEkaiF1lD0UUGLS9BOTsLKxL98NRTtmNnyVd9J0Y94,19717
10
+ cuqi/array/__init__.py,sha256=-EeiaiWGNsE3twRS4dD814BIlfxEsNkTCZUc5gjOXb0,30
11
+ cuqi/array/_array.py,sha256=UJoWyQjDpl8g2q4wuuz_ufpr2JoYL0BbCxrxZpZR99I,4303
12
+ cuqi/data/__init__.py,sha256=1aGgPmtG_Kqbb880vLnPksGvyYQB_6o2mz_q-4KGYaU,173
13
+ cuqi/data/_data.py,sha256=PgdYJ6MHgNY37Ak8wUYwvxcAwOYSNjnf1-BXMdbnuv4,10716
14
+ cuqi/data/astronaut.npz,sha256=vVTb6eJLMZhrEZuOYzQWN3V2EhhVH6sHzrrf_7mstcw,786696
15
+ cuqi/data/camera.npz,sha256=EznyKfAomn4orm-L9gqM3QDFNuGB5XZwpZZMwDgiMKk,262408
16
+ cuqi/data/cat.npz,sha256=9H9iJqkvlCCVZZ2IWMfwwfVHbShpQTkZo_WGr7rrp3k,406164
17
+ cuqi/data/cookie.png,sha256=mr6wUeoIUc5VC2qYj8vafOmTbcRwz0fHz4IIPK9_PnE,984680
18
+ cuqi/data/satellite.mat,sha256=a0Nz_Ak-Y0m360dH74pa_rpk-MhaQ91ftGTKhQX7I8g,16373
19
+ cuqi/density/__init__.py,sha256=0zfVcPgqdqiPkss5n_WP_PUt-G3ovHXjokhqEKIlLwA,48
20
+ cuqi/density/_density.py,sha256=Pfcq8b9MuTAuXxVwORRyNru_KIAFN1yHp2Y1yNwdyrg,7467
21
+ cuqi/distribution/__init__.py,sha256=Iort29ha-StKAaELXXxIdCLvqyDs1tbYfosoGbup0r0,781
22
+ cuqi/distribution/_beta.py,sha256=QlibnuHNcvWjl-du5aRc9QuzS3n4PsyD_8Nc47w-E0Q,2903
23
+ cuqi/distribution/_cauchy.py,sha256=Qwi21WkwUBnBkLbhR-yCGO0tQ_U_3mmvR0pDMPPPB5c,3296
24
+ cuqi/distribution/_cmrf.py,sha256=tCbEulM_O7FB3C_W-3IqZp9zGHkTofCdFF0ybHc9UZI,3745
25
+ cuqi/distribution/_custom.py,sha256=11lnAG7CS15bpV6JOOP--2YyKnAduvXY1IjAOJ1tqO0,10504
26
+ cuqi/distribution/_distribution.py,sha256=ZT8k0J-DNoEptdVBbsTYHBBd17V-6DfCBwo1BatC_0Y,18277
27
+ cuqi/distribution/_gamma.py,sha256=VcvBJS51N-MxuX42r9L2j2QYRlzhdgAtQ6Wa5IFO_YE,3536
28
+ cuqi/distribution/_gaussian.py,sha256=3L1L_3W6i6YuPQ8vnFmju5QsvkLlg4VsgCnj11lYBUE,32977
29
+ cuqi/distribution/_gmrf.py,sha256=OwId8qQWEtmC2fxVhL4iBHZnc8ZCrZzfV6yGXDE3k30,9522
30
+ cuqi/distribution/_inverse_gamma.py,sha256=oPJuiYp3O1m547pmmIz9OWesky9YpwLTHT7-9MmcYss,3159
31
+ cuqi/distribution/_joint_distribution.py,sha256=WoiaaZ_4nLFJaKUy-Ks5U0ED4DGb3BCKChcuCqJPCgU,20357
32
+ cuqi/distribution/_laplace.py,sha256=5exLvlzJm2AgfvZ3KUSkjfwlGwwbsktBxP8z0iLMik8,1401
33
+ cuqi/distribution/_lmrf.py,sha256=rdGoQ-fPe1oW6Z29P-l3woq0NX3_RxUQ2rzm1VzemNM,3290
34
+ cuqi/distribution/_lognormal.py,sha256=8_hOFQ3iu88ujX8vxmfVEZ0fdmlhTY98PlG5PasPjEg,2612
35
+ cuqi/distribution/_modified_half_normal.py,sha256=ErULXUFRjbMyCYywaOzfuxtoy-XQmC0McMROo2mTQtc,7313
36
+ cuqi/distribution/_normal.py,sha256=vhIiAseW09IKh1uy0KUq7RP1IuY7hH5aNM1W_R8Gd_Q,2912
37
+ cuqi/distribution/_posterior.py,sha256=6LxXAIBzFxyEqx5bUfgqTXVKgXxqNhRItec6FcRVLEE,5350
38
+ cuqi/distribution/_smoothed_laplace.py,sha256=p-1Y23mYA9omwiHGkEuv3T2mwcPAAoNlCr7T8osNkjE,2925
39
+ cuqi/distribution/_truncated_normal.py,sha256=_ez3MmO6qpBeP6BKCUlW3IgxuF7k--A7jPGPUhtYK0g,4240
40
+ cuqi/distribution/_uniform.py,sha256=fVgj_4SBav8JMc1pNAO1l_CZ9ZwdoMIpN9iQ3i9_Z0Q,3255
41
+ cuqi/experimental/__init__.py,sha256=OZ4WHvYNiQWGdRikzSDhDZcajr9ib35NblQpIOHnQCg,109
42
+ cuqi/experimental/_recommender.py,sha256=ulW69nDGwkB8X93OMgMVLcVz2L0T3SZqHKG7jZ9wNm8,7907
43
+ cuqi/geometry/__init__.py,sha256=1BcuUHP5tNzfsTLz1qB0WACRIVJU3AtdgfEqgI89oo8,891
44
+ cuqi/geometry/_geometry.py,sha256=W-oQTZPelVS7fN9qZj6bNBuh-yY0eqOHJ39UwB-WmQY,47562
45
+ cuqi/geometry/_product_geometry.py,sha256=tdFUrQzoKPtqbd5aLxXP3DMOkBNrM9B-DTUQPNBxgFE,7186
46
+ cuqi/implicitprior/__init__.py,sha256=VNOIO5tfp2yq-atljh6ckpmNCdU0sDEq3TSTA3TjBP4,327
47
+ cuqi/implicitprior/_regularized_gaussian.py,sha256=9BSKHGEW0OT9OIt_42strDzxBM8mB6A-blcf0kEguHw,21836
48
+ cuqi/implicitprior/_regularized_gmrf.py,sha256=BUeT4rwJzary9K56fkxCNGCeKZd-2VSgOT8XNHxFPRE,6345
49
+ cuqi/implicitprior/_regularized_unbounded_uniform.py,sha256=uHGYYnTjVxdPbY-5JwocFOH0sHRfGrrLiHWahzH9R8A,3533
50
+ cuqi/implicitprior/_restorator.py,sha256=KxaC5QHdu8mTXJnOAVIBqe7-6D58sGKbKhDobyrYosA,11569
51
+ cuqi/legacy/__init__.py,sha256=KEIAkfTQUW7CM7ekOVRAD6E7QGwehHN5bBlfGxByttQ,106
52
+ cuqi/legacy/sampler/__init__.py,sha256=D-dYa0gFgIwQukP8_VKhPGmlGKXbvVo7YqaET4SdAeQ,382
53
+ cuqi/legacy/sampler/_conjugate.py,sha256=x5OsFk1zDm2tvoFsSxbCKwjSqBHUGbcUvcTwDOvL-tw,2841
54
+ cuqi/legacy/sampler/_conjugate_approx.py,sha256=xX-X71EgxGnZooOY6CIBhuJTs3dhcKfoLnoFxX3CO2g,1938
55
+ cuqi/legacy/sampler/_cwmh.py,sha256=xft9_oEh52W5GpnnDK8ZRK--RseymINQlYLhYdtRNnk,7789
56
+ cuqi/legacy/sampler/_gibbs.py,sha256=1UItwYlj17JcJhqCYCfDw1x39o82Y1q9ykJ6zG19ppE,8965
57
+ cuqi/legacy/sampler/_hmc.py,sha256=6fSWjDLZcZH28X21h9Uq9RhgKGXUOamy-2wqJ_WR-qc,15041
58
+ cuqi/legacy/sampler/_langevin_algorithm.py,sha256=ndAJ9qYVsYshVMt9zkYtWUqn1Bn0uTGUKPDElPecexM,7882
59
+ cuqi/legacy/sampler/_laplace_approximation.py,sha256=CvMQmMxi_XmaIdWrs9tsu4NTty7uSm4jIlb_zrQaW0w,6572
60
+ cuqi/legacy/sampler/_mh.py,sha256=hmNfEBUihDHE2g4wKkwxUEuPj_1at7Mrpt2w9OMHX0M,7076
61
+ cuqi/legacy/sampler/_pcn.py,sha256=PlMGwsI0ZCDfrAT95u-5uvdYdD2lkaLhnQZCsBFl_Y0,8622
62
+ cuqi/legacy/sampler/_rto.py,sha256=bfVKgk-2NnrkTnRaZvs2zIfiWSbElIYx0zaMu6lab-s,11935
63
+ cuqi/legacy/sampler/_sampler.py,sha256=hw5BNhnFkERGtdvZ4Gd_QQZYshNiU_Jx-Yl1--x5HAs,6023
64
+ cuqi/likelihood/__init__.py,sha256=QXif382iwZ5bT3ZUqmMs_n70JVbbjxbqMrlQYbMn4Zo,1776
65
+ cuqi/likelihood/_likelihood.py,sha256=I12qQF3h_Z8jj7zb_AYD-SEUn34VCU7VxcTcH25Axao,7074
66
+ cuqi/model/__init__.py,sha256=jgY2-jyxEMC79vkyH9BpfowW7_DbMRjqedOtO5fykXQ,62
67
+ cuqi/model/_model.py,sha256=SWGCzZ2-rmosngulNOofgyMC1K3-WmDH3_Ws3qs8Pmg,74912
68
+ cuqi/operator/__init__.py,sha256=0pc9p-KPyl7KtPV0noB0ddI0CP2iYEHw5rbw49D8Njk,136
69
+ cuqi/operator/_operator.py,sha256=yNwPTh7jR07AiKMbMQQ5_54EgirlKFsbq9JN1EODaQI,8856
70
+ cuqi/pde/__init__.py,sha256=pExaUnEvdNtgL9sQachcKkbDilE87rRiUTKk4hd2zSM,158
71
+ cuqi/pde/_observation_map.py,sha256=J4wekH5IQ0hqSySOBY6DocL32NLFlVM9bJakHxdfJ7Q,1410
72
+ cuqi/pde/_pde.py,sha256=94oZwFqRqN4qOABu0GgenKH8pJRah_u0IReJkQlqEaI,17768
73
+ cuqi/problem/__init__.py,sha256=JxJty4JqHTOqSG6NeTGiXRQ7OLxiRK9jvVq3lXLeIRw,38
74
+ cuqi/problem/_problem.py,sha256=_-oPHRkgc2QGTHCdfaNkSWHgX-CjZQnQubbIws7KV10,38583
75
+ cuqi/sampler/__init__.py,sha256=7H8gmUJ6Woezc6RcXj1nARt8CF59ILeOxryQr9li9jU,4616
76
+ cuqi/sampler/_conjugate.py,sha256=QeQI-ZH4OK_wIIygWLM7dNkH0TSVixdb-VUBFc2prw4,22049
77
+ cuqi/sampler/_conjugate_approx.py,sha256=LXPykdG-2KKCCIsxeu4G4Iu6BcAtujtAVOJTGV_aRbc,3525
78
+ cuqi/sampler/_cwmh.py,sha256=0CVKuFuD5-99ipXF-EQ5T5RpYORWriugzttNu6xM7Ik,7320
79
+ cuqi/sampler/_direct.py,sha256=tyVoC9lOGrdR4T0bQUlRewC8uDaenIV61Jk3NEttVVw,767
80
+ cuqi/sampler/_gibbs.py,sha256=rmKhsEoybMJHzvt92VOIr80f6QTmPO_jJBqvc5hLFWE,14932
81
+ cuqi/sampler/_hmc.py,sha256=yQ0mq51sRMLICRXIdDZLNzlJLt-03OecDOsMkADb-sI,19462
82
+ cuqi/sampler/_langevin_algorithm.py,sha256=_e_k9ik3RxvArkuAZZCWv9jhRDoXYctoyD7amMZFi50,15029
83
+ cuqi/sampler/_laplace_approximation.py,sha256=tfsfbHhMA_q0pcNF5X8SYT6bWWzY5BSC-hKKRdSaGUI,5906
84
+ cuqi/sampler/_mh.py,sha256=WsVmpvkhvYuFoUvXevOYibIwmhvaKY4YXrkEsF_5YvY,2931
85
+ cuqi/sampler/_pcn.py,sha256=C8JzklKRXrF-XjEGjyMJ12gZS1ufxQwkTOvhcXlHdZc,3470
86
+ cuqi/sampler/_rto.py,sha256=AQFi8Kqa3uQZsZxdpPb2B9Is_lyfz1v8l9JAY3e4J2w,17186
87
+ cuqi/sampler/_sampler.py,sha256=btuwCPpv5esTwV4Ex6UwGwst0xsCW-CGxGy_iCVRrlY,21622
88
+ cuqi/samples/__init__.py,sha256=vCs6lVk-pi8RBqa6cIN5wyn6u-K9oEf1Na4k1ZMrYv8,44
89
+ cuqi/samples/_samples.py,sha256=hUc8OnCF9CTCuDTrGHwwzv3wp8mG_6vsJAFvuQ-x0uA,35832
90
+ cuqi/solver/__init__.py,sha256=KYgAi_8VoAwljTB3S2I87YnJkRtedskLee7hQp_-zp8,220
91
+ cuqi/solver/_solver.py,sha256=X3EWD-26o9UOBsWRuy0ktYsJiUXwpCGm0lvTdQM6dRI,30964
92
+ cuqi/testproblem/__init__.py,sha256=DWTOcyuNHMbhEuuWlY5CkYkNDSAqhvsKmJXBLivyblU,202
93
+ cuqi/testproblem/_testproblem.py,sha256=EJWG_zXUtmo6GlHBZFqHlRpDC_48tE0XZEu0_C66NS8,52524
94
+ cuqi/utilities/__init__.py,sha256=d5QXRzmI6EchS9T4b7eTezSisPWuWklO8ey4YBx9kI0,569
95
+ cuqi/utilities/_get_python_variable_name.py,sha256=wxpCaj9f3ZtBNqlGmmuGiITgBaTsY-r94lUIlK6UAU4,2043
96
+ cuqi/utilities/_utilities.py,sha256=R7BdNysrE36a4D729DvfrTisWY4paP5nfqdkQxSX3Mg,18431
97
+ cuqipy-1.4.1.post0.dev124.dist-info/licenses/LICENSE,sha256=kJWRPrtRoQoZGXyyvu50Uc91X6_0XRaVfT0YZssicys,10799
98
+ cuqipy-1.4.1.post0.dev124.dist-info/METADATA,sha256=pk9Tg3dCf9SRxzAPk7V0M8s5GWD9Cp0Sy4rYSoq6auM,18624
99
+ cuqipy-1.4.1.post0.dev124.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
100
+ cuqipy-1.4.1.post0.dev124.dist-info/top_level.txt,sha256=AgmgMc6TKfPPqbjV0kvAoCBN334i_Lwwojc7HE3ZwD0,5
101
+ cuqipy-1.4.1.post0.dev124.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.1)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,92 +0,0 @@
1
- cuqi/__init__.py,sha256=LsGilhl-hBLEn6Glt8S_l0OJzAA1sKit_rui8h-D-p0,488
2
- cuqi/_messages.py,sha256=fzEBrZT2kbmfecBBPm7spVu7yHdxGARQB4QzXhJbCJ0,415
3
- cuqi/_version.py,sha256=PxeXIVclRTk3kiFawV6Oz6g5wmG2chZXbA1vtHlEXMY,509
4
- cuqi/config.py,sha256=wcYvz19wkeKW2EKCGIKJiTpWt5kdaxyt4imyRkvtTRA,526
5
- cuqi/diagnostics.py,sha256=5OrbJeqpynqRXOe5MtOKKhe7EAVdOEpHIqHnlMW9G_c,3029
6
- cuqi/array/__init__.py,sha256=-EeiaiWGNsE3twRS4dD814BIlfxEsNkTCZUc5gjOXb0,30
7
- cuqi/array/_array.py,sha256=Xm2n1MFnLhR3KUjoCzMc-tnZ5HBX1mQ8MyxhZnIvSCA,4400
8
- cuqi/data/__init__.py,sha256=1aGgPmtG_Kqbb880vLnPksGvyYQB_6o2mz_q-4KGYaU,173
9
- cuqi/data/_data.py,sha256=PgdYJ6MHgNY37Ak8wUYwvxcAwOYSNjnf1-BXMdbnuv4,10716
10
- cuqi/data/astronaut.npz,sha256=vVTb6eJLMZhrEZuOYzQWN3V2EhhVH6sHzrrf_7mstcw,786696
11
- cuqi/data/camera.npz,sha256=EznyKfAomn4orm-L9gqM3QDFNuGB5XZwpZZMwDgiMKk,262408
12
- cuqi/data/cat.npz,sha256=9H9iJqkvlCCVZZ2IWMfwwfVHbShpQTkZo_WGr7rrp3k,406164
13
- cuqi/data/cookie.png,sha256=mr6wUeoIUc5VC2qYj8vafOmTbcRwz0fHz4IIPK9_PnE,984680
14
- cuqi/data/satellite.mat,sha256=a0Nz_Ak-Y0m360dH74pa_rpk-MhaQ91ftGTKhQX7I8g,16373
15
- cuqi/density/__init__.py,sha256=0zfVcPgqdqiPkss5n_WP_PUt-G3ovHXjokhqEKIlLwA,48
16
- cuqi/density/_density.py,sha256=BG7gtP0cbFYLVgjYQGkNAhM95PR5ocBVLKRlOVX2PyM,7253
17
- cuqi/distribution/__init__.py,sha256=4vVLArg6NVzBj67vVioK8BY6wISJKb5cOxdoHMuUb_s,714
18
- cuqi/distribution/_beta.py,sha256=hdAc6Tbuz9Yqf76NSHxpaUgN7s6Z2lNV7YSRD3JhyCU,2997
19
- cuqi/distribution/_cauchy.py,sha256=UsVXYz8HhagXN5fIWSAIyELqhsJAX_-wk9kkRGgRmA8,3296
20
- cuqi/distribution/_cmrf.py,sha256=tCbEulM_O7FB3C_W-3IqZp9zGHkTofCdFF0ybHc9UZI,3745
21
- cuqi/distribution/_custom.py,sha256=3toVV_ntnWAGlI7pNQLS7-7m5i-34sTWQrxL-SMweq0,10681
22
- cuqi/distribution/_distribution.py,sha256=G7BCpVueK4QLoLa_hu9h-Euh58Yp9SrgUKuudUlg-pw,18351
23
- cuqi/distribution/_gamma.py,sha256=9vljt5iaBDCHRhrVCMLc2RWDuBchZRQcv9buJMDYPlM,3434
24
- cuqi/distribution/_gaussian.py,sha256=DmmgVxKp4iEiEYWDdDcRoh35y14Oepn-zDHex0WVaYo,33316
25
- cuqi/distribution/_gmrf.py,sha256=OwId8qQWEtmC2fxVhL4iBHZnc8ZCrZzfV6yGXDE3k30,9522
26
- cuqi/distribution/_inverse_gamma.py,sha256=XRcNGW_jzORL08V7VvtsuMUoQioBAGbN12qe8hCXJvg,3309
27
- cuqi/distribution/_joint_distribution.py,sha256=7TxDaZ7y362LfxEpD4I5Z0icdtsBmOBJGnpIkz_bYXA,15900
28
- cuqi/distribution/_laplace.py,sha256=5exLvlzJm2AgfvZ3KUSkjfwlGwwbsktBxP8z0iLMik8,1401
29
- cuqi/distribution/_lmrf.py,sha256=rdGoQ-fPe1oW6Z29P-l3woq0NX3_RxUQ2rzm1VzemNM,3290
30
- cuqi/distribution/_lognormal.py,sha256=st1Uhf67qy2Seo65hA88JQ7lkEjQkW6KxznXahF_0SU,2844
31
- cuqi/distribution/_modifiedhalfnormal.py,sha256=gB9fj10hdMvr05aa_xhAirJATLqKh1gpbdSs2pRoAVM,7267
32
- cuqi/distribution/_normal.py,sha256=UeoTtGDT7YSf4ZNo2amlVF9K-YQpYbf8q76jcRJTVFw,1914
33
- cuqi/distribution/_posterior.py,sha256=zAfL0GECxekZ2lBt1W6_LN0U_xskMwK4VNce5xAF7ig,5018
34
- cuqi/distribution/_smoothed_laplace.py,sha256=p-1Y23mYA9omwiHGkEuv3T2mwcPAAoNlCr7T8osNkjE,2925
35
- cuqi/distribution/_uniform.py,sha256=7xJmCZH_LPhuGkwEDGh-_CTtzcWKrXMOxtTJUFb7Ydo,1607
36
- cuqi/experimental/__init__.py,sha256=vhZvyMX6rl8Y0haqCzGLPz6PSUKyu75XMQbeDHqTTrw,83
37
- cuqi/experimental/mcmc/__init__.py,sha256=8Ce1mHvfbKPe0A5gCDl5Bj4ok8bvbn90LEDvfePfNT4,536
38
- cuqi/experimental/mcmc/_conjugate.py,sha256=VNPQkGity0mposcqxrx4UIeXm35EvJvZED4p2stffvA,9924
39
- cuqi/experimental/mcmc/_conjugate_approx.py,sha256=uEnY2ea9su5ivcNagyRAwpQP2gBY98sXU7N0y5hTADo,3653
40
- cuqi/experimental/mcmc/_cwmh.py,sha256=BQE7-4kbiC32TJ38rlVtfSQieoKBK5GDca3HCqHJ7zE,7135
41
- cuqi/experimental/mcmc/_direct.py,sha256=9pQS_2Qk2-ybt6m8WTfPoKetcxQ00WaTRN85-Z0FrBY,777
42
- cuqi/experimental/mcmc/_gibbs.py,sha256=6CCbasY8YJwDUnvHMKeV5pK0nr4T89BSklGaE-ZIP4I,10569
43
- cuqi/experimental/mcmc/_hmc.py,sha256=h63KT0jYq86H541hQzhHHzuLEn7vrRE_2r1o1mTEcZo,19261
44
- cuqi/experimental/mcmc/_langevin_algorithm.py,sha256=GKC_mlix3si_3J8E6I58ozh3ErB0XPmHMjV7sFyKLEQ,8200
45
- cuqi/experimental/mcmc/_laplace_approximation.py,sha256=rdiE3cMQFq6FLQcOQwPpuGIxrTAp3aoGPxMDSdeopV0,5688
46
- cuqi/experimental/mcmc/_mh.py,sha256=W5hOraHqfEW4_havtC9Ib2SinJtNV-NvxcOAENeTYUY,2841
47
- cuqi/experimental/mcmc/_pcn.py,sha256=wqJBZLuRFSwxihaI53tumAg6AWVuceLMOmXssTetd1A,3374
48
- cuqi/experimental/mcmc/_rto.py,sha256=OtzgiYCxDoTdXp7y4mkLa2upj74qadesoqHYpr11ZCg,10061
49
- cuqi/experimental/mcmc/_sampler.py,sha256=yzrbtBlqiajIHH151vocbD9SrHoCHj29wLP-IyrG3Mw,20017
50
- cuqi/experimental/mcmc/_utilities.py,sha256=kUzHbhIS3HYZRbneNBK41IogUYX5dS_bJxqEGm7TQBI,525
51
- cuqi/geometry/__init__.py,sha256=Tz1WGzZBY-QGH3c0GiyKm9XHN8MGGcnU6TUHLZkzB3o,842
52
- cuqi/geometry/_geometry.py,sha256=SDRZdiN2CIuS591lXxqgFoPWPIpwY-MHk75116QvdYY,46901
53
- cuqi/implicitprior/__init__.py,sha256=CaDQGYtmeFzN37vf3QUmKhcN9-H5lO66ZbK035k4qUw,246
54
- cuqi/implicitprior/_regularizedGMRF.py,sha256=IR9tKzNMoz-b0RKu6ahVgMx_lDNB3jZHVWFMQm6QqZk,6259
55
- cuqi/implicitprior/_regularizedGaussian.py,sha256=cQtrgzyJU2pwoK4ORGl1erKLE9VY5NqwZTiqiViDswA,12371
56
- cuqi/implicitprior/_regularizedUnboundedUniform.py,sha256=H2fTOSqYTlDiLxQ7Ya6wnpCUIkpO4qKrkTOsOPnBBeU,3483
57
- cuqi/likelihood/__init__.py,sha256=QXif382iwZ5bT3ZUqmMs_n70JVbbjxbqMrlQYbMn4Zo,1776
58
- cuqi/likelihood/_likelihood.py,sha256=z3AXAbIrv_DjOYh4jy3iDHemuIFUUJu6wdvJ5e2dgW0,6913
59
- cuqi/model/__init__.py,sha256=IcN4aZCnyp9o-8TNIoZ8vew99QQgi0EmZvnsIuR6qYI,49
60
- cuqi/model/_model.py,sha256=2MtQaahSGOVm45tvxh_xbke9vo_Aq0tpyNvLg9TK9dA,27791
61
- cuqi/operator/__init__.py,sha256=0pc9p-KPyl7KtPV0noB0ddI0CP2iYEHw5rbw49D8Njk,136
62
- cuqi/operator/_operator.py,sha256=yNwPTh7jR07AiKMbMQQ5_54EgirlKFsbq9JN1EODaQI,8856
63
- cuqi/pde/__init__.py,sha256=NyS_ZYruCvy-Yg24qKlwm3ZIX058kLNQX9bqs-xg4ZM,99
64
- cuqi/pde/_pde.py,sha256=WRkOYyIdT_T3aZepRh0aS9C5nBbUZUcHaA80iSRvgoo,12572
65
- cuqi/problem/__init__.py,sha256=JxJty4JqHTOqSG6NeTGiXRQ7OLxiRK9jvVq3lXLeIRw,38
66
- cuqi/problem/_problem.py,sha256=t8y8NNQGKHYIbXN45FWuuwuU7pMgDdD8MS6az_1Tx8k,38160
67
- cuqi/sampler/__init__.py,sha256=D-dYa0gFgIwQukP8_VKhPGmlGKXbvVo7YqaET4SdAeQ,382
68
- cuqi/sampler/_conjugate.py,sha256=ztmUR3V3qZk9zelKx48ULnmMs_zKTDUfohc256VOIe8,2753
69
- cuqi/sampler/_conjugate_approx.py,sha256=xX-X71EgxGnZooOY6CIBhuJTs3dhcKfoLnoFxX3CO2g,1938
70
- cuqi/sampler/_cwmh.py,sha256=VlAVT1SXQU0yD5ZeR-_ckWvX-ifJrMweFFdFbxdfB_k,7775
71
- cuqi/sampler/_gibbs.py,sha256=N7qcePwMkRtxINN5JF0FaMIdDCXZGqsfKjfha_KHCck,8627
72
- cuqi/sampler/_hmc.py,sha256=EUTefZir-wapoZ7OZFb5M5vayL8z6XksZRMY1BpbuXc,15027
73
- cuqi/sampler/_langevin_algorithm.py,sha256=o5EyvaR6QGAD7LKwXVRC3WwAP5IYJf5GoMVWl9DrfOA,7861
74
- cuqi/sampler/_laplace_approximation.py,sha256=u018Z5eqlcq_cIwD9yNOaA15dLQE_vUWaee5Xp8bcjg,6454
75
- cuqi/sampler/_mh.py,sha256=V5tIdn-KdfWo4J_Nbf-AH6XwKWblWUyc4BeuSikUHsE,7062
76
- cuqi/sampler/_pcn.py,sha256=F0h9-nUFtkqn-o-1s8BCsmr8V7u6R7ycoCOeeV1uhj0,8601
77
- cuqi/sampler/_rto.py,sha256=-AtMiYq4fh7pF9zVqfYjYtQbIIEGayrWyRGTj8KecfE,11518
78
- cuqi/sampler/_sampler.py,sha256=TkZ_WAS-5Q43oICa-Elc2gftsRTBd7PEDUMDZ9tTGmU,5712
79
- cuqi/samples/__init__.py,sha256=E7B9IBUsiOBr-HAKH9o3_Lqhq4KeWO87hmesHkdbwTY,30
80
- cuqi/samples/_samples.py,sha256=Pfy2piHmvZ3_fxh3c3BsQtX3mryIsDqRrqJ-Q7zw4Zo,35161
81
- cuqi/solver/__init__.py,sha256=DGl8IdUnochRXHNDEy_13o_VT0vLFY6FjMmmSH6YUkY,169
82
- cuqi/solver/_solver.py,sha256=TgezixCVf8nKGtEF9ZrkaTtAfxSs1Z8CR_cmhdTMqRw,22776
83
- cuqi/testproblem/__init__.py,sha256=DWTOcyuNHMbhEuuWlY5CkYkNDSAqhvsKmJXBLivyblU,202
84
- cuqi/testproblem/_testproblem.py,sha256=x769LwwRdJdzIiZkcQUGb_5-vynNTNALXWKato7sS0Q,52540
85
- cuqi/utilities/__init__.py,sha256=H7xpJe2UinjZftKvE2JuXtTi4DqtkR6uIezStAXwfGg,428
86
- cuqi/utilities/_get_python_variable_name.py,sha256=QwlBVj2koJRA8s8pWd554p7-ElcI7HUwY32HknaR92E,1827
87
- cuqi/utilities/_utilities.py,sha256=Jc4knn80vLoA7kgw9FzXwKVFGaNBOXiA9kgvltZU3Ao,11777
88
- CUQIpy-1.1.1.post0.dev36.dist-info/LICENSE,sha256=kJWRPrtRoQoZGXyyvu50Uc91X6_0XRaVfT0YZssicys,10799
89
- CUQIpy-1.1.1.post0.dev36.dist-info/METADATA,sha256=rFoEwQu_k2FhhCV3x8SEdJp_j-wVLNtnP198njDqVWc,18390
90
- CUQIpy-1.1.1.post0.dev36.dist-info/WHEEL,sha256=uCRv0ZEik_232NlR4YDw4Pv3Ajt5bKvMH13NUU7hFuI,91
91
- CUQIpy-1.1.1.post0.dev36.dist-info/top_level.txt,sha256=AgmgMc6TKfPPqbjV0kvAoCBN334i_Lwwojc7HE3ZwD0,5
92
- CUQIpy-1.1.1.post0.dev36.dist-info/RECORD,,
@@ -1,197 +0,0 @@
1
- import numpy as np
2
- from abc import ABC, abstractmethod
3
- import math
4
- from cuqi.experimental.mcmc import Sampler
5
- from cuqi.distribution import Posterior, Gaussian, Gamma, GMRF
6
- from cuqi.implicitprior import RegularizedGaussian, RegularizedGMRF
7
- from cuqi.utilities import get_non_default_args
8
-
9
- class Conjugate(Sampler):
10
- """ Conjugate sampler
11
-
12
- Sampler for sampling a posterior distribution which is a so-called "conjugate" distribution, i.e., where the likelihood and prior are conjugate to each other - denoted as a conjugate pair.
13
-
14
- Currently supported conjugate pairs are:
15
- - (Gaussian, Gamma) where Gamma is defined on the precision parameter of the Gaussian
16
- - (GMRF, Gamma) where Gamma is defined on the precision parameter of the GMRF
17
- - (RegularizedGaussian, Gamma) with nonnegativity constraints only and Gamma is defined on the precision parameter of the RegularizedGaussian
18
- - (RegularizedGMRF, Gamma) with nonnegativity constraints only and Gamma is defined on the precision parameter of the RegularizedGMRF
19
-
20
- Currently the Gamma distribution must be univariate.
21
-
22
- A conjugate pair defines implicitly a so-called conjugate distribution which can be sampled from directly.
23
-
24
- The conjugate parameter is the parameter that both the likelihood and prior PDF depend on.
25
-
26
- For more information on conjugacy and conjugate distributions see https://en.wikipedia.org/wiki/Conjugate_prior.
27
-
28
- For implicit regularized Gaussians see:
29
-
30
- [1] Everink, Jasper M., Yiqiu Dong, and Martin S. Andersen. "Bayesian inference with projected densities." SIAM/ASA Journal on Uncertainty Quantification 11.3 (2023): 1025-1043.
31
-
32
- """
33
-
34
- def _initialize(self):
35
- pass
36
-
37
- @Sampler.target.setter # Overwrite the target setter to set the conjugate pair
38
- def target(self, value):
39
- """ Set the target density. Runs validation of the target. """
40
- self._target = value
41
- if self._target is not None:
42
- self._set_conjugatepair()
43
- self.validate_target()
44
-
45
- def validate_target(self):
46
- self._ensure_target_is_posterior()
47
- self._conjugatepair.validate_target()
48
-
49
- def step(self):
50
- self.current_point = self._conjugatepair.sample()
51
- return 1 # Returns acceptance rate of 1
52
-
53
- def tune(self, skip_len, update_count):
54
- pass # No tuning required for conjugate sampler
55
-
56
- def _ensure_target_is_posterior(self):
57
- """ Ensure that the target is a Posterior distribution. """
58
- if not isinstance(self.target, Posterior):
59
- raise TypeError("Conjugate sampler requires a target of type Posterior")
60
-
61
- def _set_conjugatepair(self):
62
- """ Set the conjugate pair based on the likelihood and prior. This requires target to be set. """
63
- self._ensure_target_is_posterior()
64
- if isinstance(self.target.likelihood.distribution, (Gaussian, GMRF)) and isinstance(self.target.prior, Gamma):
65
- self._conjugatepair = _GaussianGammaPair(self.target)
66
- elif isinstance(self.target.likelihood.distribution, (RegularizedGaussian, RegularizedGMRF)) and isinstance(self.target.prior, Gamma):
67
- self._conjugatepair = _RegularizedGaussianGammaPair(self.target)
68
- else:
69
- raise ValueError(f"Conjugacy is not defined for likelihood {type(self.target.likelihood.distribution)} and prior {type(self.target.prior)}, in CUQIpy")
70
-
71
- def __repr__(self):
72
- msg = super().__repr__()
73
- if hasattr(self, "_conjugatepair"):
74
- msg += f"\n Conjugate pair:\n\t {type(self._conjugatepair).__name__.removeprefix('_')}"
75
- return msg
76
-
77
- class _ConjugatePair(ABC):
78
- """ Abstract base class for conjugate pairs (likelihood, prior) used in the Conjugate sampler. """
79
-
80
- def __init__(self, target):
81
- self.target = target
82
-
83
- @abstractmethod
84
- def validate_target(self):
85
- """ Validate the target distribution for the conjugate pair. """
86
- pass
87
-
88
- @abstractmethod
89
- def sample(self):
90
- """ Sample from the conjugate distribution. """
91
- pass
92
-
93
-
94
- class _GaussianGammaPair(_ConjugatePair):
95
- """ Implementation for the Gaussian-Gamma conjugate pair."""
96
-
97
- def validate_target(self):
98
- if not isinstance(self.target.likelihood.distribution, (Gaussian, GMRF)):
99
- raise ValueError("Conjugate sampler only works with a Gaussian likelihood function")
100
-
101
- if not isinstance(self.target.prior, Gamma):
102
- raise ValueError("Conjugate sampler only works with Gamma prior")
103
-
104
- if self.target.prior.dim != 1:
105
- raise ValueError("Conjugate sampler only works with univariate Gamma prior")
106
-
107
- key, value = _get_conjugate_parameter(self.target)
108
- if key == "cov":
109
- if not _check_conjugate_parameter_is_scalar_reciprocal(value):
110
- raise ValueError("Gaussian-Gamma conjugate pair defined via covariance requires `cov` for the `Gaussian` to be: lambda x : 1.0/x for the conjugate parameter")
111
- elif key == "prec":
112
- if not _check_conjugate_parameter_is_scalar_identity(value):
113
- raise ValueError("Gaussian-Gamma conjugate pair defined via precision requires `prec` for the `Gaussian` to be: lambda x : x for the conjugate parameter")
114
- else:
115
- raise ValueError("Conjugate sampler for Gaussian likelihood functions only works when conjugate parameter is defined via covariance or precision")
116
-
117
- def sample(self):
118
- # Extract variables
119
- b = self.target.likelihood.data # mu
120
- m = len(b) # n
121
- Ax = self.target.likelihood.distribution.mean # x_i
122
- L = self.target.likelihood.distribution(np.array([1])).sqrtprec # L
123
- alpha = self.target.prior.shape # alpha
124
- beta = self.target.prior.rate # beta
125
-
126
- # Create Gamma distribution and sample
127
- dist = Gamma(shape=m/2 + alpha, rate=.5 * np.linalg.norm(L @ (Ax - b))**2 + beta)
128
-
129
- return dist.sample()
130
-
131
-
132
- class _RegularizedGaussianGammaPair(_ConjugatePair):
133
- """Implementation for the Regularized Gaussian-Gamma conjugate pair."""
134
-
135
- def validate_target(self):
136
- if not isinstance(self.target.likelihood.distribution, (RegularizedGaussian, RegularizedGMRF)):
137
- raise ValueError("Conjugate sampler only works with a Regularized Gaussian likelihood function")
138
-
139
- if not isinstance(self.target.prior, Gamma):
140
- raise ValueError("Conjugate sampler only works with Gamma prior")
141
-
142
- if self.target.prior.dim != 1:
143
- raise ValueError("Conjugate sampler only works with univariate Gamma prior")
144
-
145
- if self.target.likelihood.distribution.preset not in ["nonnegativity"]:
146
- raise ValueError("Conjugate sampler only works with implicit regularized Gaussian likelihood with nonnegativity constraints")
147
-
148
- key, value = _get_conjugate_parameter(self.target)
149
- if key == "cov":
150
- if not _check_conjugate_parameter_is_scalar_reciprocal(value):
151
- raise ValueError("Regularized Gaussian-Gamma conjugate pair defined via covariance requires cov: lambda x : 1.0/x for the conjugate parameter")
152
- elif key == "prec":
153
- if not _check_conjugate_parameter_is_scalar_identity(value):
154
- raise ValueError("Regularized Gaussian-Gamma conjugate pair defined via precision requires prec: lambda x : x for the conjugate parameter")
155
- else:
156
- raise ValueError("Conjugate sampler for a Regularized Gaussian likelihood functions only works when conjugate parameter is defined via covariance or precision")
157
-
158
- def sample(self):
159
- # Extract variables
160
- b = self.target.likelihood.data # mu
161
- m = np.count_nonzero(b) # n
162
- Ax = self.target.likelihood.distribution.mean # x_i
163
- L = self.target.likelihood.distribution(np.array([1])).sqrtprec # L
164
- alpha = self.target.prior.shape # alpha
165
- beta = self.target.prior.rate # beta
166
-
167
- # Create Gamma distribution and sample
168
- dist = Gamma(shape=m/2 + alpha, rate=.5 * np.linalg.norm(L @ (Ax - b))**2 + beta)
169
-
170
- return dist.sample()
171
-
172
- def _get_conjugate_parameter(target):
173
- """Extract the conjugate parameter name (e.g. d), and returns the mutable variable that is defined by the conjugate parameter, e.g. cov and its value e.g. lambda d:1/d"""
174
- par_name = target.prior.name
175
- mutable_likelihood_vars = target.likelihood.distribution.get_mutable_variables()
176
-
177
- found_parameter_pairs = []
178
-
179
- for var_key in mutable_likelihood_vars:
180
- attr = getattr(target.likelihood.distribution, var_key)
181
- if callable(attr) and par_name in get_non_default_args(attr):
182
- found_parameter_pairs.append((var_key, attr))
183
- if len(found_parameter_pairs) == 1:
184
- return found_parameter_pairs[0]
185
- elif len(found_parameter_pairs) > 1:
186
- raise ValueError(f"Multiple references of parameter {par_name} found in likelihood function for conjugate sampler with target {target}. This is not supported.")
187
- else:
188
- raise ValueError(f"Unable to find conjugate parameter {par_name} in likelihood function for conjugate sampler with target {target}")
189
-
190
- def _check_conjugate_parameter_is_scalar_identity(f):
191
- """Tests whether a function (scalar to scalar) is the identity (lambda x: x)."""
192
- test_values = [1.0, 10.0, 100.0]
193
- return all(np.allclose(f(x), x) for x in test_values)
194
-
195
- def _check_conjugate_parameter_is_scalar_reciprocal(f):
196
- """Tests whether a function (scalar to scalar) is the reciprocal (lambda x : 1.0/x)."""
197
- return all(math.isclose(f(x), 1.0 / x) for x in [1.0, 10.0, 100.0])