Skip to content

Replication package, supplementary materials, and analysis pipeline for our ICSE'21 fMRI study paper.

License

Notifications You must be signed in to change notification settings

brains-on-code/fMRI-complexity-metrics-icse2021

Repository files navigation

Program Comprehension and Code Complexity Metrics: An fMRI Study

Python analysis pipelineCC BY-SA 4.0DOI

This repository contains the replication package, analysis scripts, and additional information on our paper accepted at ICSE 2021.

Publication: Norman Peitek, Sven Apel, Chris Parnin, André Brechmann, and Janet Siegmund. Program Comprehension and Code Complexity Metrics: An fMRI Study. In Proceedings of the International Conference of Software Engineering (ICSE) 2021, pages 524-536. ACM SIGSOFT Distinguished Paper Award. (preprint pdf, Digital Library)

Replication Package

In /replication, we provide:

  • all used stimuli for the comprehension, control condition, and distractor tasks (/tasks-*) either as image and/or text file. We used our CodeImageGenerator to create image files for our Java code snippets.
  • experiment protocol for the fMRI session
  • the meta protocol for the post-session interview

Data

In /data, we share all raw and preprocessed data that we can. Due to our local privacy law, we cannot publicly provide the fMRI data at this time. Please contact us for individual solutions.

Analysis

In /analysis, we share our analysis scripts that process the input data, compute the results, create plots, and run statistics.

To run the script yourself, you will need:

  • Python 3.x
  • matplotlib
  • numpy
  • pandas
  • pytest
  • scipy
  • seaborn
  • statsmodels

You can install all dependencies via:

pip install -r requirements.txt

Once your system is ready, start the pipeline:

python main.py ## or pytest

The analysis output is located in /analysis/output.

Test Your Own Metric?

If you want to test your own metric and evaluate whether it better fits our captured data, please add an additional column with the metric values for each snippet in data/metrics/SnippetComplexityMetricsValues.csv. Then, start a full pipeline run as described above. Please contact us if you have any problems.

Results

For convenience, we provide all output that the analysis script yields for our data in /analysis/output.

Experiment Data: fMRI Correlations

In addition to the selected plots presented in the paper, we added all correlation plots in /analysis/output.

Experiment Data: Additional Metrics

We explored overall 41 additional metrics. In /data/metrics/Metrics.md, we provide a description of each metric.

In the paper, we provide a shortened overview. Here is the full correlation table:

MetricBA21_kenBA39_kenBroca_kenBA6_kenBA21_r2BA39_r2Broca_r2BA6_r2Maximum
BRANCH0.5577730.2921670.1593640.5046520.4157990.1035520.0789380.2077150.557773
CALL0.3703280.2057380.1645900.2674590.2047530.0717830.0510560.0731250.370328
CALLED-0.2086560.0000000.130410-0.1825740.0567150.0176780.1069360.0010900.130410
CALLEDp-0.2086560.0000000.130410-0.1825740.0567150.0176780.1069360.0010900.130410
CAST-0.104328-0.1564920.000000-0.0521640.0268990.0156240.0037730.0013460.026899
CDENS0.010120-0.070837-0.0505980.0910770.0116460.0000510.0102240.0306270.091077
CONTROL0.2148340.1329930.0102300.2966760.1971860.0393130.0014420.1190850.296676
D0.4098780.4489140.4098780.5074680.3499980.1882000.2120850.2601510.507468
E-0.066667-0.0095240.028571-0.0666670.2730730.1843450.0503030.3079430.307943
ev(G)0.2736080.1894210.0841870.2315150.1431750.0470720.0323340.0494830.273608
EXEC0.1440160.1851640.0205740.1645900.1186120.0711810.0001210.0600930.185164
EXP0.3365540.3173220.1634690.4519440.3684320.1875180.0689060.3121630.451944
IF_NEST0.2679460.3062240.2679460.3062240.1487370.1008190.0844060.0905010.306224
iv(G)0.3822000.1042360.0579090.3358720.2086810.0195240.0070820.0777220.382200
LOC_one0.3746070.3943230.2365940.3746070.2704070.2164310.0533830.1356010.394323
LOOP0.4805000.2162250.1201250.3603750.3240370.0467730.0165820.1096200.480500
LOOP_NEST0.4805000.2162250.1201250.3603750.3240370.0467730.0165820.1096200.480500
N0.3557860.3365540.1827010.4134810.2849070.1721970.0475510.2659630.413481
n0.3548910.1774450.1182970.3746070.1988260.0297160.0119630.1748600.374607
NBD0.5445410.2949600.2042030.3630270.4218600.1287770.0848840.1388060.544541
NCLOC0.3746070.3943230.2365940.3746070.2704070.2164310.0533830.1356010.394323
NP0.2656060.5577730.5046520.3984100.0825580.3186650.1989420.1184550.557773
QCP_CRCT0.3478630.3092110.1546060.4058400.3263700.1493370.0689160.2246250.405840
QCP_MAINT0.3253630.3253630.1722510.4019180.2732950.1502780.0338300.2365000.401918
QCP_RLBTY0.2679460.2679460.1148340.3445020.2541330.1163410.0174040.1935010.344502
RETURN-0.326823-0.181568-0.084732-0.3268230.1351910.0291610.0226660.1082890.135191
RLOC0.3746070.3154590.1577290.3746070.3238200.1020570.0047630.1350610.374607
STAT0.2302880.2503130.0700880.2903630.1705800.0708650.0004830.0928280.290363
V0.3557860.2596270.1442370.4134810.3292360.1361280.0403580.3023620.413481
v(G)0.1028690.1234430.0000000.2057380.0514200.0229820.0008000.0469780.205738
DepDegree0.3981330.3787120.2621850.4369760.2785110.2367200.0900760.1739220.436976
LOC_two0.4194390.2352950.1534530.3375970.3823080.0964560.0270580.1810270.419439
McCabe0.1028690.1234430.0000000.2057380.0514200.0229820.0008000.0469780.205738
Halstead0.4857140.5428570.4285710.6000000.3932180.2093510.2139380.2885640.600000
Sonar_Cog0.2390460.1394430.0398410.2988070.2375280.0570540.0162820.1318110.298807
Sonar_Cyclo0.1028690.1234430.0000000.2057380.0514200.0229820.0008000.0469780.205738

License

This repository is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Contact

If you have questions, please contact me directly: peitek@cs.uni-saarland.de. Thank you!

close