Skip to content

Commit fa7e77f

Browse files
author
Andreagiovanni Reina
committed
improved documentation
1 parent 0f45e4d commit fa7e77f

File tree

3 files changed

+82
-10
lines changed

3 files changed

+82
-10
lines changed

README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,73 @@
11
# DecisionsOnNetworks
22
Simulation software to study consensus collective decisions on random networks with synchronous and asynchronous decision models.
3+
4+
This code allows you to generate all data and results presented in the article
5+
6+
Andreagiovanni Reina, Thomas Bose, Vaibhav Srivastava, and James A. R. Marshall, "Asynchrony rescues statistically-optimal group decisions from information cascades through emergent leaders" _The Royal Society Open Science_ (under review)
7+
8+
9+
## Dependencies
10+
11+
The Python code has been run with Python 3.6.8 and has the following dependencies from external libraries:
12+
* configparser
13+
* json
14+
* math
15+
* numpy
16+
* matplotlib
17+
* scipy
18+
* networkx
19+
* itertools
20+
21+
## Generate the data
22+
23+
24+
#### Figure 2
25+
26+
In order to reproduce the results reported in Figure 2 of the paper, that is, synchronous collective signal detection, you need to run the script
27+
```
28+
DecisionsOnNetworks/scripts/submitSynch.sh
29+
```
30+
which will exectute a large number of simulations for all conisidered conditions.
31+
On line [160 of `submitSynch.sh`](https://github.com/DiODeProject/DecisionsOnNetworks/blob/published_code/scripts/submitSynch.sh#L160) you can change the command to execute the Python code using the method that you prefer (default it is by submitting SLURM jobs).
32+
33+
If you wish to submit a single simulation run, for a specific condition, for the synchronous collective signal detection, you can do it by running the command:
34+
```
35+
cd DecisionsOnNetworks/src
36+
python3 DecNet/DecisionProcess.py ../conf/DecNet.config
37+
```
38+
You can modify any parameters in the configuration file `DecisionsOnNetworks/conf/DecNet.config`.
39+
Once the process had terminated, you can find the results in the folder `DecisionsOnNetworks/data`, which will include the text file `out.txt` (with the data used to generate the paper's Figures), and a graphical representation of each iteration step of each simulation as pdf files.
40+
41+
42+
#### Figure 3
43+
44+
In order to reproduce the results reported in Figure 3 of the paper, that is, asynchronous collective sequential sampling, you need to run the script
45+
```
46+
DecisionsOnNetworks/scripts/submitAsynch.sh
47+
```
48+
which will exectute a large number of simulations for all conisidered conditions.
49+
On line [139 of `submitAsynch.sh`](https://github.com/DiODeProject/DecisionsOnNetworks/blob/published_code/scripts/submitAsynch.sh#L139) you can change the command to execute the Python code using the method that you prefer (default it is by submitting SLURM jobs).
50+
51+
If you wish to submit a single simulation run, for a specific condition, for the asynchronous collective sequential sampling, you can do it by running the command:
52+
```
53+
cd DecisionsOnNetworks/src
54+
python3 AsynchKicks/DecisionProcess.py ../conf/AsynchK.config
55+
```
56+
You can modify any parameters in the configuration file `DecisionsOnNetworks/conf/AsynchK.config`.
57+
Once the process had terminated, you can find the results in the folder `DecisionsOnNetworks/data`, which will include text files `out.txt` with the information of the decision of the agents at the end of each simulation, the text file `out_cas.txt` with the cascade size of each simulation, and a graphical representation of each iteration step for each simulation as pdf files.
58+
59+
## Plot the data
60+
61+
#### Figure 1
62+
63+
The graphics of Figure 1 have been generated using the Mathematica notebook `DecisionsOnNetworks/plots/paperPlots.nb`.
64+
65+
#### Figure 2 and 3 and Supplementary Figures SF1, SF2, SF3, and SF6
66+
67+
The data generated with the Python simulator have been plotted using the Mathematica notebook `DecisionsOnNetworks/plots/paperPlots.nb`.
68+
69+
#### Figure 3(b) and Supplementary Figures SF4 and SF5
70+
71+
For Figure 3(b) and Supplementary Figures SF4 and SF5, the data generated with the Python simulator have been plotted using the R script `DecisionsOnNetworks/plots/plotKicks.R`, calling the function `plotCascadeOnRank()`.
72+
73+

conf/AsynchK.config

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ randomSeed=2289
33
# bad case for space with size 1 and range 0.3 seed: 1670054
44
numberOfExperiments=1
55
repetitionsPerDDM=1
6-
outputTxtFile=../../data/out.txt
7-
outputPdfFile=../../data/output
6+
outputTxtFile=../data/out.txt
7+
outputPdfFile=../data/output
88
cluster=false
99

1010
[Agent]
@@ -38,7 +38,7 @@ costMatrix=[ 1 , 100 ]
3838
number_of_nodes=50
3939
# possible netTypes are [ 'full' , 'erdos-renyi', 'barabasi-albert', 'space', 'soft-rgg', 'from-file', 'from-file-fixComm', 'rgg-fixed-degree' ]
4040
netType=rgg-fixed-degree
41-
number_of_edges=20
41+
number_of_edges=10
4242
link_probability=0.4
4343
area_size=1
4444
communication_radius=10

conf/DecNet.config

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@ randomSeed=2289
33
# bad case for space with size 1 and range 0.3 seed: 1670054
44
numberOfExperiments=3
55
repetitionsPerDDM=1
6-
outputTxtFile=../../data/out.txt
7-
outputPdfFile=../../data/output
6+
outputTxtFile=../data/out.txt
7+
outputPdfFile=../data/output
88
cluster=false
99

1010
[Agent]
1111
# possible agentTypes are [ 'simple' , 'DDM' ]
12-
agentType=DDM
12+
agentType=simple
1313
# possible decisionModels are [ 'conf-perfect', 'majority-rand', 'majority-bias', 'majority-inhibit', 'best-acc', 'best-conf', 'log-odds-perfect', 'log-odds-combo', 'log-odds-distr', 'log-odds-approx', 'belief' ]
14-
decisionModel=log-odds-distr
14+
decisionModel=conf-perfect
1515
max_iterations=100
1616
# possible updateConfs are [ 'no-up', 'theta-up', 'theta-norm', 'optim-up', 'belief-up', 'finite-time' ]
1717
updateConf=optim-up
1818
beliefEpsilon=0
1919
finiteTimeExponent=0.5
20+
misinformed=false
2021

2122
[SimpleAgent]
2223
accuracyMean = 0.6
@@ -36,13 +37,13 @@ interrogationTimeFromAccuracy=true
3637
interrogationTime=10
3738
prior=0.5
3839
# costMatrix accepts two values [ timeCost, errorCost ]
39-
costMatrix=[ 1 , 20 ]
40+
costMatrix=[ 1 , 100 ]
4041

4142
[Network]
42-
number_of_nodes=60
43+
number_of_nodes=50
4344
# possible netTypes are [ 'full' , 'erdos-renyi', 'barabasi-albert', 'space', 'soft-rgg', 'from-file', 'from-file-fixComm', 'rgg-fixed-degree' ]
4445
netType=rgg-fixed-degree
45-
number_of_edges=20
46+
number_of_edges=10
4647
link_probability=0.4
4748
area_size=1
4849
communication_radius=10

0 commit comments

Comments
 (0)