Giter Club home page Giter Club logo

lingam's Introduction

LiNGAM

lingam python code(lingam.py) You can find causal structure of variables using ICA-LiNGAM.

Reference: LiNGAM paper, Qiita(Japanese)

1. Ready data that you want to know causal structure.(LiNGAM only can use Continuous variables.)

import numpy as np
import pandas as pd

size = 10000
np.random.seed(2017)
x = np.random.uniform(size=size)

np.random.seed(1028)
y = 3*x + np.random.uniform(size=size)

X = pd.DataFrame(np.asarray([x,y]).T,columns=["x","y"])

2. Use LiNGAM. Select ICA method kurtosis(default) or negentropy(sklearn).

use kurtosis-based ICA

lingam = LiNGAM()
lingam.fit(X)

or

use negentropy-based ICA

lingam = LiNGAM()
lingam.fit(X,use_sklearn=True)

And, get result(same result).

x ---|2.991|---> y

array([[ 0.        ,  0.        ],
       [ 2.99149033,  0.        ]])

This means correct result.

   x =    0*x + 0*y + e1 = e1

   y = 2.99*x + 0*y + e2 = 2.99x + e2

lingam's People

Contributors

ragagar avatar

Stargazers

Shuji SUZUKI avatar  avatar  avatar Soogie Kawacub avatar Rohan Giriraj avatar tn1994 avatar konumaru avatar Danqing Shi avatar nkmry avatar Tao Zhang avatar  avatar K.Takano avatar Yuan Yannan avatar Koji Ono avatar KojiMiyazawa avatar Naoya Ikeda avatar cocoinit23 avatar  avatar shimao avatar  avatar gam avatar Satoru Kobayashi (sat) avatar Ricardo Lebrón avatar  avatar SuperUltimateGreatAugmentedNumerousObsolete-NoUser avatar  avatar

Watchers

James Cloos avatar

Forkers

kaji46 qawnaoya

lingam's Issues

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.