Skip to content

chingyaoc/SAM

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SAM: Structural Agnostic Model, Causal Discovery and Penalized Adversarial Learning.

Code in PyTorch. Link to the paper: https://arxiv.org/abs/1803.04929

In order to use SAM:

  1. Install the package requirements with pip install -r requirements.txt. For PyTorch visit: https://pytorch.org
  2. Install the package with the command: python setup.py develop --user
  3. Execute the SAM by including the desired options:
import pandas as pd
from sam import SAM
sam = SAM()
data = pd.read_csv("test/G5_v1_numdata.tab", sep="\t")
output = sam.predict(data, nruns=12) # Recommended if high computational capability available, else nruns=1

We highly recommand to use GPUs if possible. Here is an example for 2 GPUs:

import pandas as pd
from sam import SAM
sam = SAM()
data = pd.read_csv("test/G5_v1_numdata.tab", sep="\t")
output = sam.predict(data, nruns=12, gpus=2, njobs=4) # As the model is small, we recommand using 2 jobs on each GPU

In order to download the datasets used in the paper as well as the generators, download the submodule "datasets" (458MB):

git submodule update --init

The acyclic graphs for the mechanisms Linear, GP Add, GP Mix, Sigmoid Add and Sigmoid Mix were generated using the software provided at : https://github.com/bquast/ANM/tree/master/codeANM

About

Code for the Structural Agnostic Model (https://arxiv.org/abs/1803.04929)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%