facebookresearch / InvariantRiskMinimization
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 30 units with 389 lines of code in units (70.5% of code).
    • 0 very complex units (0 lines of code)
    • 0 complex units (0 lines of code)
    • 2 medium complex units (116 lines of code)
    • 1 simple units (44 lines of code)
    • 27 very simple units (229 lines of code)
0% | 0% | 29% | 11% | 58%
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% | 0% | 29% | 11% | 58%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
experiment_synthetic0% | 0% | 36% | 13% | 49%
colored_mnist0% | 0% | 0% | 0% | 100%
figure_10% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def plot_bars()
in code/experiment_synthetic/plot.py
58 15 4
def run_experiment()
in code/experiment_synthetic/main.py
58 12 1
def __init__()
in code/experiment_synthetic/models.py
44 10 3
def plot_experiment()
in code/experiment_synthetic/plot.py
24 5 3
def train()
in code/experiment_synthetic/models.py
25 5 4
def parse_title()
in code/experiment_synthetic/plot.py
16 4 1
def __init__()
in code/experiment_synthetic/models.py
16 4 3
def __init__()
in code/experiment_synthetic/sem.py
22 4 6
def __init__()
in code/experiment_synthetic/models.py
5 3 3
def errors()
in code/experiment_synthetic/main.py
16 3 2
def make_environment()
in code/colored_mnist/main.py
15 3 3
def __init__()
in code/colored_mnist/main.py
12 3 1
def pretty_print()
in code/colored_mnist/main.py
8 3 1
def pretty()
in code/experiment_synthetic/models.py
3 2 1
def powerset()
in code/experiment_synthetic/models.py
2 2 2
def pretty()
in code/experiment_synthetic/main.py
3 2 1
def __call__()
in code/experiment_synthetic/sem.py
10 2 3
def forward()
in code/colored_mnist/main.py
7 2 2
def ls()
in code/figure_1/penalties.py
2 1 3
def sample()
in code/figure_1/penalties.py
5 1 2