tensorflow / estimator
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,771 units with 26,135 lines of code in units (90.3% of code).
    • 9 very long units (1,240 lines of code)
    • 68 long units (4,461 lines of code)
    • 383 medium size units (11,398 lines of code)
    • 328 small units (5,024 lines of code)
    • 983 very small units (4,012 lines of code)
4% | 17% | 43% | 19% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py4% | 17% | 43% | 19% | 15%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
tensorflow_estimator/python/estimator/canned4% | 14% | 49% | 17% | 14%
tensorflow_estimator/python/estimator/tpu8% | 22% | 29% | 21% | 17%
tensorflow_estimator/python/estimator/inputs21% | 23% | 27% | 25% | 2%
tensorflow_estimator/python/estimator3% | 17% | 37% | 23% | 18%
tensorflow_estimator/python/estimator/head0% | 27% | 42% | 16% | 12%
tensorflow_estimator/python/estimator/tools0% | 36% | 48% | 0% | 14%
tensorflow_estimator/python/estimator/export0% | 0% | 33% | 27% | 39%
tensorflow_estimator/python/estimator/hooks0% | 0% | 38% | 23% | 38%
tensorflow_estimator/tools/pip_package0% | 0% | 43% | 56% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def _augment_model_fn()
in tensorflow_estimator/python/estimator/tpu/tpu_estimator.py
299 67 3
def minimize()
in tensorflow_estimator/python/estimator/canned/linear_optimizer/python/utils/sdca_ops.py
135 6 3
def predict()
in tensorflow_estimator/python/estimator/canned/timeseries/ar_model.py
131 14 2
def _enqueue_data()
in tensorflow_estimator/python/estimator/inputs/queues/feeding_functions.py
122 35 10
def get_batch_loss()
in tensorflow_estimator/python/estimator/canned/timeseries/ar_model.py
119 15 4
def _train_with_estimator_spec()
in tensorflow_estimator/python/estimator/estimator.py
114 8 6
def _create_tpu_estimator_spec()
in tensorflow_estimator/python/estimator/canned/head.py
113 12 8
def _dnn_linear_combined_model_fn()
in tensorflow_estimator/python/estimator/canned/dnn_linear_combined.py
104 15 15
def _create_tpu_estimator_spec()
in tensorflow_estimator/python/estimator/canned/head.py
103 5 8
def generate_per_host_v2_enqueue_ops_fn_for_host()
in tensorflow_estimator/python/estimator/tpu/tpu_estimator.py
97 11 6
def __init__()
in tensorflow_estimator/python/estimator/tpu/tpu_estimator.py
95 28 16
def _dnn_linear_combined_model_fn_v2()
in tensorflow_estimator/python/estimator/canned/dnn_linear_combined.py
92 20 15
def __init__()
in tensorflow_estimator/python/estimator/head/multi_label_head.py
90 21 9
def _validate_tpu_configuration()
in tensorflow_estimator/python/estimator/tpu/tpu_context.py
89 27 1
def _update_statistics_from_mini_batch()
in tensorflow_estimator/python/estimator/canned/timeseries/math_utils.py
89 8 5
def _create_tpu_estimator_spec()
in tensorflow_estimator/python/estimator/canned/head.py
87 12 8
def _actual_train_model_distributed()
in tensorflow_estimator/python/estimator/estimator.py
85 5 5
def _invoke_input_fn_and_record_structure()
in tensorflow_estimator/python/estimator/tpu/tpu_estimator.py
85 21 1
def _create_keras_model_fn()
in tensorflow_estimator/python/estimator/keras_lib.py
83 23 5
def get_weights_and_check_match_logits()
in tensorflow_estimator/python/estimator/head/base_head.py
83 20 4