facebookresearch / LAMA
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 109 units with 1,812 lines of code in units (82.4% of code).
    • 1 very complex units (286 lines of code)
    • 0 complex units (0 lines of code)
    • 7 medium complex units (318 lines of code)
    • 18 simple units (390 lines of code)
    • 83 very simple units (818 lines of code)
15% | 0% | 17% | 21% | 45%
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
py15% | 0% | 17% | 21% | 45%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
scripts46% | 0% | 10% | 13% | 29%
lama/modules0% | 0% | 19% | 27% | 53%
lama0% | 0% | 22% | 24% | 53%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def main()
in scripts/batch_eval_KB_completion.py
286 58 3
def filter_samples()
in scripts/batch_eval_KB_completion.py
66 23 5
def main()
in lama/eval_generation.py
47 18 1
def __vocab_intersection()
in lama/vocab_intersection.py
44 16 2
def get_batch_generation()
in lama/modules/gpt_connector.py
16 13 4
def get_batch_generation()
in lama/modules/elmo_connector.py
52 12 4
def get_ranking()
in lama/evaluation_metrics.py
35 11 8
def get_batch_generation()
in lama/modules/roberta_connector.py
58 11 4
def __get_input_tensors_batch()
in lama/modules/bert_connector.py
37 10 2
def __print_generation()
in lama/utils.py
39 9 10
def tokenize()
in lama/modules/bert_connector.py
19 8 2
def get_contextual_embeddings()
in lama/modules/bert_connector.py
13 8 3
def optimize_top_layer()
in lama/modules/elmo_connector.py
7 8 2
def main()
in scripts/create_lama_uhn.py
28 8 1
def parse_args()
in lama/options.py
22 7 1
def __get_input_tensors()
in lama/modules/transformerxl_connector.py
20 7 2
def __get_input_tensors()
in lama/modules/gpt_connector.py
20 7 2
def main()
in lama/get_contextual_embeddings.py
20 6 1
36 6 6
def get_negation_metric()
in lama/evaluation_metrics.py
18 6 7