Metadata-Version: 2.4
Name: causalchange
Version: 0.1.1
Summary: Algorithms for Causal Discovery under Distribution Change
Author: Sarah Mameche
License: MIT License
        
        Copyright (c) 2025 Sarah Mameche
        
        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.
        
Project-URL: Homepage, https://github.com/srhmm/causalchange
Project-URL: Issues, https://github.com/srhmm/causalchange/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy<2,>=1.26
Requires-Dist: pandas>=2.0
Requires-Dist: networkx>=3.0
Requires-Dist: pydantic>=2.0
Requires-Dist: scikit-learn>=1.3
Requires-Dist: scipy>=1.10
Provides-Extra: spacetime
Requires-Dist: ruptures; extra == "spacetime"
Requires-Dist: hyppo; extra == "spacetime"
Requires-Dist: causal-learn; extra == "spacetime"
Provides-Extra: cmm
Requires-Dist: rpy2; extra == "cmm"
Provides-Extra: plotting
Requires-Dist: matplotlib; extra == "plotting"
Provides-Extra: notebooks
Requires-Dist: jupyter; extra == "notebooks"
Requires-Dist: ipykernel; extra == "notebooks"
Requires-Dist: matplotlib; extra == "notebooks"
Provides-Extra: docs
Requires-Dist: sphinx; extra == "docs"
Requires-Dist: myst-parser; extra == "docs"
Requires-Dist: numpydoc; extra == "docs"
Requires-Dist: sphinx-rtd-theme; extra == "docs"
Requires-Dist: nbsphinx; extra == "docs"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Provides-Extra: all
Requires-Dist: ruptures; extra == "all"
Requires-Dist: hyppo; extra == "all"
Requires-Dist: causal-learn; extra == "all"
Requires-Dist: matplotlib; extra == "all"
Dynamic: license-file

## 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

```python
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](notebooks/01_topic_tutorial.ipynb), for score-based causal DAG discovery from tabular data in topological order [1],
*   [LINC](notebooks/02_linc_tutorial.ipynb), for score-based causal discovery from multiple contexts, i.e., multiple tabular datasets under latent distribution shifts/interventions [2],
*   [CMM](notebooks/04_cmm_tutorial.ipynb), for score-based causal discovery from latent mixtures, i.e., a tabular dataset comprised of different hidden populations/contexts/interventions [3].
*   [SpaceTime](notebooks/03_spacetime_tutorial.ipynb), for temporal causal discovery, changepoint detection, and causal clustering analysis in time series or multi-context time series [4].

---
### Documentation

See the [docs/](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.
