Git Product home page Git Product logo

anm-mm's Introduction

ANM Mixture Model (ANM-MM)

Python implementation of the following paper

Causal Inference and Mechanism Clustering of A Mixture of Additive Noise Models.
Hu, Shoubo, Zhitang Chen, Vahid Partovi Nia, Laiwan Chan, and Yanhui Geng.
Advances in Neural Information Processing Systems. (NeurIPS) 2018.

Prerequisites

  • numpy
  • scipy
  • sklearn

We test the code using Anaconda 4.3.30 64-bit for python 2.7 on Windows 10. Any later version should still work perfectly.

Running the tests

After installing all required packages, you can run test.py to see whether ANM-MM() could work normally.

The test code does the following:

  1. it generates 100 observations (a (100, 2) numpy array) from two exponential functions. The first column is the cause X and the second is the effect Y.
  2. ANM-MM is applied on the generated data to first conduct clustering and then infer the causal direction.

Apply ANM-MM on your data

Usage

Import ANM-MM using

from ANMMM import ANMMM_cd, ANMMM_clu

Apply ANM-MM on your data

# causal inference
direction = ANMMM_cd(data, lda)

# mechanism clustering
labels = ANMMM_clu(data, label, lda)

Description

Input of function ANMMM_cd() and ANMMM_clu()

Argument Description
data Numpy array with 2 columns and any number of rows. Rows represent i.i.d. samples, The variables in the first and second column are called X and Y, respectively.
label List of true labels of each observation.
lda The parameter λ which controls the importance of HSIC term.

Output of function ANMMM_cd()

Argument Description
direction 1 - the first column is the cause;
-1 - the second column is the cause;
0 - can not tell.

Output of function ANMMM_clu()

Argument Description
labels List of estimated clustering labels of each observation.

Authors

  • Shoubo Hu - shoubo [dot] sub [at] gmail [dot] com
  • Zhitang Chen - chenzhitang2 [at] huawei [dot] com

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

anm-mm's People

Contributors

amber0309 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.