Skip to content

Latest commit

 

History

History
83 lines (59 loc) · 2.38 KB

README.md

File metadata and controls

83 lines (59 loc) · 2.38 KB

LazyIter

Implementation of ICML paper "LazyIter: A Fast Algorithm for Counting Markov Equivalent DAGs and Designing Experiments". You can find the paper here and the PyPi package here.

Installation

  1. using PyPi

LazyIter could be simply installed using pip:

pip install LazyIter-teshnizi
  1. using the code directly

You can also copy files inside LazyIter folder to your project's folder and import the functions into your code.

Usage

Example Graph

  • LazyCount

Import lazy_count function from LazyIter.count and pass it the adjacency set of the corresponding MEC to get the MEC size:

from LazyIter.count import lazy_count

neighbors = {
      0: {1, 3, 6},
      1: {0, 3},
      2: {4, 5},
      3: {0, 1, 5, 6},
      4: {2, 5, 6},
      5: {2, 3, 4, 6},
      6: {0, 3, 4, 5}
      }


print(lazy_count(neighbors))

output:

22
  • Passive Learning

You can find the number of directed edges in the worst case for a given set of experiment targets using pl_score function. To find the best target, you could simply iterate over all valid target sets (based on the experiment budget) and choose the one with maximum score.

from LazyIter.learn import pl_score

neighbors = {
      0: {1, 3, 6},
      1: {0, 3},
      2: {4, 5},
      3: {0, 1, 5, 6},
      4: {2, 5, 6},
      5: {2, 3, 4, 6},
      6: {0, 3, 4, 5}
      }

print(pl_score(neighbors, {0, 4}))

output:

8

Explanation: If you intervene on nodes 0 and 4 simultaneously in different trials, you will discover direction of at least 8 edges.

  • Active Learning Active learning is a sub-problem of the Passive learning case where the target set contains only 1 node. Therefore, You can use pl_score for this purpose too.

Contribution

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Future work maybe focused on adding other experiment score functions.

License

MIT