Coder Social home page Coder Social logo

py-causal's Introduction

py-causal

Python APIs for causal modeling algorithms developed by the University of Pittsburgh/Carnegie Mellon University Center for Causal Discovery.

This code is distributed under the LGPL 2.1 license.

Requirements:

Python 2.7 and 3.6

  • javabridge>=1.0.11
  • pandas
  • numpy
  • JDK 1.8
  • pydot (Optional)
  • GraphViz (Optional)

Installation overview:

We have found two approaches to be useful:

  • Direct python installation with pip, possibly including use of Jupyter. This approach is likely best for users who have Python installed and are familiar with installing Python modules.
  • Installation via Anaconda, which installs Python and related utilities.

Directions for both approaches are given below...

Installation with pip

First install Java 8 or higher and Python 2.7 or higher.

If you do not have pip installed already, try these instructions.

Once pip is installed, execute these commands

pip install -U numpy
pip install -U pandas
pip install -U javabridge
pip install -U pydot # optional
pip install -U GraphViz # optional

Note: you also need to install the GraphViz engine by following these instructions.

We have observed that on some OS X installations, pydot may provide the following response Couldn't import dot_parser, loading of dot files will not be possible.

If you see this, try the following

 pip uninstall pydot
 pip install pyparsing==1.5.7
 pip install pydot

Then, from within the py-causal directory, run the following command:

python setup.py install

or use the pip command:

pip install git+git://github.com/bd2kccd/py-causal

After running this command, enter a python shell and attempt the following imports:

import pandas as pd
import pydot
from pycausal import search as s

Finally, try to run the python example

python py-causal-fges-continuous-example.py

Be sure to run this from within the py-causal directory.

This program will create a file named tetrad.svg, which should be viewable in any SVG capable program. If you see a causal graph, everything is working correctly.

Running Jupyter/IPython

We have found Jupyter notebooks to be helpful. (Those who have run IPython in the past should know that Jupyter is simply a new name for IPython). To add Jupyter to your completed python install, simply run

pip -U jupyter
jupyter notebook

and then load one of the Jupyter notebooks found in this installation.

Anaconda/Jupyter

First install Java 8 or higher and Python 2.7 or higher.

Installing Python with Anaconda and Jupyter may be easier for some users:

Then run the following to configure anaconda

conda install javabridge
conda install pandas  
conda install numpy
conda install pydot
conda install graphviz 
conda install -c https://conda.anaconda.org/chirayu pycausal 
jupyter notebook

and then load one of the Jupyter notebooks.

Docker Image

The pre-installed py-causal Docker image is also available at Docker Hub

py-causal's People

Contributors

chirayukong avatar harryhoch avatar espinoj avatar chrisji avatar davism84 avatar bja43 avatar eamonnmag avatar

Watchers

James Cloos 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.