amazon-research / hyperbolic-embeddings
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 187 units with 2,784 lines of code in units (89.5% of code).
    • 5 very long units (1,313 lines of code)
    • 4 long units (224 lines of code)
    • 14 medium size units (397 lines of code)
    • 16 small units (223 lines of code)
    • 148 very small units (627 lines of code)
47% | 8% | 14% | 8% | 22%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py47% | 8% | 14% | 8% | 22%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
hype_kg/codes64% | 5% | 16% | 3% | 10%
hype_kg/codes/optimizers0% | 71% | 0% | 13% | 14%
product_matching0% | 17% | 16% | 32% | 32%
hype_kg/codes/utils0% | 0% | 39% | 0% | 60%
hype_kg/codes/manifolds0% | 0% | 0% | 15% | 84%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in hype_kg/codes/run.py
690 143 1
def forward()
in hype_kg/codes/model.py
181 65 5
def test_step()
in hype_kg/codes/model.py
165 27 5
def BoxTransE()
in hype_kg/codes/model.py
145 20 9
def __init__()
in hype_kg/codes/model.py
132 25 25
def step()
in hype_kg/codes/optimizers/radam.py
62 18 3
def parse_args()
in hype_kg/codes/run.py
58 1 1
def TransE()
in hype_kg/codes/model.py
52 13 9
def build()
in product_matching/hyperboloid.py
52 2 1
def build()
in product_matching/euclidean_intersection.py
49 2 1
def train_step()
in hype_kg/codes/model.py
47 6 5
def forward()
in hype_kg/codes/model.py
37 13 7
def __init__()
in hype_kg/codes/model.py
30 7 9
def forward()
in hype_kg/codes/model.py
28 14 3
def forward()
in hype_kg/codes/model.py
26 7 5
def save_model()
in hype_kg/codes/run.py
24 5 5
def __getitem__()
in hype_kg/codes/dataloader.py
23 3 2
def __getitem__()
in hype_kg/codes/dataloader.py
23 3 2
def hyperbolicity_sample()
in hype_kg/codes/utils/hyperbolicity.py
23 3 2
def forward()
in hype_kg/codes/model.py
23 6 7