aws-samples / amazon-sagemaker-examples-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 99 units with 1,541 lines of code in units (56.7% of code).
    • 0 very long units (0 lines of code)
    • 8 long units (515 lines of code)
    • 11 medium size units (365 lines of code)
    • 20 small units (293 lines of code)
    • 60 very small units (368 lines of code)
0% | 33% | 23% | 19% | 23%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 33% | 23% | 19% | 23%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
distributed_training0% | 72% | 14% | 12% | 0%
autogluon0% | 30% | 27% | 21% | 20%
sagemaker-experiments0% | 39% | 0% | 11% | 49%
hpo_pytorch_mnist0% | 46% | 0% | 13% | 40%
workshop0% | 0% | 91% | 0% | 8%
amazon_forecast_tutorial0% | 0% | 30% | 35% | 33%
edge_inference0% | 0% | 33% | 16% | 50%
nlp_amazon_review0% | 0% | 0% | 60% | 40%
mlops0% | 0% | 0% | 42% | 57%
tensorflow2_training_and_serving0% | 0% | 0% | 46% | 53%
sagemaker_processing0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in distributed_training/train_pytorch_single_maskrcnn.py
91 5 0
def main()
in distributed_training/train_pytorch_smdataparallel_maskrcnn.py
87 7 0
def train()
in autogluon/tabular-prediction/AutoGluon-Tabular-with-SageMaker/container-training/train.py
74 13 1
def train()
in distributed_training/train_pytorch_smdataparallel_maskrcnn.py
55 9 2
def train()
in distributed_training/train_pytorch_single_maskrcnn.py
53 7 2
def train()
in hpo_pytorch_mnist/mnist.py
52 17 1
def train()
in sagemaker-experiments/pytorch_mnist/src/mnist_train.py
52 17 1
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 cnn_model_fn()
in workshop/lab_bring-your-own-model/tensorflow/cnn_mnist_after.py
39 12 3
def cnn_model_fn()
in workshop/lab_bring-your-own-model/tensorflow/cnn_mnist_before.py
39 12 3
def get_or_create_iam_role()
in amazon_forecast_tutorial/common/util/fcst_utils.py
37 2 1
def get_roc_auc()
in autogluon/tabular-prediction/AutoGluon-Tabular-with-SageMaker/container-training/train.py
37 7 5
def main()
in workshop/lab_bring-your-own-model/tensorflow/cnn_mnist_after.py
32 5 1
def test_model()
in distributed_training/train_pytorch_single_maskrcnn.py
28 7 3
def test_model()
in distributed_training/train_pytorch_smdataparallel_maskrcnn.py
28 7 3
def download_model_output()
in autogluon/tabular-prediction/AutoGluon-Tabular-with-SageMaker/utils/ag_utils.py
28 6 3
def classifier()
in edge_inference/greengrass-ml-inference/src/classifier_train.py
27 1 0
def main()
in workshop/lab_bring-your-own-model/tensorflow/cnn_mnist_before.py
25 4 1
def __init__()
in nlp_amazon_review/GluonNLP_BERT/src/bert/data/transform.py
20 7 8