facebookresearch / rlstructures
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 747 units with 8,299 lines of code in units (76.2% of code).
    • 0 very complex units (0 lines of code)
    • 2 complex units (129 lines of code)
    • 9 medium complex units (877 lines of code)
    • 35 simple units (2,255 lines of code)
    • 701 very simple units (5,038 lines of code)
0% | 1% | 10% | 27% | 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
py0% | 1% | 10% | 27% | 60%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
rlstructures/deprecated0% | 16% | 10% | 18% | 54%
rlalgos0% | 17% | 0% | 4% | 77%
tutorial/deprecated0% | 0% | 13% | 39% | 47%
rlalgos/dqn0% | 0% | 40% | 8% | 50%
rlalgos/simple_ddqn0% | 0% | 41% | 0% | 58%
rlalgos/a2c_gae0% | 0% | 27% | 0% | 72%
rlstructures/env_wrappers0% | 0% | 23% | 55% | 21%
rlalgos/deprecated0% | 0% | 0% | 14% | 85%
rlalgos/sac0% | 0% | 0% | 36% | 63%
rlalgos/reinforce_diayn0% | 0% | 0% | 56% | 43%
rlalgos/reinforce_device0% | 0% | 0% | 70% | 29%
rlalgos/reinforce0% | 0% | 0% | 59% | 40%
rlalgos/ppo0% | 0% | 0% | 56% | 43%
rlstructures/rl_batchers0% | 0% | 0% | 18% | 81%
rlstructures0% | 0% | 0% | 0% | 100%
tutorial0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def weight_init()
in rlalgos/tools.py
63 30 1
def get()
in rlstructures/deprecated/batchers/episodebatchers.py
66 27 1
def run()
in rlalgos/dqn/duelling_dqn.py
219 25 1
def get_multiple_slots()
in rlstructures/deprecated/batchers/buffers.py
42 21 3
def run()
in rlalgos/simple_ddqn/ddqn.py
142 17 1
def run()
in rlalgos/a2c_gae/a2c.py
118 12 1
def run()
in tutorial/deprecated/tutorial_recurrent_a2c_s/a2c.py
113 11 1
def get_loss()
in tutorial/deprecated/tutorial_recurrent_policy/a2c.py
67 11 2
def run()
in tutorial/deprecated/tutorial_recurrent_a2c_gae_s/a2c.py
113 11 1
def format_frame()
in rlstructures/env_wrappers/gymenv.py
28 11 1
def reset()
in rlstructures/env_wrappers/gymenv.py
35 11 2
def run()
in tutorial/deprecated/tutorial_from_reinforce_to_a2c_s/a2c.py
118 10 1
def run()
in tutorial/deprecated/tutorial_from_reinforce_to_a2c/a2c.py
107 10 1
def reset()
in rlstructures/env_wrappers/gymenv.py
35 10 2
def step()
in rlstructures/env_wrappers/gymenv.py
71 10 2
def get()
in rlstructures/deprecated/batchers/episodebatchers.py
25 10 2
def run()
in rlalgos/sac/sac.py
156 10 1
def add_scalar()
in rlalgos/logger.py
17 10 4
def run()
in tutorial/deprecated/tutorial_a2c_with_infinite_env/a2c.py
97 9 1
def get_loss()
in tutorial/deprecated/tutorial_a2c_with_infinite_env/a2c.py
51 9 2