facebookresearch / connect-caption-and-trace
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 905 units with 14,288 lines of code in units (90.7% of code).
    • 1 very complex units (200 lines of code)
    • 21 complex units (1,762 lines of code)
    • 68 medium complex units (3,265 lines of code)
    • 90 simple units (2,747 lines of code)
    • 725 very simple units (6,314 lines of code)
1% | 12% | 22% | 19% | 44%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
py1% | 12% | 22% | 19% | 44%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
tools98% | 0% | 0% | 0% | 1%
captioning/models0% | 17% | 14% | 19% | 48%
captioning/data0% | 9% | 24% | 38% | 27%
captioning/utils0% | 0% | 50% | 8% | 40%
captioning/modules0% | 0% | 53% | 25% | 20%
scripts0% | 0% | 14% | 35% | 50%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def train()
in tools/train.py
200 76 1
def beam_search()
in captioning/models/CaptionModel_orig.py
116 43 5
def beam_search()
in captioning/models/CaptionModel.py
116 43 5
def _sample()
in captioning/models/AttModel_for_coco_caption_baseline.py
92 34 10
def _sample()
in captioning/models/AttModel_both.py
93 33 10
def _sample()
in captioning/models/AttModel_standard_enco_deco_both.py
94 33 9
def _sample()
in captioning/models/AttModel_for_coco_caption_task.py
88 33 10
def collate_func()
in captioning/data/dataloader_show_control_tell.py
95 32 3
def _sample()
in captioning/models/AttModel_both_backup_2020_11_11.py
87 31 10
def _sample()
in captioning/models/AttModel_both_backup_2020_11_07.py
87 31 9
def _sample()
in captioning/models/AttModel.py
77 27 9
def _sample()
in captioning/models/AttModel_caption_generation.py
77 27 8
def _diverse_sample()
in captioning/models/AttModel_both_backup_2020_11_11.py
74 26 5
def _diverse_sample()
in captioning/models/AttModel.py
74 26 5
def _diverse_sample()
in captioning/models/AttModel_both.py
74 26 5
def _diverse_sample()
in captioning/models/AttModel_encoder_trace.py
74 26 5
def _diverse_sample()
in captioning/models/AttModel_standard_enco_deco_both.py
74 26 5
def _diverse_sample()
in captioning/models/AttModel_caption_generation.py
74 26 5
def _diverse_sample()
in captioning/models/AttModel_orig.py
74 26 5
def _diverse_sample()
in captioning/models/AttModel_both_backup_2020_11_07.py
74 26 5