Skip to main content

Algorithms for Causal Discovery under Distribution Change

Project description

CausalChange

causalchange provides implementations of some score-based algorithms for causal discovery, with focus on addressing different forms of distribution shifts.


Setup

Install the core package with pip install causalchange, and with additional dependencies for the resp. algorithms using pip install causalchange[spacetime] and pip install causalchange[cmm].


Quick Example

import numpy as np
import pandas as pd

from causalchange import Topic

rng = np.random.default_rng(0)
n = 300

# chain: X -> Y -> Z
x = rng.normal(size=n)
y = 2.0 * x + 0.2 * rng.normal(size=n)
z = -1.0 * y + 0.2 * rng.normal(size=n)

X = pd.DataFrame({"X": x, "Y": y, "Z": z})

cc = Topic(score_type="lin", seed=0)
cc.fit(X)

print("Topological order:", cc.topological_order_)
print("Edges:", sorted(cc.graph_.edges()))

Further Examples

See the notebooks/ for basic usage on small synthetic examples. The algorithms are

  • TOPIC, for score-based causal DAG discovery from tabular data in topological order [1],
  • LINC, for score-based causal discovery from multiple contexts, i.e., multiple tabular datasets under latent distribution shifts/interventions [2],
  • CMM, for score-based causal discovery from latent mixtures, i.e., a tabular dataset comprised of different hidden populations/contexts/interventions [3].
  • SpaceTime, for temporal causal discovery, changepoint detection, and causal clustering analysis in time series or multi-context time series [4].

Documentation

See the docs/ for additional documentation.


References

[1] Xu, S., Mameche, S., and Vreeken, J. Information-theoretic Causal Discovery in Topological Order. AISTATS, 2025.

[2] Mameche, S., Kaltenpoth, D., and Vreeken, J. Learning Causal Models under Independent Changes. NeurIPS, 2023.

[3] Mameche, S., Kalofolias, J., and Vreeken, J. Causal Mixture Models: Characterization and Discovery. NeurIPS, 2025.

[4] Mameche, S., Cornanguer, L., Ninad, U., and Vreeken, J. SpaceTime: Causal Discovery from Non-stationary Time Series. AAAI, 2025.

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

causalchange-0.1.1.tar.gz (60.8 kB view details)

Uploaded Source

Built Distribution

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

causalchange-0.1.1-py3-none-any.whl (74.0 kB view details)

Uploaded Python 3

File details

Details for the file causalchange-0.1.1.tar.gz.

File metadata

  • Download URL: causalchange-0.1.1.tar.gz
  • Upload date:
  • Size: 60.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for causalchange-0.1.1.tar.gz
Algorithm Hash digest
SHA256 abd5a6fa502544c735fbac73758f5ceae3c85d9c8ed4390cfd4ca1081bdf7f23
MD5 dee663e04652809426d7c563deef97ed
BLAKE2b-256 537930a1c5d5424809b8f82dd54cd21f059298d7eb0617ab837d495d1ee74c76

See more details on using hashes here.

File details

Details for the file causalchange-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: causalchange-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 74.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for causalchange-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7ac4a5b70c102e0a61245f07b100ac3359bb24be6be9d5df4d5e3946fe69ffd1
MD5 f6d4a971d06cb39a2016352c4265b5b0
BLAKE2b-256 0780835b51e7a17a1e3df107c8b99f36c43011392c6d62434b9ca7d565d03b68

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