Commit 9b47dc10 by Philipp Arras

### nifty7 -> nifty8

parent 3a83451d
 ... ... @@ -224,7 +224,7 @@ Thus, only the gradient of the KL is needed with respect to this, which can be e We stochastically estimate the KL-divergence and gradients with a set of samples drawn from the approximate posterior distribution. The particular structure of the covariance allows us to draw independent samples solving a certain system of equations. This KL-divergence for MGVI is implemented by :func:~nifty7.minimization.kl_energies.MetricGaussianKL within NIFTy7. :func:~nifty8.minimization.kl_energies.MetricGaussianKL within NIFTy7. Note that MGVI typically provides only a lower bound on the variance. ... ... @@ -254,7 +254,7 @@ where :math:\delta denotes the Kronecker-delta. GeoVI obtains the optimal expansion point :math:\bar{\xi} such that :math:\mathcal{Q}_{\bar{\xi}} matches the posterior as good as possible. Analogous to the MGVI algorithm, :math:\bar{\xi} is obtained by minimization of the KL-divergence between :math:\mathcal{P} and :math:\mathcal{Q}_{\bar{\xi}} w.r.t. :math:\bar{\xi}. Furthermore the KL is represented as a stochastic estimate using a set of samples drawn from :math:\mathcal{Q}_{\bar{\xi}} which is implemented in NIFTy7 via :func:~nifty7.minimization.kl_energies.GeoMetricKL. Furthermore the KL is represented as a stochastic estimate using a set of samples drawn from :math:\mathcal{Q}_{\bar{\xi}} which is implemented in NIFTy7 via :func:~nifty8.minimization.kl_energies.GeoMetricKL. A visual comparison of the MGVI and GeoVI algorithm can be found in variational_inference_visualized.py _. ... ...
 ... ... @@ -33,4 +33,4 @@ Contents installation code citations Package Documentation Package Documentation
 ... ... @@ -148,7 +148,7 @@ A visualisation of this can be seen in figure 2, which displays the MAP inferenc Implementation in NIFTy ....................... .. currentmodule:: nifty7 .. currentmodule:: nifty8 Most codes in NIFTy will contain the description of a measurement process or, more generally, a log-likelihood. ... ...
nifty7 deleted 120000 → 0
 src/ \ No newline at end of file
nifty8 0 → 120000
 src \ No newline at end of file
 ... ... @@ -27,20 +27,20 @@ def write_version(): except FileNotFoundError: print("Could not determine version string from git history") res = "unknown" with open("nifty7/git_version.py", "w") as file: with open("nifty8/git_version.py", "w") as file: file.write('gitversion = "{}"\n'.format(res)) write_version() exec(open('nifty7/version.py').read()) exec(open('nifty8/version.py').read()) setup(name="nifty7", setup(name="nifty8", version=__version__, author="Theo Steininger, Martin Reinecke", author_email="martin@mpa-garching.mpg.de", description="Numerical Information Field Theory", url="http://www.mpa-garching.mpg.de/ift/nifty/", packages=find_packages(include=["nifty7", "nifty7.*"]), packages=find_packages(include=["nifty8", "nifty8.*"]), zip_safe=True, license="GPLv3", setup_requires=['scipy>=1.4.1', 'numpy>=1.17'], ... ...
 ... ... @@ -107,4 +107,4 @@ from .operator_spectrum import operator_spectrum from .operator_tree_optimiser import optimise_operator # We deliberately don't set __all__ here, because we don't want people to do a # "from nifty7 import *"; that would swamp the global namespace. # "from nifty8 import *"; that would swamp the global namespace.
 ... ... @@ -24,7 +24,7 @@ class GLSpace(StructuredDomain): """Represents a 2-sphere with Gauss-Legendre pixelization. Its harmonic partner domain is the :class:~nifty7.domains.lm_space.LMSpace. :class:~nifty8.domains.lm_space.LMSpace. Parameters ---------- ... ...
 ... ... @@ -24,7 +24,7 @@ class HPSpace(StructuredDomain): """Represents 2-sphere with HEALPix discretization. Its harmonic partner domain is the :class:~nifty7.domains.lm_space.LMSpace. :class:~nifty8.domains.lm_space.LMSpace. Parameters ---------- ... ...
 ... ... @@ -24,8 +24,8 @@ from .structured_domain import StructuredDomain class LMSpace(StructuredDomain): """Represents a set of spherical harmonic coefficients. Its harmonic partner spaces are :class:~nifty7.domains.hp_space.HPSpace and :class:~nifty7.domains.gl_space.GLSpace. Its harmonic partner spaces are :class:~nifty8.domains.hp_space.HPSpace and :class:~nifty8.domains.gl_space.GLSpace. Parameters ---------- ... ... @@ -155,7 +155,7 @@ class LMSpace(StructuredDomain): return self._mmax def get_default_codomain(self): """Returns a :class:~nifty7.domains.gl_space.GLSpace object, which is """Returns a :class:~nifty8.domains.gl_space.GLSpace object, which is capable of storing an accurate representation of data residing on self. ... ...
 ... ... @@ -21,7 +21,7 @@ from .domain import Domain class UnstructuredDomain(Domain): """A :class:~nifty7.domains.domain.Domain subclass for spaces with no """A :class:~nifty8.domains.domain.Domain subclass for spaces with no associated geometry. Typically used for data spaces. ... ...
 ... ... @@ -662,10 +662,10 @@ class Field(Operator): return np.sqrt(self.s_var()) def __repr__(self): return "" return "" def __str__(self): return "nifty7.Field instance\n- domain = " + \ return "nifty8.Field instance\n- domain = " + \ self._domain.__str__() + \ "\n- val = " + repr(self._val) ... ...
 ... ... @@ -392,11 +392,11 @@ class CorrelatedFieldMaker: applying fluctuations around this offset is parametrized. The resulting correlated field model operator has a :class:~nifty7.multi_domain.MultiDomain as its domain and :class:~nifty8.multi_domain.MultiDomain as its domain and expects its input values to be univariately gaussian. The target of the constructed operator will be a :class:~nifty7.domain_tuple.DomainTuple containing the :class:~nifty8.domain_tuple.DomainTuple containing the target_subdomains of the added fluctuations in the order of the add_fluctuations calls. ... ... @@ -405,7 +405,7 @@ class CorrelatedFieldMaker: An operator representing an array of correlated field models can be constructed by setting the total_N parameter of. It will have an :class:~nifty7.domains.unstructured_domain.UnstructuredDomain have an :class:~nifty8.domains.unstructured_domain.UnstructuredDomain of shape (total_N,) prepended to its target domain and represent total_N correlated fields simulataneously. The degree of information sharing between the correlated field ... ... @@ -464,8 +464,8 @@ class CorrelatedFieldMaker: Parameters ---------- target_subdomain : :class:~nifty7.domain.Domain, \ :class:~nifty7.domain_tuple.DomainTuple target_subdomain : :class:~nifty8.domain.Domain, \ :class:~nifty8.domain_tuple.DomainTuple Target subdomain on which the correlation structure defined in this call should hold. fluctuations : tuple of float (mean, std) ... ... @@ -494,8 +494,8 @@ class CorrelatedFieldMaker: field model and the second one is used for the third field model. *If not given*, use the same power spectrum model for all constructed field models. harmonic_partner : :class:~nifty7.domain.Domain, \ :class:~nifty7.domain_tuple.DomainTuple harmonic_partner : :class:~nifty8.domain.Domain, \ :class:~nifty8.domain_tuple.DomainTuple In which harmonic space to define the power spectrum """ if harmonic_partner is None: ... ... @@ -576,8 +576,8 @@ class CorrelatedFieldMaker: Parameters ---------- target_subdomain : :class:~nifty7.domains.domain.Domain, \ :class:~nifty7.domain_tuple.DomainTuple target_subdomain : :class:~nifty8.domains.domain.Domain, \ :class:~nifty8.domain_tuple.DomainTuple Target subdomain on which the correlation structure defined in this call should hold. scale : tuple of float (mean, std) ... ... @@ -597,8 +597,8 @@ class CorrelatedFieldMaker: Whether to implicitly adjust the scale parameter of the Matern kernel and the zero-mode of the overall model for the volume in the target subdomain or assume them to be adjusted already. harmonic_partner : :class:~nifty7.domains.domain.Domain, \ :class:~nifty7.domain_tuple.DomainTuple harmonic_partner : :class:~nifty8.domains.domain.Domain, \ :class:~nifty8.domain_tuple.DomainTuple Harmonic space in which to define the power spectrum. Notes ... ... @@ -607,7 +607,7 @@ class CorrelatedFieldMaker: unit-less power spectrum, i.e. the parameters are assumed to be agnostic to changes in the volume of the target subdomain. This is in steep contrast to the non-parametric amplitude operator in :class:~nifty7.library.correlated_fields.CorrelatedFieldMaker.add_fluctuations. :class:~nifty8.library.correlated_fields.CorrelatedFieldMaker.add_fluctuations. Up to the Matern amplitude only works for total_N == 0. """ ... ... @@ -644,7 +644,7 @@ class CorrelatedFieldMaker: offset_mean : float Mean offset from zero of the correlated field to be made. offset_std : tuple of float, instance of \ :class:~nifty7.operators.operator.Operator acting on scalar \ :class:~nifty8.operators.operator.Operator acting on scalar \ domain, scalar or None Mean standard deviation and standard deviation of the standard deviation of the offset. No, this is not a word duplication. ... ...
 ... ... @@ -44,11 +44,11 @@ def SimpleCorrelatedField( prefix="", harmonic_partner=None, ): """Simplified version of :class:~nifty7.library.correlated_fields.CorrelatedFieldMaker. """Simplified version of :class:~nifty8.library.correlated_fields.CorrelatedFieldMaker. Assumes total_N = 0, dofdex = None and the presence of only one power spectrum, i.e. only one call of :func:~nifty7.library.correlated_fields.CorrelatedFieldMaker.add_fluctuations. :func:~nifty8.library.correlated_fields.CorrelatedFieldMaker.add_fluctuations. """ target = DomainTuple.make(target) if len(target) != 1: ... ...
 ... ... @@ -27,7 +27,7 @@ class ConjugateGradient(Minimizer): Parameters ---------- controller : :py:class:nifty7.IterationController controller : :py:class:nifty8.IterationController Object that decides when to terminate the minimization. nreset : int every nreset CG steps the residual will be recomputed accurately ... ...
 ... ... @@ -293,7 +293,7 @@ def optimise_operator(op): ----- Operators are compared only by id, so best results are achieved when the following code >>> from nifty7 import UniformOperator, DomainTuple >>> from nifty8 import UniformOperator, DomainTuple >>> uni1 = UniformOperator(DomainTuple.scalar_domain() >>> uni2 = UniformOperator(DomainTuple.scalar_domain() >>> op = (uni1 + uni2)*(uni1 + uni2) ... ...
 ... ... @@ -95,7 +95,7 @@ class LikelihoodEnergyOperator(EnergyOperator): def get_metric_at(self, x): """Compute the Fisher information metric for a LikelihoodEnergyOperator at x using the Jacobian of the coordinate transformation given by :func:~nifty7.operators.operator.Operator.get_transformation. """ :func:~nifty8.operators.operator.Operator.get_transformation. """ dtp, f = self.get_transformation() ch = None if dtp is not None: ... ...
 ... ... @@ -41,7 +41,7 @@ def NormalTransform(mean, sigma, key, N_copies=0): N_copies : integer If == 0, target will be a scalar field. If >= 1, target will be an :class:~nifty7.domains.unstructured_domain.UnstructuredDomain. :class:~nifty8.domains.unstructured_domain.UnstructuredDomain. """ if N_copies == 0: domain = DomainTuple.scalar_domain() ... ... @@ -71,7 +71,7 @@ def LognormalTransform(mean, sigma, key, N_copies): N_copies : integer If == 0, target will be a scalar field. If >= 1, target will be an :class:~nifty7.domains.unstructured_domain.UnstructuredDomain. :class:~nifty8.domains.unstructured_domain.UnstructuredDomain. """ logmean, logsigma = lognormal_moments(mean, sigma, N_copies) return NormalTransform(logmean, logsigma, key, N_copies).ptw("exp")
 ... ... @@ -111,7 +111,7 @@ class Operator(metaclass=NiftyMeta): """The coordinate transformation that maps into a coordinate system in which the metric of a likelihood is the Euclidean metric. It is None, except for instances of :class:~nifty7.operators.energy_operators.LikelihoodEnergyOperator or :class:~nifty8.operators.energy_operators.LikelihoodEnergyOperator or (nested) sums thereof. Returns ... ...
 ... ... @@ -21,7 +21,7 @@ Some remarks on NIFTy's treatment of random numbers NIFTy makes use of the Generator and SeedSequence classes introduced to numpy.random in numpy 1.17. On first load of the nifty7.random module, it creates a stack of On first load of the nifty8.random module, it creates a stack of SeedSequence objects which contains a single SeedSequence with a fixed seed, and also a stack of Generator objects, which contains a single generator derived from the above seed sequence. Without user intervention, this generator ... ... @@ -87,7 +87,7 @@ def _fix_seed(seed): # Stack of SeedSequence objects. Will always start out with a well-defined # default. Users can change the "random seed" used by a calculation by pushing # a different SeedSequence before invoking any other nifty7.random calls # a different SeedSequence before invoking any other nifty8.random calls _sseq = [np.random.SeedSequence(_fix_seed(42))] # Stack of random number generators associated with _sseq. _rng = [np.random.default_rng(_sseq[-1])] ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment