microsoft / AzureML-BERT
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 254 units with 3,234 lines of code in units (74.1% of code).
    • 1 very complex units (278 lines of code)
    • 6 complex units (602 lines of code)
    • 12 medium complex units (629 lines of code)
    • 20 simple units (489 lines of code)
    • 215 very simple units (1,236 lines of code)
8% | 18% | 19% | 15% | 38%
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
py8% | 18% | 19% | 15% | 38%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
finetune23% | 20% | 20% | 5% | 30%
finetune/PyTorch0% | 59% | 0% | 12% | 27%
finetune/TensorFlow0% | 10% | 24% | 17% | 48%
pretrain/PyTorch0% | 0% | 25% | 26% | 47%
pretrain/PyTorch/dataprep0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def main()
in finetune/run_squad_azureml.py
278 67 0
def main()
in finetune/PyTorch/run_classifier_azureml.py
244 47 0
def convert_examples_to_features()
in finetune/run_squad_azureml.py
121 32 6
def run_evaluation()
in finetune/run_classifier_azureml.py
86 28 3
def convert_examples_to_features()
in finetune/PyTorch/run_classifier_azureml.py
56 27 4
def convert_single_example()
in finetune/TensorFlow/run_classifier.py
54 26 5
def convert_examples_to_features()
in finetune/run_classifier_azureml.py
41 26 5
def main()
in finetune/TensorFlow/run_classifier.py
130 23 1
def create_hooks()
in pretrain/PyTorch/distributed_apex.py
59 23 1
def get_final_text()
in finetune/run_squad_azureml.py
50 21 4
def write_predictions()
in finetune/run_squad_azureml.py
101 20 9
def create_training_instance()
in pretrain/PyTorch/sources.py
53 17 2
def read_squad_examples()
in finetune/run_squad_azureml.py
56 16 2
def _check_is_max_context()
in finetune/run_squad_azureml.py
16 16 3
def forward()
in pretrain/PyTorch/distributed_apex.py
30 16 3
def __init__()
in pretrain/PyTorch/distributed_apex.py
57 13 11
def compute_metrics()
in finetune/run_classifier_azureml.py
24 11 3
def sync_bucket_structure()
in pretrain/PyTorch/distributed_apex.py
26 11 1
def __init__()
in pretrain/PyTorch/sources.py
27 11 7
def create_masked_lm_predictions()
in pretrain/PyTorch/dataset.py
35 10 2