awslabs / mlm-scoring
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 98 units with 1,584 lines of code in units (83.2% of code).
    • 0 very complex units (0 lines of code)
    • 1 complex units (147 lines of code)
    • 4 medium complex units (169 lines of code)
    • 14 simple units (421 lines of code)
    • 79 very simple units (847 lines of code)
0% | 9% | 10% | 26% | 53%
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
py0% | 9% | 10% | 26% | 53%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
src/mlm/models0% | 38% | 0% | 0% | 61%
src/mlm0% | 0% | 14% | 35% | 50%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def get_pretrained()
in src/mlm/models/__init__.py
147 36 8
def bin()
in src/mlm/scorers.py
49 18 6
def cmd_score()
in src/mlm/cmds.py
57 18 1
def score()
in src/mlm/scorers.py
36 14 7
def _pad_arrs_to_max_length()
in src/mlm/batchify.py
27 14 6
def _batch_ops()
in src/mlm/scorers.py
23 10 6
def __init__()
in src/mlm/scorers.py
18 10 3
def __init__()
in src/mlm/batchify.py
24 10 6
def _ids_to_masked()
in src/mlm/scorers.py
21 9 2
def corpus_to_dataset()
in src/mlm/scorers.py
33 9 2
def from_dict()
in src/mlm/loaders.py
21 8 7
def cmd_bin()
in src/mlm/cmds.py
26 8 1
def rescore()
in src/mlm/loaders.py
13 7 5
def from_nmt()
in src/mlm/loaders.py
27 7 5
def _ids_to_masked()
in src/mlm/scorers.py
18 7 2
def bin()
in src/mlm/scorers.py
21 6 6
def score()
in src/mlm/scorers.py
72 6 7
def score()
in src/mlm/scorers.py
89 6 6
def setup_ctxs()
in src/mlm/cmds.py
15 6 1
def _edit_distance()
in src/mlm/loaders.py
15 5 2