facebookresearch / reconsider
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 541 units with 7,167 lines of code in units (82.2% of code).
    • 1 very complex units (284 lines of code)
    • 8 complex units (695 lines of code)
    • 35 medium complex units (1,425 lines of code)
    • 68 simple units (1,623 lines of code)
    • 429 very simple units (3,140 lines of code)
3% | 9% | 19% | 22% | 43%
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% | 9% | 19% | 22% | 43%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
ROOT35% | 8% | 21% | 15% | 18%
pytorch_transformers0% | 9% | 19% | 23% | 46%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def main()
in main.py
284 62 0
def forward()
in pytorch_transformers/modeling_xlnet.py
101 50 9
def _forward()
in pytorch_transformers/modeling_transfo_xl.py
108 41 4
def from_pretrained()
in pytorch_transformers/modeling_utils.py
114 37 6
68 34 8
def _from_pretrained()
in pytorch_transformers/tokenization_utils.py
88 33 4
def main()
in pytorch_transformers/__main__.py
112 29 0
def init_weights()
in pytorch_transformers/modeling_transfo_xl.py
38 28 2
def forward()
in pytorch_transformers/modeling_xlm.py
66 28 9
def load_tf_weights_in_bert()
in pytorch_transformers/modeling_bert.py
59 22 3
def get_from_cache()
in pytorch_transformers/file_utils.py
51 22 4
def _is_chinese_char()
in pytorch_transformers/tokenization_bert.py
11 20 2
def load_tf_weights_in_openai_gpt()
in pytorch_transformers/modeling_openai.py
60 19 3
def __init__()
in pytorch_transformers/modeling_transfo_xl.py
69 18 2
def forward()
in pytorch_transformers/modeling_gpt2.py
54 17 6
def forward()
in pytorch_transformers/modeling_distilbert.py
56 17 8
def _tokenize()
in pytorch_transformers/tokenization_xlnet.py
30 17 4
def forward()
in pytorch_transformers/modeling_bert.py
24 17 6
def tokenize()
in pytorch_transformers/tokenization_utils.py
40 16 3
def load_tf_weights_in_xlnet()
in pytorch_transformers/modeling_xlnet.py
48 16 3