summaryrefslogtreecommitdiffstats
path: root/ic_experiments/README.txt
diff options
context:
space:
mode:
Diffstat (limited to 'ic_experiments/README.txt')
-rw-r--r--ic_experiments/README.txt47
1 files changed, 47 insertions, 0 deletions
diff --git a/ic_experiments/README.txt b/ic_experiments/README.txt
new file mode 100644
index 0000000..80f6aa0
--- /dev/null
+++ b/ic_experiments/README.txt
@@ -0,0 +1,47 @@
+Description of the files
+========================
+
+* build_network.py: takes a .csv file containing a criminal network and builds
+ and extract a compressed binary representation tailored to make the other
+ scripts faster.
+
+ Takes one argument, the name of the .csv file. The output file has the same
+ name but the extension .pickle
+
+* ml.pyx: code to compute the likelihood of a given alpha (time component) and
+ delta (structural component) for a given infection graph. The optimization of
+ the beta parameter (probability of being a root) is done internally.
+
+* process.py: simple loop to do an exhaustive search over a range of alpha
+ (time component) and delta (structural component). The likelihood (and a few
+ other things) for each of the values is printed in the file "out.log".
+ Takes as argument the name of .pickle file computed by build_network.py
+ Prints columns as alpha, delta, beta, number of roots, likelihood
+
+* plot3d.py: code to obtain a 3d plot of the log likelihood as a function of
+ alpha and delta. Can also be easily modified to obtain 2d plots along
+ specific axes
+
+Installation
+============
+
+* most of the code uses standard python + numpy + matplotlib
+
+* the file ml.pyx is a Cython file which must be compiled in order to be used.
+At a high level, ml.pyx is compiled into ml.so. The line "import ml" in
+"process.py" will fail if the file ml.so is not present in the directory.
+Important: do not forget to recompile ml.pyx after changing it, otherwise you
+will be working with an outdated version of ml.so!
+
+How to compile? A Makefile is provided. If using make on MacOS is too
+complicated, it is also possible to compile .pyx files using python distutils
+(which I would assume is more standard on MacOS). This only requires distutils
+and a simple setup.py file. More details here:
+http://docs.cython.org/src/reference/compilation.html#configuring-the-c-build
+
+Running Code
+============
+python build_network.py ../../Results/dag_dat_all.csv
+python setup.py build_ext --inplace
+python process.py ../../Results/dag_dat_all.pickle
+python plot3d.py