cdt15 / lingam

Python package for causal discovery based on LiNGAM.
https://sites.google.com/view/sshimizu06/lingam
MIT License
356 stars 54 forks source link
causal-discovery causal-inference causal-models causality causality-analysis lingam machine-learning python

LiNGAM - Discovery of non-gaussian linear causal models

License Read the Docs

LiNGAM is a new method for estimating structural equation models or linear Bayesian networks. It is based on using the non-Gaussianity of the data.

Requirements

Installation

To install lingam package, use pip as follows:

pip install lingam

Usage

import numpy as np
import pandas as pd
import lingam

# To run causal discovery, we create a DirectLiNGAM object and call the fit method.
model = lingam.DirectLiNGAM()
model.fit(X)

# Using the causal_order_ properties, 
# we can see the causal ordering as a result of the causal discovery.
print(model.causal_order_)

# Also, using the adjacency_matrix_ properties, 
# we can see the adjacency matrix as a result of the causal discovery.
print(model.adjacency_matrix_)

Documentation

Tutorial and API reference

Tutorial slides

Examples

We provide several examples of running the LiNGAM algorithm in Jupyter Notebook. lingam/examples

License

This project is licensed under the terms of the MIT license.

Contribution

For guidelines how to contribute to lingam package, take a look at CONTRIBUTING.md.

References

Package

If you find our package useful, please cite the following paper:

Basic DAG model

Should you use this package for performing ICA-based LiNGAM algorithm, we kindly request you to cite the following paper:

Should you use this package for performing DirectLiNGAM algorithm, we kindly request you to cite the following two papers:

Should you use this package for performing RESIT algorithm, we kindly request you to cite the following paper:

Time series

Should you use this package for performing VAR-LiNGAM, we kindly request you to cite the following paper:

Should you use this package for performing VARMA-LiNGAM, we kindly request you to cite the following paper:

Multiple datasets

Should you use this package for performing DirectLiNGAM for multiple groups, we kindly request you to cite the following paper:

Should you use this package for performing LiNGAM for longitudinal data, we kindly request you to cite the following paper:

Latent confounders and latent factors

Should you use this package for performing BottomUpParceLiNGAM with Algorithm 1 of the paper below except Step 2 for estimating causal orders, we kindly request you to cite the following paper:

Should you use this package for performing RCD algorithm, we kindly request you to cite the following paper:

Should you use this package for performing LiNA algorithm, we kindly request you to cite the following paper:

Should you use this package for performing CAM-UV algorithm, we kindly request you to cite the following paper:

Causality and prediction

Should you use this package for performing estimation of intervention effects on prediction, we kindly request you to cite the following paper:

Mixed data

Should you use this package for performing LiM algorithm, we kindly request you to cite the following paper: