aws-samples / machine-learning-samples
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 91 units with 979 lines of code in units (61.1% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 10 medium size units (271 lines of code)
    • 28 small units (411 lines of code)
    • 53 very small units (297 lines of code)
0% | 0% | 27% | 41% | 30%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 0% | 28% | 41% | 29%
java0% | 0% | 0% | 48% | 52%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
social-media0% | 0% | 36% | 41% | 21%
k-fold-cross-validation0% | 0% | 45% | 30% | 24%
cost-based-ml0% | 0% | 34% | 41% | 23%
targeted-marketing-python0% | 0% | 31% | 52% | 15%
ml-tools-python0% | 0% | 0% | 43% | 56%
mobile-android0% | 0% | 0% | 48% | 52%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def create_datasources()
in k-fold-cross-validation/fold.py
35 3 1
def create_data_sources()
in targeted-marketing-python/build_model.py
34 1 5
def process_status()
in social-media/gather-data.py
32 8 2
def fetch_tweets()
in social-media/gather-data.py
30 9 1
def collect_perf()
in k-fold-cross-validation/collect_perf.py
29 9 1
def main()
in cost-based-ml/cost_based_ml.py
24 2 0
def find_optimal_threshold()
in cost-based-ml/cost_based_ml.py
23 1 2
def determine_changed_bucket_policy()
in social-media/create-aml-model.py
22 12 2
def check_bucket_policy()
in social-media/create-aml-model.py
21 4 1
def prepare()
in social-media/scanner.py
21 1 1
def _guess_variable_type()
in ml-tools-python/awspyml.py
20 5 2
def poll_until_completed()
in ml-tools-python/wait_for_entity.py
20 3 2
def realtime_predict()
in ml-tools-python/realtime.py
19 1 2
def main()
in social-media/create-aml-model.py
18 1 2
def create_ml_model()
in k-fold-cross-validation/fold.py
18 1 1
def create_data_source()
in social-media/create-aml-model.py
17 1 6
def create_model()
in targeted-marketing-python/build_model.py
16 2 4
def user_to_map()
in social-media/gather-data.py
16 1 2
def main()
in social-media/gather-data.py
16 3 1
def parse_options()
in cost-based-ml/cost_based_ml.py
16 1 0