awslabs / autogluon
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 1,825 units with 24,416 lines of code in units (88.0% of code).
    • 19 very long units (2,773 lines of code)
    • 67 long units (4,661 lines of code)
    • 207 medium size units (6,480 lines of code)
    • 330 small units (4,797 lines of code)
    • 1,202 very small units (5,705 lines of code)
11% | 19% | 26% | 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
py11% | 19% | 26% | 19% | 23%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
tabular/src10% | 17% | 24% | 21% | 25%
text/src32% | 16% | 30% | 10% | 9%
core/src6% | 19% | 30% | 18% | 24%
vision/src27% | 38% | 19% | 7% | 8%
common/src0% | 21% | 20% | 34% | 23%
features/src0% | 7% | 20% | 29% | 41%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train_function()
in text/src/autogluon/text/text_prediction/mx/models.py
361 72 21
def train()
in text/src/autogluon/text/text_prediction/mx/models.py
216 12 13
def fit()
in vision/src/autogluon/vision/predictor/predictor.py
172 55 7
def fit()
in text/src/autogluon/text/text_prediction/predictor/predictor.py
155 31 14
def early_stopping_custom()
in tabular/src/autogluon/tabular/models/lgb/callbacks.py
154 58 11
def _load()
in core/src/autogluon/core/utils/serialization.py
153 29 4
def train_net()
in tabular/src/autogluon/tabular/models/tabular_nn/mxnet/tabular_nn_mxnet.py
152 48 8
def _train_net()
in tabular/src/autogluon/tabular/models/tabular_nn/torch/tabular_nn_torch.py
143 38 10
def distill()
in core/src/autogluon/core/trainer/abstract_trainer.py
136 45 17
def _fit()
in tabular/src/autogluon/tabular/models/lgb/lgb_model.py
130 21 12
def score_debug()
in tabular/src/autogluon/tabular/learner/abstract_learner.py
120 26 7
def compute_permutation_feature_importance()
in core/src/autogluon/core/utils/utils.py
120 11 17
def evaluate_predictions()
in tabular/src/autogluon/tabular/learner/abstract_learner.py
114 29 6
def _train_image_classification()
in vision/src/autogluon/vision/_gluoncv/image_classification.py
114 41 2
def fit()
in tabular/src/autogluon/tabular/predictor/predictor.py
112 30 8
def _fit()
in tabular/src/autogluon/tabular/models/fastainn/tabular_nn_fastai.py
108 25 10
def auto_suggest()
in vision/src/autogluon/vision/_gluoncv/utils.py
106 29 3
def __init__()
in text/src/autogluon/text/text_prediction/mx/modules.py
104 16 12
def pac_score()
in core/src/autogluon/core/metrics/classification_metrics.py
103 32 2
def _fit_folds()
in core/src/autogluon/core/models/ensemble/bagged_ensemble_model.py
100 17 16