fredipy

Inverting Fredholm integral equations using Gaussian Processes

https://github.com/jonasturnwald/fredipy

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.3%) to scientific vocabulary

Keywords

gaussian-processes inverse-problems
Last synced: 6 months ago · JSON representation ·

Repository

Inverting Fredholm integral equations using Gaussian Processes

Basic Info
  • Host: GitHub
  • Owner: JonasTurnwald
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 1.79 MB
Statistics
  • Stars: 7
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
gaussian-processes inverse-problems
Created almost 2 years ago · Last pushed 11 months ago
Metadata Files
Readme License Citation

README.md

fredipy: Fredholm Inversion in Python

This package implements constrained Gaussian process regression for linear inverse problems, with a focus on inverting Fredholm integral equations of the first kind.

Introduction

Linear inverse problems are ubiquitous in science. A particular instance of this class of problems is finding solutions $\rho(\omega)$ to Fredholm integral equations of the form

$$G(p) = \int \mathrm{d}\omega\ K(p,\omega) \rho(\omega)\ ,$$

where the function $K(p, \omega)$ is known. The left-hand side, $G(p)$, is typically available in the form of discrete observations with finite measurement uncertainty. Further prior knowledge about the solution $\rho(\omega)$ is often provided in terms of linear equality constraints. Discretizing the convolution on the right-hand side can result in heavily ill-conditioned systems of linear equations in need of regularization.

Extending standard Gaussian process regression to inference with indirect observations (which are related to the desired data by a linear transformation) offers a powerful non-parametric approach to the probabilistic treatment of Fredholm inversion problems. Moreover, the ansatz naturally admits the incorporation of further linear equality constraints with essentially arbitrary linear operators, treated in the same way as the main problem statement itself.

This package provides a python implementation of the method. To the best of our knowledge, the full algorithm was first described by Valentine and Sambridge, 2019 [1] in the context of geostatistics. We are primarily interested in its application to the spectral reconstruction of correlation functions in computational quantum field theory [2-4]. Nevertheless, the software is largely problem-agnostic and generally applicable in a wide variety of similar settings.

We recommend [1] and [2] for an introduction to the method, while the textbook by Rasmussen and Wiliams [5] is an excellent general introdution to Gaussian Processes.

In the current framework, it is not possible to include global inequality constraints, most relevant to reconstruct a strictily positive function. This makes reconstructing sharp peaks that swiftly approach zero at the tails one of the hardest reconstruction problems with this technique. Currently, we are looking into several possibilites to provide such a feature in the future.

Note, that we use custom integration routines for two reasons: Firstly, this lets us write the integration as a fast matrix multiplication. Secondly, using integration schemes that do not have a fixed set of grid points, can lead to numerical instabilities in the reconstruction. The consistency of the result in the different integration procedures during the reconstruction is very important and we therefore explicitly require this.

Installation

To install fredipy from PyPi, use

pip install fredipy

Usage

See examples, for in depth examples of the package usage. Specifically, this notebook covers the most important basic options.

A simple example for the reconstruction of a single Breit-Wigner peak, showcasing the basic structure.

```python import fredipy as fp import numpy as np

define breit wigner peak

def get_BW(p, a, m, g): return a / (m ** 2 + (np.sqrt(p*2) + g) * 2)

define the associates spectral function rho

def get_rho(w, a, m, g): return (4 * a * g * w) / (4 * g ** 2 * w ** 2 + (g ** 2 + m ** 2 - w ** 2) ** 2)

... and the källen lehmann kernel, that is integrated over

def kl_kernel(p, w): return w / (w2 + p2) / np.pi

prepare the data arrays

w_pred = np.arange(0.1, 10, 0.1) p = np.linspace(0, 20, 100)

a = 1.6 m = 1 g = 0.8

the example spectral function

rho = getrho(wpred, a, m, g)

... and the associated correlator

G = get_BW(p, a, m, g)

put some noise on the data

err = 1e-5 G_err = G + err * np.random.randn(len(G))

data = { 'x': p, 'y': Gerr, 'covy': err**2 * np.ones_like(G)}

use the RBF kernel

kernel = fp.kernels.RadialBasisFunction(variance=0.3, lengthscale=0.4)

define the integrator method to use, with upper and lower bounds and number of points

integrator = fp.integrators.Riemann1D(wmin=0, wmax=100, intn=1000)

... and define the operator, the integration with the källen lehmann kernel

integralop = fp.operators.Integral(klkernel, integrator)

... and define the full constraint using the date we genrated before

constraints = [fp.constraints.LinearEquality(integral_op, data)]

now we can define the model using the contraints and the GP kernel

model = fp.models.GaussianProcess(kernel, constraints)

... and do a prediction on the points w_pred

rho, _rhoerr = model.predict(w_pred) ```

Authors & Citing

This package is written and maintained by Jonas Turnwald, Julian M. Urban and Nicolas Wink.

If you use this package in scientific work, please cite this repository.

References

[1] A. P. Valentine and M. Sambridge, Gaussian process models—I. A framework for probabilistic continuous inverse theory, Geophysical Journal International 220, 1632 (2020).

[2] J. Horak, J. M. Pawlowski, J. Rodríguez-Quintero, J. Turnwald, J. M. Urban, N. Wink, and S. Zafeiropoulos, Reconstructing QCD spectral functions with Gaussian processes, Phys. Rev. D 105, 036014 (2022), arXiv:2107.13464 [hep-ph].

[3] J. M. Pawlowski, C. S. Schneider, J. Turnwald, J. M. Urban, and N. Wink, Yang-Mills glueball masses from spectral reconstruction, Phys. Rev. D 108, 076018 (2023), arXiv:2212.01113 [hep-ph].

[4] J. Horak, J. M. Pawlowski, J. Turnwald, J. M. Urban, N. Wink, and S. Zafeiropoulos, Nonperturbative strong coupling at timelike momenta, Phys. Rev. D 107, 076019 (2023), arXiv:2301.07785 [hep-ph].

[5] C. Rasmussen and C. Williams, Gaussian Processes for Machine Learning, The MIT Press, 2005.

Owner

  • Name: Jonas Turnwald
  • Login: JonasTurnwald
  • Kind: user

PhD Student @ TU Darmstadt

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: fredipy
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Jonas
    family-names: Turnwald
    affiliation: TU Darmstadt
  - given-names: Julian M.
    family-names: Urban
    affiliation: MIT, IAIFI
  - given-names: Nicolas
    family-names: Wink
    affiliation: TU Darmstadt
repository-code: 'https://github.com/JonasTurnwald/fredipy'

GitHub Events

Total
  • Release event: 2
  • Watch event: 6
  • Delete event: 1
  • Push event: 17
  • Create event: 1
Last Year
  • Release event: 2
  • Watch event: 6
  • Delete event: 1
  • Push event: 17
  • Create event: 1

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 14 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
  • Total maintainers: 1
pypi.org: fredipy

Inverting Fredholm Integrals with Python

  • Documentation: https://fredipy.readthedocs.io/
  • License: MIT License Copyright (c) 2024 Jonas Turnwald, Julian M. Urban, Nicolas Wink Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 0.2.0
    published 11 months ago
  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 14 Last month
Rankings
Dependent packages count: 9.7%
Average: 37.0%
Dependent repos count: 64.2%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/pypi-release.yml actions
  • actions/checkout v4 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • pypa/gh-action-pypi-publish release/v1 composite
.github/workflows/python-package.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
pyproject.toml pypi
  • numpy *
  • scipy *