facebookresearch / UnsupervisedMT
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 209 units with 4,284 lines of code in units (92.7% of code).
    • 2 very complex units (235 lines of code)
    • 8 complex units (820 lines of code)
    • 16 medium complex units (744 lines of code)
    • 36 simple units (913 lines of code)
    • 147 very simple units (1,572 lines of code)
5% | 19% | 17% | 21% | 36%
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
py5% | 19% | 17% | 21% | 36%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
NMT/src/data21% | 0% | 10% | 32% | 35%
NMT/src6% | 20% | 11% | 26% | 34%
NMT/src/model0% | 28% | 28% | 18% | 24%
NMT0% | 25% | 0% | 0% | 74%
NMT/src/modules0% | 0% | 32% | 9% | 58%
PBSMT/src0% | 0% | 0% | 9% | 90%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def check_all_data_params()
in NMT/src/data/loader.py
132 97 1
def test_sharing()
in NMT/src/test.py
103 68 4
def generate()
in NMT/src/sequence_generator.py
238 47 7
def check_mt_model_params()
in NMT/src/model/__init__.py
56 45 1
def __init__()
in NMT/src/model/attention.py
106 38 3
def generate_beam()
in NMT/src/model/attention.py
125 38 7
def __init__()
in NMT/src/model/seq2seq.py
86 30 3
def main()
in NMT/main.py
70 29 1
def initialize_embeddings()
in NMT/src/model/pretrain_embeddings.py
51 29 4
def __init__()
in NMT/src/trainer.py
88 28 7
def generate()
in NMT/src/model/attention.py
69 22 6
def __init__()
in NMT/src/model/transformer.py
66 20 3
def generate()
in NMT/src/model/seq2seq.py
57 20 6
def __init__()
in NMT/src/model/lm.py
49 19 5
def forward()
in NMT/src/modules/multihead_attention.py
78 18 9
def __init__()
in NMT/src/model/seq2seq.py
51 15 2
def get_dump_path()
in NMT/src/utils.py
26 14 1
def get_optimizer()
in NMT/src/utils.py
46 14 2
def load_para_data()
in NMT/src/data/loader.py
37 14 2
def __init__()
in NMT/src/model/attention.py
49 13 2