amazon-research / transformer-gan
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 198 units with 3,887 lines of code in units (75.2% of code).
    • 4 very complex units (964 lines of code)
    • 2 complex units (314 lines of code)
    • 10 medium complex units (555 lines of code)
    • 29 simple units (724 lines of code)
    • 153 very simple units (1,330 lines of code)
24% | 8% | 14% | 18% | 34%
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
py24% | 8% | 14% | 18% | 34%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
model38% | 1% | 16% | 11% | 31%
BERT24% | 45% | 8% | 11% | 10%
model/utils0% | 0% | 19% | 37% | 42%
metrics0% | 0% | 0% | 48% | 51%
data0% | 0% | 0% | 14% | 85%
ROOT0% | 0% | 0% | 100% | 0%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def train()
in model/train.py
376 94 0
def forward()
in model/transformer_gan.py
210 73 8
def main()
in model/generate.py
227 69 1
def train()
in BERT/main.py
151 56 4
def main()
in BERT/main.py
276 47 0
def weights_init()
in model/train.py
38 29 1
def evaluate()
in model/train.py
58 20 4
def iterator()
in model/data_utils.py
64 19 0
def _forward()
in model/mem_transformer.py
71 16 5
def discriminator()
in model/utils/config_helper.py
51 15 1
def __init__()
in model/data_utils.py
60 13 3
def forward()
in model/utils/proj_adaptive_softmax.py
62 13 4
def __init__()
in BERT/main.py
50 12 5
def step()
in model/lamb.py
38 12 2
def get_losses()
in model/utils/helpers.py
41 12 3
def forward()
in model/mem_transformer.py
60 11 7
def iterator()
in model/data_utils.py
37 10 0
def generate_tokens()
in model/train.py
34 9 4
def notes_mapping()
in model/data_utils.py
11 9 1
def iterator()
in model/data_utils.py
36 9 0