facebookresearch / decodable_information_bottleneck
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 469 units with 4,541 lines of code in units (52.4% of code).
    • 0 very complex units (0 lines of code)
    • 1 complex units (85 lines of code)
    • 9 medium complex units (308 lines of code)
    • 57 simple units (1,247 lines of code)
    • 402 very simple units (2,901 lines of code)
0% | 1% | 6% | 27% | 63%
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% | 6% | 27% | 63%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
ROOT0% | 8% | 7% | 32% | 51%
utils0% | 0% | 12% | 14% | 73%
dib/utils0% | 0% | 9% | 26% | 63%
dib/transformers0% | 0% | 7% | 37% | 55%
dib/predefined0% | 0% | 0% | 47% | 52%
utils/data0% | 0% | 0% | 11% | 88%
dib/training0% | 0% | 0% | 25% | 74%
utils/visualize0% | 0% | 0% | 20% | 79%
dib/classifiers0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
85 31 1
48 18 2
def get_callbakcs()
in utils/train.py
36 15 12
def apply()
in dib/utils/pruning.py
50 14 5
def forward()
in dib/transformers/ib/dib.py
44 14 3
def plot_metrics()
in aggregate.py
19 11 5
14 11 2
def compute_mask()
in dib/utils/pruning.py
41 11 3
def get_rows_cols_agg()
in utils/evaluate.py
35 11 2
def aggregate_table()
in utils/helpers.py
21 11 4
def global_unstructured()
in dib/utils/pruning.py
31 10 3
def forward()
in dib/utils/helpers.py
26 10 3
def _get_in_out_channels()
in dib/predefined/cnn.py
28 10 5
def get_img_encoder()
in dib/transformers/img.py
40 10 1
def compute_zx_loss_encoder()
in dib/transformers/ib/dib.py
16 10 3
12 10 2
def compute_mask()
in dib/utils/pruning.py
22 9 3
def linear_init()
in dib/utils/initialization.py
23 9 2
def prune_weights_()
in dib/predefined/mlp.py
16 9 3
def weights_init()
in dib/utils/initialization.py
16 8 2