Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
xunzheng committed Apr 15, 2020
1 parent 3542b7c commit fe71b02
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Code for nonlinear NOTEARS has been added. See [[2](https://arxiv.org/abs/1909.1

## tl;dr Structure learning in <60 lines

Check out [`notears.py`](src/notears.py) for a complete, end-to-end implementation of the NOTEARS algorithm in fewer than **60 lines**.
Check out [`linear.py`](src/linear.py) for a complete, end-to-end implementation of the NOTEARS algorithm in fewer than **60 lines**.

This includes L2, Logistic, and Poisson loss functions with L1 penalty.

Expand Down Expand Up @@ -73,11 +73,14 @@ space of DAGs.
- `numpy`
- `scipy`
- `python-igraph`: Install [igraph C core](https://igraph.org/c/) and `pkg-config` first.
- `torch': Optional, only used for nonlinear model.

## Contents (New version)

- `notears.py` - the 60-line implementation of NOTEARS with l1 regularization for various losses
- `linear.py` - the 60-line implementation of NOTEARS with l1 regularization for various losses
- `nonlinear.py` - nonlinear NOTEARS using MLP or basis expansion
- `locally_connected.py` - special layer structure used for MLP
- `lbfgsb_scipy.py` - wrapper for scipy's LBFGS-B
- `utils.py` - graph simulation, data simulation, and accuracy evaluation


Expand All @@ -87,7 +90,7 @@ The simplest way to try out NOTEARS is to run a simple example:
```bash
$ git clone https://github.com/xunzheng/notears.git
$ cd notears/
$ python src/notears.py
$ python src/linear.py
```
This runs the l1-regularized NOTEARS on a randomly generated 20-node Erdos-Renyi graph with 100 samples.
Within a few seconds, you should see output like this:
Expand All @@ -102,7 +105,7 @@ The data, ground truth graph, and the estimate will be stored in `X.csv`, `W_tru
Alternatively, if you have a CSV data file `X.csv`, you can install the package and run the algorithm as a command:
```bash
$ pip install git+git:https://github.com/xunzheng/notears
$ notears_linear_l1 X.csv
$ notears_linear X.csv
```
The output graph will be stored in `W_est.csv`.

Expand Down

0 comments on commit fe71b02

Please sign in to comment.