CUQIpy 1.3.0.post0.dev86__tar.gz → 1.3.0.post0.dev237__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.dev86 → cuqipy-1.3.0.post0.dev237}/CUQIpy.egg-info/PKG-INFO +1 -1
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/PKG-INFO +1 -1
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/_version.py +3 -3
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/geometry/_productgeometry.py +3 -3
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_rto.py +23 -15
- cuqipy-1.3.0.post0.dev237/cuqi/model/_model.py +1500 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/pde/_pde.py +14 -10
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/solver/_solver.py +6 -2
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/testproblem/_testproblem.py +2 -3
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_distribution.py +1 -1
- cuqipy-1.3.0.post0.dev237/tests/test_model.py +1941 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_solver.py +12 -4
- cuqipy-1.3.0.post0.dev86/cuqi/model/_model.py +0 -796
- cuqipy-1.3.0.post0.dev86/tests/test_model.py +0 -516
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/CUQIpy.egg-info/SOURCES.txt +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/CUQIpy.egg-info/dependency_links.txt +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/CUQIpy.egg-info/requires.txt +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/CUQIpy.egg-info/top_level.txt +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/LICENSE +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/README.md +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/_messages.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/array/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/array/_array.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/config.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/data/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/data/_data.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/data/astronaut.npz +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/data/camera.npz +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/data/cat.npz +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/data/cookie.png +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/data/satellite.mat +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/density/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/density/_density.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/diagnostics.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_beta.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_cauchy.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_cmrf.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_custom.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_distribution.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_gamma.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_gaussian.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_gmrf.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_inverse_gamma.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_joint_distribution.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_laplace.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_lmrf.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_lognormal.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_modifiedhalfnormal.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_normal.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_posterior.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_smoothed_laplace.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_truncated_normal.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/distribution/_uniform.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/algebra/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/algebra/_ast.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/algebra/_orderedset.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/algebra/_randomvariable.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/geometry/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_conjugate.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_conjugate_approx.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_cwmh.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_direct.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_gibbs.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_hmc.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_langevin_algorithm.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_laplace_approximation.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_mh.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_pcn.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_sampler.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/experimental/mcmc/_utilities.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/geometry/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/geometry/_geometry.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/implicitprior/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/implicitprior/_regularizedGMRF.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/implicitprior/_regularizedGaussian.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/implicitprior/_regularizedUnboundedUniform.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/implicitprior/_restorator.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/likelihood/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/likelihood/_likelihood.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/model/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/operator/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/operator/_operator.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/pde/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/problem/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/problem/_problem.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_conjugate.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_conjugate_approx.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_cwmh.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_gibbs.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_hmc.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_langevin_algorithm.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_laplace_approximation.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_mh.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_pcn.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_rto.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/sampler/_sampler.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/samples/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/samples/_samples.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/solver/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/testproblem/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/utilities/__init__.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/utilities/_get_python_variable_name.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/cuqi/utilities/_utilities.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/pyproject.toml +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/requirements.txt +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/setup.cfg +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/setup.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_MRFs.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_abstract_distribution_density.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_bayesian_inversion.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_density.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_distributions_shape.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_geometry.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_implicit_priors.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_joint_distribution.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_likelihood.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_pde.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_posterior.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_problem.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_sampler.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_samples.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_testproblem.py +0 -0
- {cuqipy-1.3.0.post0.dev86 → cuqipy-1.3.0.post0.dev237}/tests/test_utilities.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: CUQIpy
|
|
3
|
-
Version: 1.3.0.post0.
|
|
3
|
+
Version: 1.3.0.post0.dev237
|
|
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.4
|
|
2
2
|
Name: CUQIpy
|
|
3
|
-
Version: 1.3.0.post0.
|
|
3
|
+
Version: 1.3.0.post0.dev237
|
|
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-05-15T09:06:20+0300",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "1.3.0.post0.
|
|
14
|
+
"full-revisionid": "b9a5dd37abfe2ee51d5594630de54dd3469bfeca",
|
|
15
|
+
"version": "1.3.0.post0.dev237"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -172,10 +172,10 @@ class _ProductGeometry(Geometry):
|
|
|
172
172
|
return tuple(funvecs)
|
|
173
173
|
|
|
174
174
|
|
|
175
|
-
def __repr__(self) -> str:
|
|
175
|
+
def __repr__(self, pad="") -> str:
|
|
176
176
|
"""Representation of the product geometry."""
|
|
177
177
|
string = "{}(".format(self.__class__.__name__) + "\n"
|
|
178
178
|
for g in self.geometries:
|
|
179
|
-
string += "
|
|
180
|
-
string += ")"
|
|
179
|
+
string += pad + " {}\n".format(g.__repr__())
|
|
180
|
+
string += pad + ")"
|
|
181
181
|
return string
|
|
@@ -3,7 +3,7 @@ from scipy.linalg.interpolative import estimate_spectral_norm
|
|
|
3
3
|
from scipy.sparse.linalg import LinearOperator as scipyLinearOperator
|
|
4
4
|
import numpy as np
|
|
5
5
|
import cuqi
|
|
6
|
-
from cuqi.solver import CGLS, FISTA, ADMM, ScipyLinearLSQ
|
|
6
|
+
from cuqi.solver import CGLS, FISTA, ADMM, ScipyLinearLSQ, ScipyMinimizer
|
|
7
7
|
from cuqi.experimental.mcmc import Sampler
|
|
8
8
|
|
|
9
9
|
|
|
@@ -167,6 +167,7 @@ class RegularizedLinearRTO(LinearRTO):
|
|
|
167
167
|
ADMM: [2] Boyd et al. "Distributed optimization and statistical learning via the alternating direction method of multipliers."Foundations and Trends® in Machine learning, 2011.
|
|
168
168
|
Used when prior.proximal is a list of penalty terms.
|
|
169
169
|
ScipyLinearLSQ: Wrapper for Scipy's lsq_linear for the Trust Region Reflective algorithm. Optionally used when the constraint is either "nonnegativity" or "box".
|
|
170
|
+
ScipyMinimizer: Wrapper for Scipy's minimize. Optionally used when the constraint is either "nonnegativity" or "box".
|
|
170
171
|
|
|
171
172
|
Parameters
|
|
172
173
|
------------
|
|
@@ -177,7 +178,7 @@ class RegularizedLinearRTO(LinearRTO):
|
|
|
177
178
|
Initial point for the sampler. *Optional*.
|
|
178
179
|
|
|
179
180
|
maxit : int
|
|
180
|
-
Maximum number of iterations of the FISTA/ADMM/ScipyLinearLSQ solver. *Optional*.
|
|
181
|
+
Maximum number of iterations of the FISTA/ADMM/ScipyLinearLSQ/ScipyMinimizer solver. *Optional*.
|
|
181
182
|
|
|
182
183
|
inner_max_it : int
|
|
183
184
|
Maximum number of iterations of the CGLS solver used within the ADMM solver. *Optional*.
|
|
@@ -191,7 +192,7 @@ class RegularizedLinearRTO(LinearRTO):
|
|
|
191
192
|
See [2] or `cuqi.solver.ADMM`
|
|
192
193
|
|
|
193
194
|
abstol : float
|
|
194
|
-
Absolute tolerance of the FISTA/ScipyLinearLSQ solver. *Optional*.
|
|
195
|
+
Absolute tolerance of the FISTA/ScipyLinearLSQ/ScipyMinimizer solver. *Optional*.
|
|
195
196
|
|
|
196
197
|
inner_abstol : float
|
|
197
198
|
Tolerance parameter for ScipyLinearLSQ's inner solve of the unbounded least-squares problem. *Optional*.
|
|
@@ -200,7 +201,7 @@ class RegularizedLinearRTO(LinearRTO):
|
|
|
200
201
|
If True, FISTA is used as solver, otherwise ISTA is used. *Optional*.
|
|
201
202
|
|
|
202
203
|
solver : string
|
|
203
|
-
|
|
204
|
+
Options are "FISTA" (default for a single constraint or regularization), "ADMM" (default and the only option for multiple constraints or regularizations), "ScipyLinearLSQ" and "ScipyMinimizer". Note "ScipyLinearLSQ" and "ScipyMinimizer" can only be used with `RegularizedGaussian` of a single `box` or `nonnegativity` constraint. *Optional*.
|
|
204
205
|
|
|
205
206
|
callback : callable, optional
|
|
206
207
|
A function that will be called after each sampling step. It can be useful for monitoring the sampler during sampling.
|
|
@@ -234,11 +235,11 @@ class RegularizedLinearRTO(LinearRTO):
|
|
|
234
235
|
|
|
235
236
|
@solver.setter
|
|
236
237
|
def solver(self, value):
|
|
237
|
-
if value == "ScipyLinearLSQ":
|
|
238
|
+
if value == "ScipyLinearLSQ" or value == "ScipyMinimizer":
|
|
238
239
|
if (self.target.prior.preset["constraint"] == "nonnegativity" or self.target.prior.preset["constraint"] == "box"):
|
|
239
240
|
self._solver = value
|
|
240
241
|
else:
|
|
241
|
-
raise ValueError("ScipyLinearLSQ only
|
|
242
|
+
raise ValueError("ScipyLinearLSQ and ScipyMinimizer only support RegularizedGaussian with box or nonnegativity constraint.")
|
|
242
243
|
else:
|
|
243
244
|
self._solver = value
|
|
244
245
|
|
|
@@ -281,15 +282,22 @@ class RegularizedLinearRTO(LinearRTO):
|
|
|
281
282
|
sim = ADMM(self.M, y, self.proximal,
|
|
282
283
|
self.current_point, self.penalty_parameter, maxit = self.maxit, inner_max_it = self.inner_max_it, adaptive = self.adaptive)
|
|
283
284
|
elif self.solver == "ScipyLinearLSQ":
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
285
|
+
A_op = sp.sparse.linalg.LinearOperator((sum([llh.distribution.dim for llh in self.likelihoods])+self.target.prior.dim, self.target.prior.dim),
|
|
286
|
+
matvec=lambda x: self.M(x, 1),
|
|
287
|
+
rmatvec=lambda x: self.M(x, 2)
|
|
288
|
+
)
|
|
289
|
+
sim = ScipyLinearLSQ(A_op, y, self.target.prior._box_bounds,
|
|
290
|
+
max_iter = self.maxit,
|
|
291
|
+
lsmr_maxiter = self.inner_max_it,
|
|
292
|
+
tol = self.abstol,
|
|
293
|
+
lsmr_tol = self.inner_abstol)
|
|
294
|
+
elif self.solver == "ScipyMinimizer":
|
|
295
|
+
# Adapt bounds format, as scipy.minimize requires a bounds format
|
|
296
|
+
# different than that in scipy.lsq_linear.
|
|
297
|
+
bounds = [(self.target.prior._box_bounds[0][i], self.target.prior._box_bounds[1][i]) for i in range(self.target.prior.dim)]
|
|
298
|
+
# Note that the objective function is defined as 0.5*||Mx-y||^2,
|
|
299
|
+
# and the corresponding gradient (gradfunc) is given by M^T(Mx-y).
|
|
300
|
+
sim = ScipyMinimizer(lambda x: 0.5*np.sum((self.M(x, 1)-y)**2), self.current_point, gradfunc=lambda x: self.M(self.M(x, 1) - y, 2), bounds=bounds, tol=self.abstol, options={"maxiter": self.maxit})
|
|
293
301
|
else:
|
|
294
302
|
raise ValueError("Choice of solver not supported.")
|
|
295
303
|
|