facebookresearch / image-to-set
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 173 units with 2,666 lines of code in units (89.1% of code).
    • 2 very complex units (444 lines of code)
    • 1 complex units (79 lines of code)
    • 6 medium complex units (415 lines of code)
    • 27 simple units (604 lines of code)
    • 137 very simple units (1,124 lines of code)
16% | 2% | 15% | 22% | 42%
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
py16% | 2% | 15% | 22% | 42%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
src25% | 6% | 23% | 18% | 26%
src/utils27% | 0% | 7% | 23% | 42%
src/modules0% | 0% | 8% | 27% | 64%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def main()
in src/train.py
322 73 1
def build_vocab_recipe1m()
in src/utils/recipe1m_utils.py
122 55 1
def forward()
in src/model.py
79 34 7
def forward()
in src/modules/multihead_attention.py
77 20 9
def get_loader()
in src/data_loader.py
85 15 12
def main()
in src/eval.py
92 14 1
36 13 8
def get_model()
in src/model.py
93 13 2
def cluster_ingredients()
in src/utils/recipe1m_utils.py
32 11 1
def forward()
in src/modules/transformer_decoder.py
27 10 5
def remove_plurals()
in src/utils/recipe1m_utils.py
22 9 2
def __getitem__()
in src/data_loader.py
40 8 2
def __getitem__()
in src/data_loader.py
21 8 2
def __getitem__()
in src/data_loader.py
23 8 2
def parse_voc_xml()
in src/utils/voc_utils.py
14 8 2
def __init__()
in src/data_loader.py
41 7 10
def __getitem__()
in src/data_loader.py
20 7 2
def __init__()
in src/data_loader.py
29 7 7
def __init__()
in src/data_loader.py
26 7 7
def __init__()
in src/utils/voc_utils.py
34 7 7