Skip to content

Commit f47d5db

Browse files
committed
after code review changes
1 parent 06115b1 commit f47d5db

30 files changed

+430
-325
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,14 @@ source .env/bin/activate
4141
pip install -r requirements.txt
4242
```
4343

44+
## Running the code
45+
4446
To reproduce the plots from the paper, run
4547
```bash
4648
jupyter-lab
4749
```
4850
and open the file `scripts/DescriptiveAnalysis.ipynb`.
51+
On running the file (either in one go or cell by cell), all plots are saved to scripts/plots/ folder and also displayed in the notebook for easier viewing.
4952

5053
To reproduce the model fits from the paper
5154
- Ensure you have a working R installation
@@ -56,8 +59,12 @@ To reproduce the model fits from the paper
5659
setwd('/path/to/Relating_ObjectiveComplexity_SubjectiveComplexity_Beauty_BinaryPixelPatterns/scripts')
5760
source("process.R")
5861
source("MixedEffectsModelling.R")
62+
On running the file, all plots are saved to scripts/plots/ folder and tables are saved to model_fits/.
63+
Lines printed on the terminal can largely be ignored.
5964
```
6065

66+
67+
6168
## Citation
6269

6370
If you found this work useful, please consider citing us:

measures/Kolmogorov complexity/calculate_Kolmogorov_complexity.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
author = 'Surabhi S Nath'
22
import numpy as np
3-
import sys
43
from pybdm import BDM
54

65
"""

measures/entropy/calculate_entropy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def calculate_entropy(gridorflatgrid, grid_size):
2525
if len(uniq) == 1:
2626
return 0
2727

28-
p1 = cnts[0]/(cnts[0] + cnts[1]) # fraction of white pixels
29-
p2 = cnts[1]/(cnts[0] + cnts[1]) # fraction of black pixels
28+
p1 = cnts[1]/(cnts[0] + cnts[1]) # fraction of black pixels
29+
p2 = cnts[0]/(cnts[0] + cnts[1]) # fraction of white pixels
3030

3131
entropy = -1 * (p1 * math.log(p1,2) + p2 * math.log(p2,2)) # entropy equation (Eq. 1)
3232
return entropy

measures/entropy_of_means/calculate_entropy_of_means.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
Copyright 2014 Cosmo Harrigan
99
This program is free software, distributed under the terms of the GNU LGPL v3.0
1010
11+
Code copied from - https://github.com/cosmoharrigan/matrix-entropy in December 2021
12+
1113
Refer to Section 2.2 (2iii) and AII for details.
1214
"""
1315

@@ -40,6 +42,7 @@ def calculate_entropy_of_means(flatgrid, grid_size):
4042
prof = profile(matrices)
4143
return np.mean(prof)
4244

45+
# Part added by Surabhi S Nath for testing
4346
if __name__ == "__main__":
4447
grid_size = 15
4548

measures/mean_entropy/calculate_mean_entropy.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
author = 'Surabhi S Nath'
22
import numpy as np
3-
import math
43
import sys
54
sys.path.insert(1, '../entropy/')
65
from calculate_entropy import *

scripts/DescriptiveAnalysis.ipynb

Lines changed: 148 additions & 144 deletions
Large diffs are not rendered by default.

scripts/MixedEffectsModelling.R

Lines changed: 213 additions & 116 deletions
Large diffs are not rendered by default.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"","x"
2+
"(Intercept)",-0.0222955001151414
3+
"LSC",0.376565037489952
4+
"intricacy_4",0.255585403925477

0 commit comments

Comments
 (0)