Giter Site home page Giter Site logo

christopherschmidt89 / gpucmiknn Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 2.0 98 KB

GPU-based information-theoretic conditional independence test for causal discovery

License: GNU General Public License v3.0

Makefile 4.79% Python 21.74% C++ 10.85% C 2.21% Cuda 60.42%

gpucmiknn's Introduction

gpucmiknn

A research implementation of a concept for GPU-accelerated information theoretic causal discovery, based upon the CMIknn test for conditional independence 1. The gpucmiknn implementation can be extended to handle different CMI estimators that build upon the concept of knn searches.

Installation

  1. setup conda environment
  2. build cuda code:
    • in parent directory of this repo:
      cd pc_adjacency_search
    • adjust Makefile.config, e.g. (remaining lines can be commented out):
    ANACONDA_HOME := $(HOME)/anaconda3/envs/rapids-21.08
    PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
    $(ANACONDA_HOME)/include/python3.7m \
    $(ANACONDA_HOME)/lib/python3.7/site-packages/numpy/core/include/
    PYTHON_LIB := $(ANACONDA_HOME)/lib
    INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
    LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
    CUDA_DIR := /usr/local/cuda
    BUILD_DIR := build
    
    • build the code:
      make
    • tested with python 3.8
  3. install python dependencies: pip install -r requirements.txt

Execution

In parent directory of this repo:
cd pc_adjacency_search python main.py -i ./data/coolingData.csv --permutations 100 --process_count 1 -a 0.01 --par_strategy 2 -k 7

Parameters

The following options are available:

Parameter Default Description
-i Path to input file in .csv format.
-a 0.05 Sets the significance level used within PC algorithm.
-l None Gives the max level for the PC algorithm (level of the pc algorithm is <= max level)
-k adaptive k-nearest neighbors during CMI estimation. Adaptive, sets the parameter to 0.2 the sample size.
--permutations 50 Number of Permutations used for the CI Test.
--par_strategy Flag indicate the parallel hardware used: 1 - CPU-based execution; 2 - GPUKNNCMI-Single; 3 GPUKNNCMI-Parallel
--process_count 2 Number of parallel processes used during adjacency search for CPU-based execution
-b None Blocks during block-wise processing of GPUKNNCMI-Parallel. Default setting calculates the blocks on encountering memory pressure due to large numbers of separation set candidates.

Contributor

License

GPL-3

References

Footnotes

  1. CMIknn: J. Runge (2018): Conditional Independence Testing Based on a Nearest-Neighbor Estimator of Conditional Mutual Information. In Proceedings of the 21st International Conference on Artificial Intelligence and Statistics. http://proceedings.mlr.press/v84/runge18a.html โ†ฉ

gpucmiknn's People

Contributors

christopherschmidt89 avatar

Stargazers

 avatar  avatar

Watchers

 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.