facebookresearch / simmc
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 172 units with 4,278 lines of code in units (76.6% of code).
    • 2 very complex units (432 lines of code)
    • 8 complex units (929 lines of code)
    • 21 medium complex units (1,303 lines of code)
    • 24 simple units (490 lines of code)
    • 117 very simple units (1,124 lines of code)
10% | 21% | 30% | 11% | 26%
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
py10% | 21% | 30% | 11% | 26%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
mm_dst/gpt2_dst/scripts57% | 19% | 0% | 12% | 10%
mm_action_prediction/tools0% | 29% | 32% | 3% | 34%
mm_action_prediction/models0% | 36% | 35% | 15% | 12%
mm_action_prediction/loaders0% | 13% | 26% | 27% | 32%
mm_action_prediction0% | 0% | 92% | 0% | 7%
mm_dst/gpt2_dst/utils0% | 0% | 67% | 27% | 4%
mm_dst/utils0% | 0% | 0% | 27% | 72%
mm_action_prediction/models/encoders0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def main()
in mm_dst/gpt2_dst/scripts/run_language_modeling.py
284 59 0
def train()
in mm_dst/gpt2_dst/scripts/run_language_modeling.py
148 56 4
def forward()
in mm_action_prediction/models/action_executor.py
171 50 3
def build_multimodal_inputs()
in mm_action_prediction/tools/build_multimodal_inputs.py
170 44 1
def gen_getinfo_from_annotation()
in mm_action_prediction/tools/extract_actions.py
65 37 2
def get_roundwise_dialog_actions()
in mm_action_prediction/tools/extract_actions.py
102 35 2
def weight_init()
in mm_action_prediction/tools/weight_init.py
68 35 1
def main()
in mm_dst/gpt2_dst/scripts/run_generation.py
149 31 0
def forward_beamsearch_single()
in mm_action_prediction/models/decoder.py
130 30 4
def __init__()
in mm_action_prediction/loaders/loader_simmc.py
74 27 2
def load_one_batch()
in mm_action_prediction/loaders/loader_simmc.py
108 21 2
def extract_action_attributes()
in mm_action_prediction/tools/extract_attribute_vocabulary.py
50 20 1
def convert_json_to_flattened()
in mm_dst/gpt2_dst/utils/convert.py
98 19 7
def evaluate_agent()
in mm_action_prediction/eval_simmc_agent.py
83 19 3
def gen_addtocart_from_annotation()
in mm_action_prediction/tools/extract_actions.py
34 18 2
def get_carousel_state()
in mm_action_prediction/tools/extract_actions.py
39 18 2
def main()
in mm_action_prediction/tools/embed_fashion_assets.py
49 18 1
def extract_actions()
in mm_action_prediction/tools/extract_actions_fashion.py
69 16 1
def forward()
in mm_action_prediction/models/decoder.py
97 15 3
def get_keystrokes_with_args()
in mm_action_prediction/tools/extract_actions.py
89 14 2