facebookresearch / neural_stpp
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 320 units with 2,892 lines of code in units (82.2% of code).
    • 1 very long units (236 lines of code)
    • 4 long units (237 lines of code)
    • 21 medium size units (624 lines of code)
    • 50 small units (706 lines of code)
    • 244 very small units (1,089 lines of code)
8% | 8% | 21% | 24% | 37%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py8% | 8% | 21% | 24% | 37%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT20% | 10% | 14% | 27% | 26%
data0% | 34% | 37% | 6% | 21%
models/spatial0% | 6% | 34% | 25% | 33%
models/temporal0% | 0% | 29% | 26% | 44%
flow_layers0% | 0% | 18% | 35% | 46%
diffeq_layers0% | 0% | 0% | 16% | 83%
models0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def _main()
in train_stpp.py
236 48 5
def EM()
in MHP.py
71 10 12
def main()
in data/download_and_preprocess_covid19.py
62 6 0
52 4 2
def _cond_logliks()
in models/spatial/jumpcnf.py
52 13 5
def integrate_lambda()
in models/temporal/neural.py
45 17 7
def process()
in data/download_and_preprocess_citibike.py
43 6 2
def _cond_logliks()
in models/spatial/attncnf.py
41 8 5
def forward()
in models/spatial/attention.py
38 5 5
38 14 5
def plot_density()
in viz_dataset.py
36 4 10
def plot_kde()
in viz_dataset.py
31 4 7
def integrate()
in models/spatial/cnf.py
30 7 9
def forward()
in models/spatial/cnf.py
30 10 3
def forward()
in models/spatial/attention.py
27 5 5
def test_einsum_op()
in models/spatial/attention.py
27 5 0
def test_attn_mask()
in models/spatial/attention.py
27 2 0
def build_fc_odefunc()
in models/spatial/cnf.py
26 13 10
def __init__()
in models/temporal/neural.py
25 6 12
def get_logger()
in utils.py
25 6 5