google / uncertainty-baselines
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,482 units with 47,623 lines of code in units (80.5% of code).
    • 79 very long units (22,429 lines of code)
    • 102 long units (6,714 lines of code)
    • 316 medium size units (10,165 lines of code)
    • 324 small units (4,752 lines of code)
    • 661 very small units (3,563 lines of code)
47% | 14% | 21% | 9% | 7%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py47% | 14% | 21% | 9% | 7%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
baselines/cifar90% | 0% | 5% | 2% | 1%
baselines/imagenet98% | 0% | <1% | <1% | <1%
baselines/jft47% | 18% | 24% | 5% | 4%
baselines/diabetic_retinopathy_detection37% | 7% | 26% | 14% | 12%
baselines/toxic_comments92% | 0% | 2% | 2% | 2%
baselines/clinc_intent84% | 0% | 6% | 2% | 5%
uncertainty_baselines/models10% | 31% | 36% | 13% | 7%
experimental/near_ood61% | 24% | 4% | 5% | 5%
experimental/single_model_uncertainty40% | 24% | 20% | 9% | 4%
baselines/drug_cardiotoxicity61% | 13% | 11% | 4% | 9%
experimental/deterministic36% | 25% | 24% | 9% | 4%
baselines/mnist29% | 38% | 30% | 0% | <1%
baselines/uci29% | 26% | 21% | 15% | 6%
experimental/one_vs_all16% | 39% | 17% | 12% | 14%
uncertainty_baselines/datasets0% | 12% | 46% | 25% | 14%
experimental/caltrain0% | 80% | 19% | 0% | 0%
uncertainty_baselines0% | 28% | 15% | 30% | 25%
experimental/cifar10_resnet200% | 75% | 0% | 0% | 25%
experimental/language_structure0% | 0% | 10% | 45% | 44%
experimental/diversity0% | 0% | 11% | 43% | 45%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in baselines/toxic_comments/sngp.py
685 80 1
def main()
in baselines/toxic_comments/dropout.py
618 75 1
def main()
in baselines/toxic_comments/deterministic.py
610 75 1
def main()
in baselines/jft/hetsngp.py
541 53 1
def main()
in baselines/jft/sngp.py
521 55 2
def main()
in baselines/jft/heteroscedastic.py
509 60 2
def main()
in baselines/jft/mimo.py
491 59 2
def main()
in baselines/jft/batchensemble.py
486 53 1
def main()
in baselines/jft/bit_deterministic.py
479 48 2
def main()
in experimental/near_ood/vit/deterministic.py
475 58 2
def main()
in baselines/jft/deterministic.py
474 58 2
def main()
in baselines/cifar/condconv.py
447 42 1
def main()
in baselines/diabetic_retinopathy_detection/jax_finetune_sngp.py
444 43 1
def main()
in baselines/toxic_comments/sngp_ensemble.py
434 53 1
def main()
in baselines/cifar/hetsngp.py
425 73 1
def main()
in baselines/cifar/hyperbatchensemble.py
417 28 1
def main()
in baselines/cifar/sngp.py
414 76 1
def main()
in baselines/toxic_comments/ensemble.py
407 51 1
def main()
in baselines/diabetic_retinopathy_detection/jax_finetune_deterministic.py
397 47 1
def main()
in baselines/diabetic_retinopathy_detection/fsvi.py
379 36 1