aws-samples / aws-ml-jp
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 193 units with 3,040 lines of code in units (63.1% of code).
    • 1 very long units (219 lines of code)
    • 17 long units (1,031 lines of code)
    • 17 medium size units (538 lines of code)
    • 35 small units (526 lines of code)
    • 123 very small units (726 lines of code)
7% | 33% | 17% | 17% | 23%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py7% | 33% | 17% | 17% | 23%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
vision/amazon-sagemaker-pytorch-detectron229% | 34% | 14% | 9% | 11%
sagemaker/distributed-training0% | 72% | 14% | 12% | 0%
sagemaker/sagemaker-inference0% | 36% | 3% | 22% | 37%
autogluon/tabular-prediction0% | 30% | 27% | 21% | 20%
sagemaker/sagemaker-experiments0% | 39% | 0% | 11% | 49%
sagemaker/hpo-pytorch-mnist0% | 46% | 0% | 13% | 40%
sagemaker/workshop0% | 0% | 91% | 0% | 8%
mlops/edge-deploy0% | 0% | 81% | 0% | 18%
ai-services/forecast0% | 0% | 30% | 35% | 33%
inference/edge0% | 0% | 33% | 16% | 50%
nlp/nlp_amazon_review0% | 0% | 0% | 60% | 40%
mlops/sagemaker-pipelines0% | 0% | 0% | 42% | 57%
sagemaker/tensorflow2-training-and-serving0% | 0% | 0% | 46% | 53%
sagemaker/sagemaker-processing0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def _parse_args()
in vision/amazon-sagemaker-pytorch-detectron2/container_training/sku-110k/training.py
219 1 0
def main()
in sagemaker/distributed-training/train_pytorch_single_maskrcnn.py
91 5 0
def main()
in sagemaker/distributed-training/train_pytorch_smdataparallel_maskrcnn.py
87 7 0
def evaluate()
in vision/amazon-sagemaker-pytorch-detectron2/container_training/sku-110k/evaluation/coco.py
79 25 1
def train()
in autogluon/tabular-prediction/AutoGluon-Tabular-with-SageMaker/container-training/train.py
74 13 1
def summarize()
in vision/amazon-sagemaker-pytorch-detectron2/container_training/sku-110k/evaluation/coco.py
67 14 1
def _train_impl()
in vision/amazon-sagemaker-pytorch-detectron2/container_training/sku-110k/training.py
58 10 1
def train()
in sagemaker/distributed-training/train_pytorch_smdataparallel_maskrcnn.py
55 9 2
def train()
in sagemaker/sagemaker-inference/pytorch/code_inf1/train.py
53 17 1
def train()
in sagemaker/distributed-training/train_pytorch_single_maskrcnn.py
53 7 2
def train()
in sagemaker/hpo-pytorch-mnist/mnist.py
52 17 1
def train()
in sagemaker/sagemaker-inference/pytorch/code_byoc/train.py
52 17 1
def train()
in sagemaker/sagemaker-inference/pytorch/code_async/train.py
52 17 1
def train()
in sagemaker/sagemaker-inference/pytorch/code_lambda/train.py
52 17 1
def train()
in sagemaker/sagemaker-inference/pytorch/code_mme/train.py
52 17 1
def train()
in sagemaker/sagemaker-experiments/pytorch_mnist/src/mnist_train.py
52 17 1
def _eval_predictions()
in vision/amazon-sagemaker-pytorch-detectron2/container_training/sku-110k/evaluation/coco.py
51 13 3
def show_classification_report_confusion_matrix()
in autogluon/tabular-prediction/AutoGluon-Tabular-with-SageMaker/utils/ag_utils.py
51 6 1
def transform_fn()
in autogluon/tabular-prediction/AutoGluon-Tabular-with-SageMaker/container-training/inference.py
45 2 4
def _config_training()
in vision/amazon-sagemaker-pytorch-detectron2/container_training/sku-110k/training.py
44 5 1