aws-samples / sagemaker-distributed-training-pytorch-kr
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 62 units with 1,334 lines of code in units (85.1% of code).
    • 0 very complex units (0 lines of code)
    • 1 complex units (130 lines of code)
    • 3 medium complex units (187 lines of code)
    • 10 simple units (421 lines of code)
    • 48 very simple units (596 lines of code)
0% | 9% | 14% | 31% | 44%
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% | 14% | 31% | 44%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
src_dir0% | 15% | 6% | 26% | 51%
train_code0% | 0% | 36% | 34% | 29%
util0% | 0% | 0% | 58% | 41%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def train()
in distributed_training/src_dir/main_trainer.py
130 27 2
def dist_model()
in distributed_training/src_dir/dis_util.py
20 17 2
def main()
in distributed_training/train_code/pytorch_mnist_smdp.py
135 13 0
def dist_init()
in distributed_training/src_dir/dis_util.py
32 11 2
def torch_model()
in distributed_training/src_dir/util.py
24 10 5
def plot_roc_curve_multiclass()
in distributed_training/util/inference_utils.py
41 9 6
def main()
in distributed_training/train_code/pytorch_mnist.py
127 9 0
def _loader_file()
in distributed_training/src_dir/main_trainer.py
26 9 2
def plot_pr_curve_multiclass()
in distributed_training/util/inference_utils.py
37 8 6
def validate()
in distributed_training/src_dir/main_trainer.py
63 8 6
def sync_s3_checkpoints_to_local()
in distributed_training/src_dir/util.py
25 8 3
def sync_local_checkpoints_to_s3()
in distributed_training/src_dir/util.py
22 7 3
def smp_savemodel()
in distributed_training/src_dir/dis_util.py
48 7 4
def smp_lossgather()
in distributed_training/src_dir/dis_util.py
8 6 2
def train()
in distributed_training/train_code/pytorch_mnist.py
21 5 6
def train()
in distributed_training/train_code/pytorch_mnist_smdp.py
21 5 6
def adjust_learning_rate()
in distributed_training/src_dir/util.py
11 5 5
def dist_setting()
in distributed_training/src_dir/dis_util.py
33 5 1
def main()
in distributed_training/src_dir/main_trainer.py
16 4 0
def training_step()
in distributed_training/train_code/tf_mnist_smdp.py
12 3 3