facebookresearch / Opacus-lab
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 52 units with 335 lines of code in units (54.3% of code).
    • 0 very complex units (0 lines of code)
    • 0 complex units (0 lines of code)
    • 0 medium complex units (0 lines of code)
    • 1 simple units (17 lines of code)
    • 51 very simple units (318 lines of code)
0% | 0% | 0% | 5% | 94%
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% | 0% | 5% | 94%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
opacus_lab/models/GPT20% | 0% | 0% | 11% | 88%
opacus_lab/models/GPT2/model0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def finetunable_GPT2_params()
in opacus_lab/models/GPT2/train.py
17 7 2
def __init__()
in opacus_lab/models/GPT2/model/attention.py
11 3 3
def __init__()
in opacus_lab/models/GPT2/model/feedforward.py
7 3 2
def refactor_block()
in opacus_lab/models/GPT2/refactor.py
9 2 1
def load_wikitext()
in opacus_lab/models/GPT2/dataset.py
5 2 1
def forward()
in opacus_lab/models/GPT2/model/embedding.py
5 2 3
def factorize_linear_layer()
in opacus_lab/models/GPT2/model/transformer.py
14 2 2
def lrp_linear_layer()
in opacus_lab/models/GPT2/model/transformer.py
8 2 2
def refactor_transformer()
in opacus_lab/models/GPT2/refactor.py
2 1 0
def refactor_feedforward()
in opacus_lab/models/GPT2/refactor.py
9 1 1
def refactor_attention()
in opacus_lab/models/GPT2/refactor.py
15 1 1
def refactor_embeddings()
in opacus_lab/models/GPT2/refactor.py
6 1 1
def refactor_head()
in opacus_lab/models/GPT2/refactor.py
7 1 1
def test_refactor()
in opacus_lab/models/GPT2/refactor.py
8 1 2
def __init__()
in opacus_lab/models/GPT2/dataset.py
4 1 3
def __len__()
in opacus_lab/models/GPT2/dataset.py
2 1 1
def __getitem__()
in opacus_lab/models/GPT2/dataset.py
3 1 2
def __init__()
in opacus_lab/models/GPT2/dataset.py
3 1 2
def __len__()
in opacus_lab/models/GPT2/dataset.py
2 1 1
def __getitem__()
in opacus_lab/models/GPT2/dataset.py
3 1 2