facebookresearch / UNLU
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 6,366 lines of code in units (65.5% of code).
    • 2 very complex units (849 lines of code)
    • 2 complex units (592 lines of code)
    • 7 medium complex units (625 lines of code)
    • 32 simple units (976 lines of code)
    • 281 very simple units (3,324 lines of code)
13% | 9% | 9% | 15% | 52%
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
py13% | 9% | 9% | 15% | 52%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
anli/src29% | 14% | 4% | 5% | 44%
anli0% | 95% | 0% | 0% | 4%
codes/rnn_training0% | 0% | 54% | 33% | 12%
infersent_comp0% | 0% | 11% | 22% | 65%
codes0% | 0% | 2% | 20% | 77%
infersent_comp/encoder0% | 0% | 0% | 21% | 78%
dataset_utils/mnli0% | 0% | 0% | 57% | 42%
utils0% | 0% | 0% | 25% | 74%
dataset_utils/snli0% | 0% | 0% | 0% | 100%
dataset_utils/ocnli0% | 0% | 0% | 0% | 100%
dataset_utils0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def train()
in anli/src/nli/train_with_scramble.py
505 56 2
def train()
in anli/src/nli/train_with_confidence.py
344 54 2
def train()
in anli/src/nli/training.py
425 49 2
def main()
in anli/run_causal_lm.py
167 35 3
def evaluate()
in infersent_comp/train_nli.py
51 19 3
def evaluation()
in anli/src/nli/evaluation.py
115 17 1
def fixed_shuffle_numpy()
in codes/word_randomization.py
23 17 3
def HyperEvaluate()
in codes/rnn_training/train_nli_ray.py
209 14 1
def HyperEvaluate()
in codes/rnn_training/train_nli_w2v.py
175 14 1
def move_to_device()
in anli/src/flint/data_utils/batchbuilder.py
15 13 2
def get_optimizer()
in infersent_comp/mutils.py
37 13 1
def trainepoch()
in infersent_comp/train_nli.py
60 10 1
def prepare_samples()
in infersent_comp/models.py
20 10 5
def prepare_samples()
in infersent_comp/encoder/models.py
20 10 5
def trainepoch()
in codes/rnn_training/train_nli_ray.py
66 10 6
def trainepoch()
in codes/rnn_training/train_nli_w2v.py
65 10 6
def evaluate()
in codes/rnn_training/Non_transformers_probe.py
26 9 5
def append_subfield_from_list_to_dict()
in anli/src/utils/list_dict_data_tool.py
17 8 6
def get_w2v_k()
in infersent_comp/models.py
16 8 2
def visualize()
in infersent_comp/models.py
23 8 3