awslabs / keras-apache-mxnet
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,793 units with 22,855 lines of code in units (90.4% of code).
    • 19 very long units (2,941 lines of code)
    • 56 long units (3,753 lines of code)
    • 223 medium size units (6,932 lines of code)
    • 287 small units (4,286 lines of code)
    • 1,208 very small units (4,943 lines of code)
12% | 16% | 30% | 18% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py12% | 16% | 30% | 18% | 21%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
keras/engine38% | 27% | 11% | 14% | 8%
keras/backend13% | 5% | 29% | 23% | 27%
keras/utils9% | 23% | 32% | 17% | 17%
benchmark/scripts17% | 26% | 25% | 9% | 20%
keras/layers0% | 21% | 43% | 12% | 22%
keras0% | 16% | 24% | 27% | 30%
keras/legacy0% | 17% | 50% | 22% | 9%
keras/preprocessing0% | 33% | 45% | 15% | 5%
keras/datasets0% | 0% | 52% | 34% | 12%
benchmark/sparse0% | 0% | 62% | 32% | 4%
keras/wrappers0% | 0% | 0% | 60% | 39%
keras/applications0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def compile()
in keras/engine/training.py
336 98 9
def rnn()
in keras/backend/mxnet_backend.py
303 42 10
def get_model()
in keras/backend/mxnet_backend.py
296 116 0
def fit_generator()
in keras/engine/training_generator.py
208 19 14
def fit_loop()
in keras/engine/training_arrays.py
147 18 15
def preprocess_weights_for_loading()
in keras/engine/saving.py
147 42 5
def rnn()
in keras/backend/tensorflow_backend.py
146 17 8
def _standardize_user_data()
in keras/engine/training.py
141 46 7
def print_summary()
in keras/utils/layer_utils.py
121 46 4
def _init_graph_network()
in keras/engine/network.py
120 29 5
def rnn()
in keras/backend/theano_backend.py
120 29 8
def _deserialize_model()
in keras/engine/saving.py
111 25 3
def run_internal_graph()
in keras/engine/network.py
110 41 3
def fit()
in keras/engine/training.py
109 24 16
def get_optimizers()
in keras/backend/mxnet_backend.py
108 5 0
def _serialize_model()
in keras/engine/saving.py
106 33 3
def rnn()
in keras/backend/cntk_backend.py
105 38 8
def run_benchmark()
in benchmark/scripts/models/lstm_text_generation.py
105 20 5
def evaluate_generator()
in keras/engine/training_generator.py
102 29 7
def _map_graph_network()
in keras/engine/network.py
100 21 2