aws-samples / amazon-sagemaker-tsp-deep-rl
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 25 units with 701 lines of code in units (85.4% of code).
    • 2 very long units (261 lines of code)
    • 2 long units (149 lines of code)
    • 4 medium size units (119 lines of code)
    • 8 small units (122 lines of code)
    • 9 very small units (50 lines of code)
37% | 21% | 16% | 17% | 7%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py37% | 21% | 16% | 17% | 7%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src37% | 21% | 17% | 17% | 6%
notebooks0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def _run_rl()
in src/run.py
131 6 1
def get_options()
in src/options.py
130 7 1
def _run_sl()
in src/run.py
98 4 1
def train_epoch()
in src/train.py
51 10 9
def train_epoch_sl()
in src/train.py
42 8 9
def generate_one_tsp_problem()
in src/streamlit_demo.py
29 3 2
def main()
in src/streamlit_demo.py
26 6 0
def train_batch_sl()
in src/train.py
22 9 8
def train_batch()
in src/train.py
19 11 9
def predict_fn()
in src/inference.py
19 4 2
def inference_endpoint()
in src/streamlit_demo.py
18 3 4
def plot_route_on_normspace()
in src/streamlit_demo.py
15 3 5
def rollout()
in src/train.py
14 2 3
def input_fn()
in src/inference.py
14 3 2
def validate()
in src/train.py
12 1 4
def clip_grad_norms()
in src/train.py
11 5 2
def model_fn()
in src/inference.py
10 2 1
def get_latest_endpoint()
in src/streamlit_demo.py
9 1 0
def output_fn()
in src/inference.py
7 3 2
6 2 3