aws-samples / deep-learning-models
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 837 units with 13,402 lines of code in units (55.2% of code).
    • 0 very complex units (0 lines of code)
    • 6 complex units (886 lines of code)
    • 20 medium complex units (1,165 lines of code)
    • 92 simple units (2,690 lines of code)
    • 719 very simple units (8,661 lines of code)
0% | 6% | 8% | 20% | 64%
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% | 6% | 8% | 20% | 64%
go0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
models/nlp/albert0% | 41% | 0% | 15% | 43%
models/nlp/electra0% | 68% | 0% | 0% | 31%
legacy/models/resnet0% | 14% | 12% | 21% | 50%
models/vision/detection0% | 1% | 11% | 24% | 61%
models/vision/classification0% | 5% | 6% | 6% | 81%
ci/frcnn0% | 0% | 0% | 23% | 76%
legacy/utils/tensorflow0% | 0% | 0% | 42% | 57%
ci/albert0% | 0% | 0% | 13% | 86%
models/nlp/common0% | 0% | 0% | 3% | 96%
models/nlp/t50% | 0% | 0% | 0% | 100%
legacy/hpc-cluster/monitor0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def main()
in models/nlp/albert/run_pretraining.py
248 42 0
def main()
in legacy/models/resnet/tensorflow/train_imagenet_resnet_hvd.py
162 36 0
def main()
in models/vision/classification/train_backbone.py
116 32 0
def main()
in models/nlp/electra/run_pretraining.py
220 30 0
def eval_map()
in models/vision/detection/awsdet/core/evaluation/mean_ap.py
80 29 7
def tpfp_imagenet()
in models/vision/detection/awsdet/core/evaluation/mean_ap.py
60 26 5
def tpfp_default()
in models/vision/detection/awsdet/core/evaluation/mean_ap.py
55 23 5
def ResNet()
in models/vision/classification/models/resnet_evo.py
74 21 14
def main_ec2()
in models/vision/detection/tools/train.py
76 20 2
def main()
in models/vision/detection/tools/test.py
58 20 0
def ResNet()
in models/vision/detection/awsdet/models/backbones/resnet_common.py
72 20 12
def main_sagemaker()
in models/vision/detection/tools/train.py
79 18 4
def train()
in legacy/models/resnet/mxnet/train_imagenet.py
43 18 1
def _get_targets_single()
in models/vision/detection/awsdet/core/anchor/anchor_target.py
81 15 7
def coco_eval()
in models/vision/detection/awsdet/core/evaluation/coco_utils.py
58 15 6
def call()
in models/vision/detection/awsdet/models/detectors/faster_rcnn.py
81 14 4
def print_map_summary()
in models/vision/detection/awsdet/core/evaluation/mean_ap.py
45 13 5
def __init__()
in models/vision/detection/awsdet/core/anchor/anchor_generator.py
45 12 10
def _build_single_target()
in models/vision/detection/awsdet/core/bbox/bbox_target.py
79 12 5
def after_train_epoch()
in models/vision/detection/awsdet/core/evaluation/eval_hooks.py
34 12 2