facebookresearch / domainbed_measures
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 138 units with 2,287 lines of code in units (71.8% of code).
    • 2 very long units (219 lines of code)
    • 7 long units (503 lines of code)
    • 23 medium size units (799 lines of code)
    • 28 small units (400 lines of code)
    • 78 very small units (366 lines of code)
9% | 21% | 34% | 17% | 16%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py9% | 21% | 34% | 17% | 16%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
domainbed_measures30% | 22% | 7% | 19% | 19%
domainbed_measures/measures0% | 22% | 48% | 12% | 16%
domainbed_measures/experiment0% | 21% | 45% | 22% | 11%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def extract_features_for_regression()
in domainbed_measures/extract_generalization_features.py
110 23 3
def main()
in domainbed_measures/compute_gen_correlations.py
109 30 1
def load_from_state()
in domainbed_measures/model_spec.py
97 26 6
def _calculate_divergence_measure()
in domainbed_measures/measures/held_out_measures.py
81 6 12
def _calculate_lambda_closeness()
in domainbed_measures/measures/held_out_measures.py
71 3 12
def _calculate_divergence_measure()
in domainbed_measures/measures/held_out_measures.py
68 4 12
def perform_subset_analysis()
in domainbed_measures/experiment/regression.py
64 13 9
def analyze_results()
in domainbed_measures/extract_generalization_features.py
63 11 2
def load_results()
in domainbed_measures/experiment/io_utils.py
59 10 2
def get_hdh_heads()
in domainbed_measures/measures/held_out_measures.py
50 4 12
def get_heads()
in domainbed_measures/measures/held_out_measures.py
45 4 12
def __call__()
in domainbed_measures/experiment/experiment.py
45 12 6
def _calculate_measure()
in domainbed_measures/measures/held_out_measures.py
44 5 5
def __call__()
in domainbed_measures/experiment/experiment.py
44 9 5
def __getitem__()
in domainbed_measures/measures/registry.py
43 27 2
def report_top_subsets()
in domainbed_measures/experiment/regression.py
42 5 5
def _calculate_measure_base()
in domainbed_measures/measures/held_out_measures.py
39 2 8
def __call__()
in domainbed_measures/experiment/experiment.py
39 10 5
def load_generalization_gap()
in domainbed_measures/experiment/experiment.py
38 18 5
def get_status_file()
in domainbed_measures/write_job_status_file.py
36 7 2