Skip to main content

Implementations of the Inflation Technique for Causal Inference

Project description

DOI

Inflation

Inflation is a package, written in Python, that implements inflation algorithms for causal inference. In causal inference, the main task is to determine which causal relationships can exist between different observed random variables. Inflation algorithms are a class of techniques designed to solve the causal compatibility problem, that is, test compatibility between some observed data and a given causal relationship.

This package implements the inflation technique for classical, quantum, and post-quantum causal compatibility. By relaxing independence constraints to symmetries on larger graphs, it develops hierarchies of relaxations of the causal compatibility problem that can be solved using linear and semidefinite programming. For details, see Wolfe et al. “The inflation technique for causal inference with latent variables.” Journal of Causal Inference 7 (2), 2017-0020 (2019), Wolfe et al. “Quantum inflation: A general approach to quantum causal compatibility.” Physical Review X 11 (2), 021043 (2021), and references therein.

Examples of use of this package include:

  • Causal compatibility with classical, quantum, non-signaling, and hybrid models.
  • Feasibility problems and extraction of certificates.
  • Optimization of Bell operators.
  • Optimization over classical distributions.
  • Handling of bilayer (i.e., networks) and multilayer causal structures.
  • Standard Navascués-Pironio-Acín hierarchy.
  • Scenarios with partial information.
  • Possibilistic compatibility with a causal network.
  • Estimation of do-conditionals and causal strengths.

See the documentation for more details.

Documentation

Installation

To install the package, run the following command:

pip install inflation

You can also install directly from GitHub with:

pip install git+https://github.com/ecboghiu/inflation.git@main

or download the repository on your computer and run pip install . in the repository folder. Install the devel branch for the latest features and bugfixes.

Tests are written outside the Python module, therefore they are not installed together with the package. To test the installation, clone the repository and run, in a Unix terminal, python -m unittest -v inside the repository folder.

Example

The following example shows that the W distribution is incompatible with the triangle scenario with quantum sources by showing that a specific semidefinite programming relaxation is infeasible:

from inflation import InflationProblem, InflationSDP
import numpy as np

P_W = np.zeros((2, 2, 2, 1, 1, 1))
for a, b, c, x, y, z in np.ndindex(*P_W.shape):
    if a + b + c == 1:
        P_W[a, b, c, x, y, z] = 1 / 3

triangle = InflationProblem(dag={"rho_AB": ["A", "B"],
                                 "rho_BC": ["B", "C"],
                                 "rho_AC": ["A", "C"]},
                             outcomes_per_party=(2, 2, 2),
                             settings_per_party=(1, 1, 1),
                             inflation_level_per_source=(2, 2, 2))

sdp = InflationSDP(triangle, verbose=1)
sdp.generate_relaxation('npa2')
sdp.set_distribution(P_W)
sdp.solve()

print("Problem status:", sdp.status)
print("Infeasibility certificate:", sdp.certificate_as_probs())

For more information about the theory and other features, please visit the documentation, and more specifically the Tutorial and Examples pages.

How to contribute

Contributions are welcome and appreciated. If you want to contribute, you can read the contribution guidelines. You can also read the documentation to learn more about how the package works.

License

Inflation is free open-source software released under GNU GPL v. 3.0.

Citing Inflation

If you use Inflation in your work, please cite Inflation's paper:

  • Emanuel-Cristian Boghiu, Elie Wolfe and Alejandro Pozas-Kerstjens, "Inflation: a Python package for classical and quantum causal compatibility", Quantum 7, 996 (2023), arXiv:2211.04483
@article{pythoninflation,
  doi = {10.22331/q-2023-05-04-996},
  url = {https://doi.org/10.22331/q-2023-05-04-996},
  title = {Inflation: a {P}ython library for classical and quantum causal compatibility},
  author = {Boghiu, Emanuel-Cristian and Wolfe, Elie and Pozas-Kerstjens, Alejandro},
  journal = {{Quantum}},
  issn = {2521-327X},
  publisher = {{Verein zur F{\"{o}}rderung des Open Access Publizierens in den Quantenwissenschaften}},
  volume = {7},
  pages = {996},
  month = may,
  year = {2023},
  archivePrefix = {arXiv},
  eprint = {2211.04483}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inflation-2.0.3.tar.gz (139.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

inflation-2.0.3-py3-none-any.whl (122.6 kB view details)

Uploaded Python 3

File details

Details for the file inflation-2.0.3.tar.gz.

File metadata

  • Download URL: inflation-2.0.3.tar.gz
  • Upload date:
  • Size: 139.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.7

File hashes

Hashes for inflation-2.0.3.tar.gz
Algorithm Hash digest
SHA256 e6779cf794d9fbd40c4e4395d6550973a6714b289858a6930cacf7d074ed5376
MD5 76490b5aaa29bddf1ebe6070157b7a38
BLAKE2b-256 4b20ad6e2a356fab47119b3a2caa5d221920ee8fe4551ae228b3ad56b51c6a3b

See more details on using hashes here.

File details

Details for the file inflation-2.0.3-py3-none-any.whl.

File metadata

  • Download URL: inflation-2.0.3-py3-none-any.whl
  • Upload date:
  • Size: 122.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.7

File hashes

Hashes for inflation-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 15145fcbd806834336ab775d02c46cf9f63471e65205e7538d53401bb74ef8ab
MD5 83b0bcf089db37a3095e1c89ac61c1b2
BLAKE2b-256 556d3cfbe41a146c1bfbe3c53c18ae62146529d800a678f03b41b068d0f03e9d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page