facebookresearch / luckmatters
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 308 units with 3,877 lines of code in units (83.9% of code).
    • 1 very complex units (127 lines of code)
    • 1 complex units (120 lines of code)
    • 16 medium complex units (895 lines of code)
    • 33 simple units (834 lines of code)
    • 257 very simple units (1,901 lines of code)
3% | 3% | 23% | 21% | 49%
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
py3% | 3% | 23% | 21% | 49%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
ssl/real-dataset14% | 0% | 39% | 25% | 21%
student_specialization0% | 11% | 16% | 15% | 56%
luckmatter0% | 0% | 19% | 26% | 54%
ssl/hltm0% | 0% | 43% | 8% | 47%
student_specialization/visualization0% | 0% | 37% | 30% | 32%
ssl/real-dataset/models0% | 0% | 23% | 33% | 43%
ssl/common_utils0% | 0% | 0% | 16% | 83%
ssl/real-dataset/loss0% | 0% | 0% | 48% | 51%
ssl/real-dataset/data0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def regulate_predictor()
in ssl/real-dataset/byol_trainer.py
127 56 4
def main()
in student_specialization/recon_multilayer.py
120 34 1
def update()
in ssl/real-dataset/byol_trainer.py
100 24 3
def train()
in ssl/real-dataset/simclr_trainer.py
78 24 2
def main()
in ssl/real-dataset/main.py
80 22 1
def main()
in ssl/hltm/simCLR_hltm.py
102 20 1
def train()
in ssl/real-dataset/byol_trainer.py
61 19 2
def get_corrs()
in student_specialization/vis_corrs.py
34 17 5
def eval_models()
in luckmatter/recon_multilayer.py
85 15 9
def run()
in student_specialization/recon_two_layer.py
67 14 1
def __init__()
in ssl/real-dataset/models/mlp_head.py
30 13 5
def compute_w_corr()
in ssl/real-dataset/byol_trainer.py
36 13 2
def optimize()
in student_specialization/recon_multilayer.py
42 12 9
def optimize()
in luckmatter/recon_multilayer.py
55 12 7
def plot_multilayer_l_shape()
in student_specialization/visualization/visualize_multi.py
32 11 5
def figure_success_rate()
in student_specialization/visualization/visualize.py
40 11 1
def init()
in student_specialization/recon_two_layer.py
34 11 1
def print_corrs()
in luckmatter/vis_corrs.py
19 11 4
def compute_w_minimal_space()
in ssl/real-dataset/byol_trainer.py
47 10 4
def figure_loss()
in student_specialization/visualization/visualize.py
32 10 1