facebookresearch / DrQA
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 196 units with 2,331 lines of code in units (69.5% of code).
    • 0 very complex units (0 lines of code)
    • 1 complex units (46 lines of code)
    • 11 medium complex units (491 lines of code)
    • 28 simple units (575 lines of code)
    • 156 very simple units (1,219 lines of code)
0% | 1% | 21% | 24% | 52%
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% | 1% | 21% | 24% | 52%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
drqa/reader0% | 4% | 15% | 35% | 45%
scripts/reader0% | 0% | 41% | 7% | 50%
drqa/pipeline0% | 0% | 58% | 9% | 32%
scripts/distant0% | 0% | 45% | 40% | 14%
drqa/tokenizers0% | 0% | 11% | 27% | 60%
scripts/retriever0% | 0% | 0% | 16% | 83%
scripts/pipeline0% | 0% | 0% | 48% | 51%
drqa/retriever0% | 0% | 0% | 5% | 94%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def vectorize()
in drqa/reader/vector.py
46 28 3
def find_answer()
in scripts/distant/generate.py
57 21 4
def batchify()
in drqa/reader/vector.py
38 19 1
def main()
in scripts/reader/train.py
100 18 1
def set_defaults()
in scripts/reader/train.py
41 17 1
def predict_batch()
in drqa/reader/predictor.py
39 13 3
def eval_accuracies()
in scripts/reader/train.py
23 12 4
def load_data()
in drqa/reader/utils.py
12 12 3
def tokenize()
in drqa/tokenizers/regexp_tokenizer.py
31 12 2
def build_feature_dict()
in drqa/reader/utils.py
21 11 2
def _forward_padded()
in drqa/reader/layers.py
36 11 3
def process_batch()
in drqa/pipeline/drqa.py
93 11 6
def load_embeddings()
in drqa/reader/model.py
29 10 3
def decode_candidates()
in drqa/reader/model.py
33 10 5
def __init__()
in drqa/reader/rnn_reader.py
50 9 3
def update()
in drqa/reader/model.py
23 9 2
def forward()
in drqa/reader/rnn_reader.py
24 8 6
def tune_embeddings()
in drqa/reader/model.py
22 8 2
def predict()
in drqa/reader/model.py
23 8 5
def find_answer()
in scripts/reader/preprocess.py
7 7 3