facebookresearch / domainbed_measures
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 138 units with 2,287 lines of code in units (71.8% of code).
    • 0 very complex units (0 lines of code)
    • 3 complex units (249 lines of code)
    • 5 medium complex units (320 lines of code)
    • 12 simple units (408 lines of code)
    • 118 very simple units (1,310 lines of code)
0% | 10% | 13% | 17% | 57%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
py0% | 10% | 13% | 17% | 57%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
domainbed_measures0% | 28% | 24% | 9% | 37%
domainbed_measures/measures0% | 4% | 0% | 13% | 81%
domainbed_measures/experiment0% | 0% | 25% | 34% | 40%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def main()
in domainbed_measures/compute_gen_correlations.py
109 30 1
def __getitem__()
in domainbed_measures/measures/registry.py
43 27 2
def load_from_state()
in domainbed_measures/model_spec.py
97 26 6
def extract_features_for_regression()
in domainbed_measures/extract_generalization_features.py
110 23 3
def load_generalization_gap()
in domainbed_measures/experiment/experiment.py
38 18 5
def perform_subset_analysis()
in domainbed_measures/experiment/regression.py
64 13 9
def __call__()
in domainbed_measures/experiment/experiment.py
45 12 6
def analyze_results()
in domainbed_measures/extract_generalization_features.py
63 11 2
def __iter__()
in domainbed_measures/utils.py
19 10 1
def get_cond_v_entropy()
in domainbed_measures/measures/held_out_measures.py
36 10 5
def __call__()
in domainbed_measures/experiment/experiment.py
39 10 5
def load_results()
in domainbed_measures/experiment/io_utils.py
59 10 2
def get_data_condition()
in domainbed_measures/experiment/regression.py
30 9 6
def __call__()
in domainbed_measures/experiment/experiment.py
44 9 5
def corr_without_fit()
in domainbed_measures/experiment/regression.py
14 8 2
def get_status_file()
in domainbed_measures/write_job_status_file.py
36 7 2
def _calculate_measure()
in domainbed_measures/measures/classical.py
21 7 3
def zip_longest_padded()
in domainbed_measures/utils.py
13 6 1
def _calculate_divergence_measure()
in domainbed_measures/measures/held_out_measures.py
81 6 12
def fix_hdh_c2st_divergence_from_sum_to_mean()
in domainbed_measures/experiment/io_utils.py
16 6 5