tensorflow / privacy
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 611 units with 8,296 lines of code in units (81.8% of code).
    • 2 very long units (224 lines of code)
    • 17 long units (1,214 lines of code)
    • 104 medium size units (3,180 lines of code)
    • 136 small units (1,998 lines of code)
    • 352 very small units (1,680 lines of code)
2% | 14% | 38% | 24% | 20%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py2% | 14% | 38% | 24% | 20%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
tensorflow_privacy/privacy4% | 7% | 35% | 26% | 25%
research/pate_20180% | 32% | 34% | 18% | 14%
research/pate_20170% | 38% | 23% | 22% | 15%
tutorials0% | 14% | 66% | 18% | 1%
research/GDP_20190% | 0% | 88% | 0% | 11%
tutorials/walkthrough0% | 0% | 46% | 53% | 0%
g3doc0% | 0% | 0% | 93% | 6%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def _create_tpu_estimator_spec()
in tensorflow_privacy/privacy/estimators/v1/head.py
117 13 8
def _create_tpu_estimator_spec()
in tensorflow_privacy/privacy/estimators/v1/head.py
107 5 8
def inference_deeper()
in research/pate_2017/deep_cnn.py
100 5 2
def main()
in research/pate_2018/ICLR2018/rdp_bucketized.py
98 7 1
def compute_gradients()
in tensorflow_privacy/privacy/optimizers/dp_optimizer.py
92 15 8
def analyze_gnmax_conf_data_dep()
in research/pate_2018/ICLR2018/plot_partition.py
82 13 5
def main()
in tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/codelabs/example.py
81 6 1
def inference()
in research/pate_2017/deep_cnn.py
79 6 2
def print_plot_large()
in research/pate_2018/ICLR2018/rdp_cumulative.py
75 4 7
def run_analysis()
in research/pate_2018/ICLR2018/rdp_cumulative.py
70 9 4
def _create_tpu_estimator_spec()
in tensorflow_privacy/privacy/estimators/binary_class_head.py
69 3 10
def _create_tpu_estimator_spec()
in tensorflow_privacy/privacy/estimators/multi_label_head.py
68 3 10
def _create_tpu_estimator_spec()
in tensorflow_privacy/privacy/estimators/multi_class_head.py
68 3 10
def main()
in tutorials/mnist_dpsgd_tutorial_eager.py
61 16 1
def _find_optimal_smooth_sensitivity_parameters()
in research/pate_2018/ICLR2018/smooth_sensitivity_table.py
58 15 10
def main()
in research/pate_2017/analysis.py
56 19 1
def nn_model_fn()
in tutorials/movielens_tutorial.py
54 7 3
def extract_cifar10()
in research/pate_2017/input.py
52 15 2
def plot_partition()
in research/pate_2018/ICLR2018/plot_partition.py
51 5 3
def compute_gradients()
in tensorflow_privacy/privacy/optimizers/dp_optimizer_vectorized.py
50 10 8