facebookresearch / PAQ
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 124 units with 1,290 lines of code in units (57.1% of code).
    • 0 very complex units (0 lines of code)
    • 0 complex units (0 lines of code)
    • 3 medium complex units (154 lines of code)
    • 13 simple units (249 lines of code)
    • 108 very simple units (887 lines of code)
0% | 0% | 11% | 19% | 68%
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% | 11% | 19% | 68%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
paq/retrievers0% | 0% | 24% | 15% | 60%
paq0% | 0% | 20% | 21% | 57%
paq/generation/answer_extractor0% | 0% | 25% | 14% | 60%
paq/generation/question_generator0% | 0% | 0% | 51% | 48%
paq/rerankers0% | 0% | 0% | 52% | 47%
paq/generation/passage_scorer0% | 0% | 0% | 22% | 77%
paq/evaluation0% | 0% | 0% | 35% | 64%
paq/generation/filtering0% | 0% | 0% | 0% | 100%
paq/generation0% | 0% | 0% | 0% | 100%
paq/server0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def postprocess_span2d_output()
in paq/generation/answer_extractor/span2D_model.py
48 17 5
def build_index_streaming()
in paq/retrievers/build_index.py
57 14 10
def download()
in paq/download.py
49 13 2
def embed()
in paq/retrievers/embed.py
29 8 6
def predict()
in paq/rerankers/rerank.py
33 8 7
def _get_proj_keys_from_state_dict()
in paq/retrievers/retriever_utils.py
6 7 1
def tokenize()
in paq/rerankers/rerank.py
13 7 4
def main()
in paq/download.py
32 7 0
def _batch_iterator()
in paq/generation/question_generator/generator.py
28 7 3
13 6 5
def _get_root_dir()
in paq/download.py
8 6 1
def eval_retriever()
in paq/evaluation/eval_retriever.py
16 6 3
def generate_question()
in paq/generation/question_generator/generator.py
25 6 3
def score_passages()
in paq/generation/passage_scorer/scorer.py
19 6 3
def __init__()
in paq/generation/answer_extractor/span2D_model.py
17 6 2
def _convert_to_span_matrix()
in paq/generation/answer_extractor/span2D_model.py
10 6 2
def _load_index_if_exists()
in paq/retrievers/retrieve.py
17 5 5
def load_jsonl_fast()
in paq/paq_utils.py
13 5 1
11 5 2
21 5 2