facebookresearch / mtrl
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 324 units with 2,380 lines of code in units (36.6% of code).
    • 0 very complex units (0 lines of code)
    • 1 complex units (103 lines of code)
    • 3 medium complex units (116 lines of code)
    • 13 simple units (374 lines of code)
    • 307 very simple units (1,787 lines of code)
0% | 4% | 4% | 15% | 75%
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% | 4% | 4% | 15% | 75%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
mtrl/experiment0% | 20% | 7% | 46% | 25%
mtrl0% | 0% | 16% | 13% | 69%
mtrl/utils0% | 0% | 21% | 0% | 78%
mtrl/agent0% | 0% | 0% | 6% | 93%
mtrl/app0% | 0% | 0% | 100% | 0%
mtrl/env0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def run()
in mtrl/experiment/multitask.py
103 27 1
def __init__()
in mtrl/logger.py
52 16 4
def _create_dmcontrol_vec_envs_for_eval()
in mtrl/experiment/multitask.py
36 15 1
def _process_setup_config()
in mtrl/utils/config.py
28 11 1
def __init__()
in mtrl/experiment/experiment.py
73 9 3
def collect_trajectory()
in mtrl/experiment/metaworld.py
33 8 3
def _check_param_device()
in mtrl/agent/pcgrad.py
15 7 2
def create_eval_modes_to_env_ids()
in mtrl/experiment/multitask.py
13 7 1
def evaluate_vec_env_of_tasks()
in mtrl/experiment/metaworld.py
61 7 4
def run()
in mtrl/app/run.py
17 6 1
def load()
in mtrl/agent/abstract.py
21 6 3
def forward()
in mtrl/agent/components/moe_layer.py
23 6 2
def _get_theta_sampling_strategy()
in mtrl/agent/hipbmdp.py
23 6 2
def delete_from_filesystem()
in mtrl/replay_buffer.py
12 6 2
def load()
in mtrl/replay_buffer.py
28 6 2
def prepare_config()
in mtrl/experiment/experiment.py
14 6 2
def evaluate_vec_env_of_tasks()
in mtrl/experiment/dmcontrol.py
41 6 4
def weight_init()
in mtrl/agent/utils.py
7 5 1
def _format()
in mtrl/logger.py
13 5 4
def _dump_to_console()
in mtrl/logger.py
9 5 3