ift.rst 13.8 KB
 Martin Reinecke committed Jan 23, 2018 1 2 3 4 5 6 IFT -- Information Field Theory =============================== Theoretical Background ----------------------  Martin Reinecke committed Feb 01, 2019 7 Information Field Theory _ [1]_ (IFT) is information theory, the logic of reasoning under uncertainty, applied to fields.  Martin Reinecke committed Jan 22, 2019 8 9 10 11 A field can be any quantity defined over some space, e.g. the air temperature over Europe, the magnetic field strength in the Milky Way, or the matter density in the Universe. IFT describes how data and knowledge can be used to infer field properties. Mathematically it is a statistical field theory and exploits many of the tools developed for such. Practically, it is a framework for signal processing and image reconstruction.  Martin Reinecke committed Jan 23, 2018 12   Martin Reinecke committed Jan 22, 2019 13 14 IFT is fully Bayesian. How else could infinitely many field degrees of freedom be constrained by finite data?  Martin Reinecke committed Jan 23, 2018 15   Martin Reinecke committed Jan 22, 2019 16 17 18 19 20 There is a full toolbox of methods that can be used, like the classical approximation (= Maximum a posteriori = MAP), effective action (= Variational Bayes = VI), Feynman diagrams, renormalization, and more. IFT reproduces many known well working algorithms, which is reassuring. Also, there were certainly previous works in a similar spirit. Anyhow, in many cases IFT provides novel rigorous ways to extract information from data. NIFTy comes with reimplemented MAP and VI estimators.  Martin Reinecke committed Jan 23, 2018 21   Martin Reinecke committed Jan 16, 2019 22 .. tip:: *In-a-nutshell introductions to information field theory* can be found in [2]_, [3]_, [4]_, and [5]_, with the latter probably being the most didactical.  Martin Reinecke committed Jan 23, 2018 23   Martin Reinecke committed Feb 01, 2019 24 .. [1] T.A. Enßlin et al. (2009), "Information field theory for cosmological perturbation reconstruction and nonlinear signal analysis", PhysRevD.80.105005, 09/2009; [arXiv:0806.3474] _  Martin Reinecke committed Jan 23, 2018 25   Martin Reinecke committed Feb 01, 2019 26 .. [2] T.A. Enßlin (2013), "Information field theory", proceedings of MaxEnt 2012 -- the 32nd International Workshop on Bayesian Inference and Maximum Entropy Methods in Science and Engineering; AIP Conference Proceedings, Volume 1553, Issue 1, p.184; [arXiv:1301.2556] _  Torsten Ensslin committed Jan 04, 2019 27   Martin Reinecke committed Feb 01, 2019 28 .. [3] T.A. Enßlin (2014), "Astrophysical data analysis with information field theory", AIP Conference Proceedings, Volume 1636, Issue 1, p.49; [arXiv:1405.7701] _  Martin Reinecke committed Jan 23, 2018 29   Martin Reinecke committed Jan 16, 2019 30 .. [4] Wikipedia contributors (2018), "Information field theory" _, Wikipedia, The Free Encyclopedia.  Torsten Ensslin committed Jan 04, 2019 31   Martin Reinecke committed Feb 01, 2019 32 .. [5] T.A. Enßlin (2019), "Information theory for fields", accepted by Annalen der Physik; [DOI] _, [arXiv:1804.03350] _  Torsten Ensslin committed Jan 17, 2019 33   Martin Reinecke committed Jan 23, 2018 34 35 36   Martin Reinecke committed Jan 16, 2019 37 Free Theory & Implicit Operators  Torsten Ensslin committed Jan 04, 2019 38 39 --------------------------------  Torsten Ensslin committed Jan 05, 2019 40 A free IFT appears when the signal field :math:{s} and the noise :math:{n} of the data :math:{d} are independent, zero-centered Gaussian processes of kown covariances :math:{S} and :math:{N}, respectively,  Torsten Ensslin committed Jan 04, 2019 41 42 43 44 45  .. math:: \mathcal{P}(s,n) = \mathcal{G}(s,S)\,\mathcal{G}(n,N),  Martin Reinecke committed Jan 16, 2019 46 and the measurement equation is linear in both signal and noise,  Torsten Ensslin committed Jan 04, 2019 47 48 49 50 51  .. math:: d= R\, s + n,  Martin Reinecke committed Jan 16, 2019 52 with :math:{R} being the measurement response, which maps the continous signal field into the discrete data space.  Torsten Ensslin committed Jan 04, 2019 53 54  This is called a free theory, as the information Hamiltonian  Philipp Arras committed Jan 09, 2019 55   Torsten Ensslin committed Jan 04, 2019 56 57 58 59 .. math:: \mathcal{H}(d,s)= -\log \mathcal{P}(d,s)= \frac{1}{2} s^\dagger S^{-1} s + \frac{1}{2} (d-R\,s)^\dagger N^{-1} (d-R\,s) + \mathrm{const}  Martin Reinecke committed Jan 16, 2019 60 is only of quadratic order in :math:{s}, which leads to a linear relation between the data and the posterior mean field.  Torsten Ensslin committed Jan 04, 2019 61   Martin Reinecke committed Jan 16, 2019 62 In this case, the posterior is  Torsten Ensslin committed Jan 04, 2019 63 64 65 66 67  .. math:: \mathcal{P}(s|d) = \mathcal{G}(s-m,D)  Martin Reinecke committed Jan 16, 2019 68 with  Torsten Ensslin committed Jan 04, 2019 69 70 71 72 73 74 75 76 77 78 79  .. math:: m = D\, j the posterior mean field, .. math:: D = \left( S^{-1} + R^\dagger N^{-1} R\right)^{-1}  Martin Reinecke committed Jan 16, 2019 80 the posterior covariance operator, and  Torsten Ensslin committed Jan 04, 2019 81 82 83 84 85  .. math:: j = R^\dagger N^{-1} d  Martin Reinecke committed Jan 22, 2019 86 87 the information source. The operation in :math:{m = D\,R^\dagger N^{-1} d} is also called the generalized Wiener filter.  Torsten Ensslin committed Jan 04, 2019 88   Martin Reinecke committed Jan 16, 2019 89 NIFTy permits to define the involved operators :math:{R}, :math:{R^\dagger}, :math:{S}, and :math:{N} implicitly, as routines that can be applied to vectors, but which do not require the explicit storage of the matrix elements of the operators.  Torsten Ensslin committed Jan 04, 2019 90   Martin Reinecke committed Jan 22, 2019 91 92 93 Some of these operators are diagonal in harmonic (Fourier) basis, and therefore only require the specification of a (power) spectrum and :math:{S= F\,\widehat{P_s} F^\dagger}. Here :math:{F = \mathrm{HarmonicTransformOperator}}, :math:{\widehat{P_s} = \mathrm{DiagonalOperator}(P_s)}, and :math:{P_s(k)} is the power spectrum of the process that generated :math:{s} as a function of the (absolute value of the) harmonic (Fourier) space coordinate :math:{k}. For those, NIFTy can easily also provide inverse operators, as :math:{S^{-1}= F\,\widehat{\frac{1}{P_s}} F^\dagger} in case :math:{F} is unitary, :math:{F^\dagger=F^{-1}}.  Torsten Ensslin committed Jan 05, 2019 94 95  These implicit operators can be combined into new operators, e.g. to :math:{D^{-1} = S^{-1} + R^\dagger N^{-1} R}, as well as their inverses, e.g. :math:{D = \left( D^{-1} \right)^{-1}}.  Torsten Ensslin committed Jan 04, 2019 96 97 The invocation of an inverse operator applied to a vector might trigger the execution of a numerical linear algebra solver.  Martin Reinecke committed Jan 22, 2019 98 Thus, when NIFTy calculates :math:{m = D\, j}, it actually solves :math:{D^{-1} m = j} for :math:{m} behind the scenes.  Martin Reinecke committed Jan 22, 2019 99 100 101 The advantage of implicit operators to explicit matrices is the reduced memory requirements. The reconstruction of only a Megapixel image would otherwithe require the storage and processing of matrices with sizes of several Terabytes. Larger images could not be dealt with due to the quadratic memory requirements of explicit operator representations.  Torsten Ensslin committed Jan 04, 2019 102   Martin Reinecke committed Jan 22, 2019 103 The demo codes demos/getting_started_1.py and demos/Wiener_Filter.ipynb illustrate this.  Torsten Ensslin committed Jan 04, 2019 104 105 106 107 108  Generative Models -----------------  Martin Reinecke committed Feb 14, 2019 109 For more sophisticated measurement situations, involving non-linear measurements, unknown covariances, calibration constants and the like, it is recommended to formulate those as generative models for which NIFTy provides powerful inference algorithms.  Torsten Ensslin committed Jan 04, 2019 110   Torsten Ensslin committed Jan 07, 2019 111 In a generative model, all known or unknown quantities are described as the results of generative processes, which start with simple probability distributions, like the uniform, the i.i.d. Gaussian, or the delta distribution.  Torsten Ensslin committed Jan 04, 2019 112   Philipp Arras committed Jan 07, 2019 113 Let us rewrite the above free theory as a generative model:  Torsten Ensslin committed Jan 04, 2019 114   Torsten Ensslin committed Jan 04, 2019 115 116 117 .. math:: s = A\,\xi  Torsten Ensslin committed Jan 04, 2019 118   Philipp Arras committed Jan 07, 2019 119 with :math:{A} the amplitude operator such that it generates signal field realizations with the correct covariance :math:{S=A\,A^\dagger} when being applied to a white Gaussian field :math:{\xi} with :math:{\mathcal{P}(\xi)= \mathcal{G}(\xi, 1)}.  Torsten Ensslin committed Jan 04, 2019 120   Jakob Knollmueller committed Jan 22, 2019 121 The joint information Hamiltonian for the standardized signal field :math:{\xi} reads:  Torsten Ensslin committed Jan 04, 2019 122   Torsten Ensslin committed Jan 04, 2019 123 124 .. math::  Torsten Ensslin committed Jan 04, 2019 125  \mathcal{H}(d,\xi)= -\log \mathcal{P}(d,s)= \frac{1}{2} \xi^\dagger \xi + \frac{1}{2} (d-R\,A\,\xi)^\dagger N^{-1} (d-R\,A\,\xi) + \mathrm{const}.  Torsten Ensslin committed Jan 04, 2019 126   Martin Reinecke committed Jan 16, 2019 127 NIFTy takes advantage of this formulation in several ways:  Torsten Ensslin committed Jan 04, 2019 128   Jakob Knollmueller committed Jan 22, 2019 129 1) All prior degrees of freedom have unit covariance, which improves the condition number of operators that need to be inverted.  Martin Reinecke committed Jan 22, 2019 130   Martin Reinecke committed Jan 22, 2019 131 2) The amplitude operator can be regarded as part of the response, :math:{R'=R\,A}.  Martin Reinecke committed Jan 22, 2019 132 133  In general, more sophisticated responses can be constructed out of the composition of simpler operators.  Martin Reinecke committed Jan 22, 2019 134 3) The response can be non-linear, e.g. :math:{R'(s)=R \exp(A\,\xi)}, see demos/getting_started_2.py.  Martin Reinecke committed Jan 22, 2019 135   Max-Niklas Newrzella committed Jan 29, 2019 136 4) The amplitude operator may depend on further parameters, e.g. :math:A=A(\tau)= F\, \widehat{e^\tau} represents an amplitude operator with a positive definite, unknown spectrum defined in the Fourier domain.  Martin Reinecke committed Jan 22, 2019 137 138  The amplitude field :math:{\tau} would get its own amplitude operator, with a cepstrum (spectrum of a log spectrum) defined in quefrency space (harmonic space of a logarithmically binned harmonic space) to regularize its degrees of freedom by imposing some (user-defined degree of) spectral smoothness.  Martin Reinecke committed Jan 22, 2019 139 5) NIFTy calculates the gradient of the information Hamiltonian and the Fisher information metric with respect to all unknown parameters, here :math:{\xi} and :math:{\tau}, by automatic differentiation.  Torsten Ensslin committed Jan 31, 2019 140  The gradients are used for MAP estimates, and the Fisher matrix is required in addition to the gradient by Metric Gaussian Variational Inference (MGVI), which is available in NIFTy as well.  Martin Reinecke committed Jan 22, 2019 141  MGVI is an implicit operator extension of Automatic Differentiation Variational Inference (ADVI).  Torsten Ensslin committed Jan 19, 2019 142   Martin Reinecke committed Jan 22, 2019 143 144 The reconstruction of a non-Gaussian signal with unknown covariance from a non-trivial (tomographic) response is demonstrated in demos/getting_started_3.py. Here, the uncertainty of the field and the power spectrum of its generating process are probed via posterior samples provided by the MGVI algorithm.  Torsten Ensslin committed Jan 06, 2019 145   Philipp Arras committed Jan 09, 2019 146 147 148 149 +----------------------------------------------------+ | **Output of tomography demo getting_started_3.py** | +----------------------------------------------------+ | .. image:: images/getting_started_3_setup.png |  Philipp Arras committed Jan 20, 2019 150 | |  Philipp Arras committed Jan 09, 2019 151 152 153 154 155 156 +----------------------------------------------------+ | Non-Gaussian signal field, | | data backprojected into the image domain, power | | spectrum of underlying Gausssian process. | +----------------------------------------------------+ | .. image:: images/getting_started_3_results.png |  Philipp Arras committed Jan 20, 2019 157 | |  Philipp Arras committed Jan 09, 2019 158 159 160 161 162 163 164 +----------------------------------------------------+ | Posterior mean field signal | | reconstruction, its uncertainty, and the power | | spectrum of the process for different posterior | | samples in comparison to the correct one (thick | | orange line). | +----------------------------------------------------+  Torsten Ensslin committed Jan 19, 2019 165   Torsten Ensslin committed Jan 23, 2019 166 Maximum a Posteriori  Torsten Ensslin committed Jan 20, 2019 167 168 --------------------  Philipp Arras committed Jan 24, 2019 169 One popular field estimation method is Maximum a Posteriori (MAP).  Torsten Ensslin committed Jan 19, 2019 170 171 172 173 174 175 176  It only requires to minimize the information Hamiltonian, e.g by a gradient descent method that stops when .. math:: \frac{\partial \mathcal{H}(d,\xi)}{\partial \xi} = 0.  Torsten Ensslin committed Jan 23, 2019 177 NIFTy5 automatically calculates the necessary gradient from a generative model of the signal and the data and uses this to minimize the Hamiltonian.  Torsten Ensslin committed Jan 19, 2019 178   Jakob Knollmueller committed Jan 22, 2019 179 However, MAP often provides unsatisfactory results in cases of deep hirachical Bayesian networks.  Torsten Ensslin committed Jan 19, 2019 180 181 182 183 184 185 The reason for this is that MAP ignores the volume factors in parameter space, which are not to be neglected in deciding whether a solution is reasonable or not. In the high dimensional setting of field inference these volume factors can differ by large ratios. A MAP estimate, which is only representative for a tiny fraction of the parameter space, might be a poorer choice (with respect to an error norm) compared to a slightly worse location with slightly lower posterior probability, which, however, is associated with a much larger volume (of nearby locations with similar probability). This causes MAP signal estimates to be more prone to overfitting the noise as well as to perception thresholds than methods that take volume effects into account.  Torsten Ensslin committed Jan 20, 2019 186 187 188 189  Variational Inference ---------------------  Martin Reinecke committed Jan 22, 2019 190 One method that takes volume effects into account is Variational Inference (VI).  Jakob Knollmueller committed Jan 22, 2019 191 192 In VI, the posterior :math:\mathcal{P}(\xi|d) is approximated by a simpler, parametrized distribution, often a Gaussian :math:\mathcal{Q}(\xi)=\mathcal{G}(\xi-m,D). The parameters of :math:\mathcal{Q}, the mean :math:m and its covariance :math:D are obtained by minimization of an appropriate information distance measure between :math:\mathcal{Q} and :math:\mathcal{P}.  Martin Reinecke committed Jan 22, 2019 193 As a compromise between being optimal and being computationally affordable, the variational Kullback-Leibler (KL) divergence is used:  Torsten Ensslin committed Jan 19, 2019 194 195 196 197 198 199 200  .. math:: \mathrm{KL}(m,D|d)= \mathcal{D}_\mathrm{KL}(\mathcal{Q}||\mathcal{P})= \int \mathcal{D}\xi \,\mathcal{Q}(\xi) \log \left( \frac{\mathcal{Q}(\xi)}{\mathcal{P}(\xi)} \right) Minimizing this with respect to all entries of the covariance :math:D is unfeasible for fields.  Torsten Ensslin committed Jan 23, 2019 201 Therefore, Metric Gaussian Variational Inference (MGVI) approximates the posterior precision matrix :math:D^{-1} at the location of the current mean :math:m by the Bayesian Fisher information metric,  Torsten Ensslin committed Jan 19, 2019 202 203 204  .. math::  Jakob Knollmueller committed Jan 22, 2019 205  M \approx \left\langle \frac{\partial \mathcal{H}(d,\xi)}{\partial \xi} \, \frac{\partial \mathcal{H}(d,\xi)}{\partial \xi}^\dagger \right\rangle_{(d,\xi)}.  Torsten Ensslin committed Jan 20, 2019 206   Martin Reinecke committed Jan 22, 2019 207 208 In practice the average is performed over :math:\mathcal{P}(d,\xi)\approx \mathcal{P}(d|\xi)\,\delta(\xi-m) by evaluating the expression at the current mean :math:m. This results in a Fisher information metric of the likelihood evaluated at the mean plus the prior information metric.  Jakob Knollmueller committed Jan 22, 2019 209 210 Therefore we will only have to infer the mean of the approximate distribution. The only term within the KL-divergence that explicitly depends on it is the Hamiltonian of the true problem averaged over the approximation:  Martin Reinecke committed Jan 22, 2019 211   Torsten Ensslin committed Jan 20, 2019 212 213 .. math::  Jakob Knollmueller committed Jan 22, 2019 214 215  \mathrm{KL}(m|d) \;\widehat{=}\; \left\langle \mathcal{H}(\xi,d) \right\rangle_{\mathcal{Q}(\xi)},  Torsten Ensslin committed Jan 20, 2019 216   Jakob Knollmueller committed Jan 22, 2019 217 where :math:\widehat{=} expresses equality up to irrelvant (here not :math:m-dependent) terms.  Martin Reinecke committed Jan 22, 2019 218   Martin Reinecke committed Jan 22, 2019 219 Thus, only the gradient of the KL is needed with respect to this, which can be expressed as  Torsten Ensslin committed Jan 20, 2019 220 221 222  .. math::  Jakob Knollmueller committed Jan 22, 2019 223  \frac{\partial \mathrm{KL}(m|d)}{\partial m} = \left\langle \frac{\partial \mathcal{H}(d,\xi)}{\partial \xi} \right\rangle_{\mathcal{G}(\xi-m,D)}.  Torsten Ensslin committed Jan 20, 2019 224   Martin Reinecke committed Jan 22, 2019 225 226 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.  Max-Niklas Newrzella committed Jan 29, 2019 227 This KL-divergence for MGVI is implemented in the class :class:~minimization.metric_gaussian_kl.MetricGaussianKL within NIFTy5.  Torsten Ensslin committed Jan 20, 2019 228 229   Martin Reinecke committed Jan 22, 2019 230 The demo getting_started_3.py for example not only infers a field this way, but also the power spectrum of the process that has generated the field.  Martin Reinecke committed Jan 22, 2019 231 The cross-correlation of field and power spectrum is taken care of in this process.  Torsten Ensslin committed Jan 19, 2019 232 233 Posterior samples can be obtained to study this cross-correlation.  Martin Reinecke committed Jan 22, 2019 234 It should be noted that MGVI, as any VI method, can typically only provide a lower bound on the variance.