facebookresearch / ParlAI
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 5,252 units with 55,143 lines of code in units (61.7% of code).
    • 6 very complex units (1,336 lines of code)
    • 17 complex units (1,453 lines of code)
    • 171 medium complex units (7,853 lines of code)
    • 471 simple units (11,033 lines of code)
    • 4,587 very simple units (33,468 lines of code)
2% | 2% | 14% | 20% | 60%
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
py2% | 2% | 14% | 20% | 60%
js0% | 0% | 20% | 13% | 66%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
parlai/tasks3% | 1% | 13% | 25% | 56%
parlai/crowdsourcing11% | 0% | 13% | 16% | 59%
parlai/core0% | 5% | 18% | 16% | 58%
parlai/scripts0% | 6% | 23% | 16% | 53%
parlai/agents0% | 2% | 6% | 16% | 73%
projects/dialogue_unlikelihood0% | 28% | 13% | 9% | 48%
parlai/utils0% | 3% | 16% | 22% | 57%
parlai/torchscript0% | 14% | 46% | 8% | 29%
projects/light_whoami0% | 4% | 14% | 17% | 64%
parlai/chat_service0% | 0% | 15% | 13% | 70%
projects/wizard_of_wikipedia0% | 0% | 14% | 35% | 49%
parlai/nn0% | 0% | 33% | 11% | 55%
projects/style_gen0% | 0% | 29% | 3% | 66%
projects/blenderbot20% | 0% | 10% | 21% | 68%
projects/anti_scaling0% | 0% | 10% | 11% | 77%
projects/personality_captions0% | 0% | 8% | 34% | 56%
projects/msc0% | 0% | 28% | 0% | 71%
projects/image_chat0% | 0% | 0% | 43% | 56%
projects/safety_bench0% | 0% | 0% | 36% | 63%
ROOT0% | 0% | 0% | 78% | 21%
parlai/mutators0% | 0% | 0% | 35% | 64%
website0% | 0% | 0% | 34% | 65%
projects/tod_simulator0% | 0% | 0% | 17% | 82%
projects/params_vs_compute0% | 0% | 0% | 11% | 88%
parlai/zoo0% | 0% | 0% | 0% | 100%
projects/md_gender0% | 0% | 0% | 0% | 100%
example_parlai_internal/agents0% | 0% | 0% | 0% | 100%
projects/genderation_bias0% | 0% | 0% | 0% | 100%
projects/safety_recipes0% | 0% | 0% | 0% | 100%
projects/dialogue_bias0% | 0% | 0% | 0% | 100%
parlai0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def compile_results()
in parlai/crowdsourcing/tasks/model_chat/analysis/compile_results.py
302 86 1
def main()
in parlai/tasks/eli5/data_creation/download_support_docs.py
220 74 0
def compile_results()
in parlai/crowdsourcing/projects/multisession_chat/human_eval/compile_results.py
303 73 1
def write_dialog()
in parlai/tasks/light_dialog/builder.py
156 60 5
def write_dialog()
in parlai/tasks/light_dialog_wild/builder.py
156 56 5
def main()
in parlai/tasks/eli5/data_creation/download_reddit_qalist.py
199 52 0
def setup_data()
in parlai/tasks/msc/agents.py
174 46 2
def _build_candidates()
in parlai/core/torch_ranker_agent.py
142 36 4
def build_table()
in parlai/core/teachers.py
59 33 2
def __init__()
in parlai/core/torch_classifier_agent.py
89 33 3
def convert_model_weight()
in parlai/agents/bart/convert_fairseq_to_parlai.py
122 33 2
def colorize()
in parlai/utils/strings.py
75 32 2
def _kwargs_to_str_args()
in parlai/core/params.py
68 31 2
def findall()
in parlai/torchscript/modules.py
73 30 2
def compute_loss()
in projects/dialogue_unlikelihood/agents.py
103 29 3
def vectorize()
in parlai/agents/starspace/starspace.py
47 28 2
def __init__()
in parlai/scripts/train_model.py
103 28 2
def hyperparameters()
in parlai/scripts/generate_model_card.py
57 28 1
def load_state_dict()
in projects/light_whoami/agents/expanded_attention.py
58 27 3
def download_and_process()
in parlai/tasks/eli5/data_creation/download_reddit_qalist.py
72 27 5