Skip to main content

⚠️ IMPORTANT

CausalNex is no longer actively maintained. As of 24th June 2026, CausalNex has reached end of life and has been discontinued.

McKinsey will continue to make this repository accessible strictly as a historical archive, but please be advised that the codebase has been discontinued and is no longer supported. Consequently, the project will not receive any future updates, bug-fixes, or security and vulnerability patches. Outstanding issues and pull requests will no longer be monitored or reviewed.

Pursuant to the applicable open-source license, CausalNex is provided on an "AS IS" basis, without warranties or conditions of any kind, either express or implied. Any continued use, copying, modification, or distribution of this codebase is done entirely at the user's own risk, and McKinsey disclaims all liability arising from such use.

Theme Status
Latest Release PyPI version
Python Version Python Version
Documentation Build Documentation
License License
Code Style Code Style: Black

What is CausalNex?

"A toolkit for causal reasoning with Bayesian Networks."

CausalNex aims to become one of the leading libraries for causal reasoning and "what-if" analysis using Bayesian Networks. It helps to simplify the steps:

  • To learn causal structures,
  • To allow domain experts to augment the relationships,
  • To estimate the effects of potential interventions using data.

Why CausalNex?

CausalNex is built on our collective experience to leverage Bayesian Networks to identify causal relationships in data so that we can develop the right interventions from analytics. We developed CausalNex because:

  • We believe leveraging Bayesian Networks is more intuitive to describe causality compared to traditional machine learning methodology that are built on pattern recognition and correlation analysis.
  • Causal relationships are more accurate if we can easily encode or augment domain expertise in the graph model.
  • We can then use the graph model to assess the impact from changes to underlying features, i.e. counterfactual analysis, and identify the right intervention.

In our experience, a data scientist generally has to use at least 3-4 different open-source libraries before arriving at the final step of finding the right intervention. CausalNex aims to simplify this end-to-end process for causality and counterfactual analysis.

What are the main features of CausalNex?

The main features of this library are:

  • Use state-of-the-art structure learning methods to understand conditional dependencies between variables
  • Allow domain knowledge to augment model relationship
  • Build predictive models based on structural relationships
  • Fit probability distribution of the Bayesian Networks
  • Evaluate model quality with standard statistical checks
  • Simplify how causality is understood in Bayesian Networks through visualisation
  • Analyse the impact of interventions using Do-calculus

How do I install CausalNex?

CausalNex is a Python package. To install it, simply run:

pip install causalnex

Use all for a full installation of dependencies:

pip install "causalnex[all]"

See more detailed installation instructions, including how to setup Python virtual environments, in our installation guide and get started with our tutorial.

How do I use CausalNex?

You can find the documentation for the latest stable release here. It explains:

Note: You can find the notebook and markdown files used to build the docs in docs/source.

How do I upgrade CausalNex?

We use SemVer for versioning. The best way to upgrade safely is to check our release notes for any notable breaking changes.

How do I cite CausalNex?

You may click "Cite this repository" under the "About" section of this repository to get the citation information in APA and BibTeX formats.

What licence do you use?

See our LICENSE for more detail.

We're hiring!

Do you want to be part of the team that builds CausalNex and other great products at QuantumBlack? Take a look at our open positions and see if you're a fit.

Download files

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

Source Distribution

causalnex-0.12.2.tar.gz (114.0 kB view details)

Uploaded Source

Built Distribution

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

causalnex-0.12.2-py3-none-any.whl (154.2 kB view details)

Uploaded Python 3

File details

Details for the file causalnex-0.12.2.tar.gz.

File metadata

  • Download URL: causalnex-0.12.2.tar.gz
  • Upload date:
  • Size: 114.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for causalnex-0.12.2.tar.gz
Algorithm Hash digest
SHA256 4d492f4fd9613c88621838f88ef62d920b75f8d5dd9aaf3402abb386a5c084f9
MD5 b6c74e83d9a4018f5f18cf10be55027e
BLAKE2b-256 96350606ad5684a6fe5cf687ab0aeb92053e276354243c6c515b52f50780f6b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for causalnex-0.12.2.tar.gz:

Publisher: publish.yml on mckinsey/causalnex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file causalnex-0.12.2-py3-none-any.whl.

File metadata

  • Download URL: causalnex-0.12.2-py3-none-any.whl
  • Upload date:
  • Size: 154.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for causalnex-0.12.2-py3-none-any.whl
Algorithm Hash digest
SHA256 51df9f8e29a808d52b69fdfd73e94e622af82a35a0fb3c143cf43827cd71317b
MD5 086dcd81d007203946138e603bc423c7
BLAKE2b-256 e4404d09ca78244856df7656456593743dce81e0449b9b4684405227381b46be

See more details on using hashes here.

Provenance

The following attestation bundles were made for causalnex-0.12.2-py3-none-any.whl:

Publisher: publish.yml on mckinsey/causalnex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.12.2 This release

2 files

0.12.1

2 files

0.12.0

2 files

0.11.2

2 files

0.11.1

2 files

0.11.0

2 files

0.10.0

2 files

0.9.2

2 files

0.9.1

2 files

0.9.0

2 files

0.8.1

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page