pytorch / translate
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 860 units with 13,186 lines of code in units (62.7% of code).
    • 0 very complex units (0 lines of code)
    • 2 complex units (232 lines of code)
    • 25 medium complex units (1,507 lines of code)
    • 65 simple units (2,400 lines of code)
    • 768 very simple units (9,047 lines of code)
0% | 1% | 11% | 18% | 68%
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% | 11% | 18% | 68%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
pytorch_translate0% | 2% | 14% | 16% | 66%
pytorch_translate/research0% | 0% | 12% | 24% | 63%
pytorch_translate/rescoring0% | 0% | 6% | 37% | 56%
pytorch_translate/data0% | 0% | 4% | 12% | 82%
pytorch_translate/tasks0% | 0% | 0% | 17% | 82%
pytorch_translate/dual_learning0% | 0% | 0% | 16% | 83%
pytorch_translate/word_prediction0% | 0% | 0% | 18% | 81%
pytorch_translate/attention0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
pytorch_translate/models0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def _generate_score()
in pytorch_translate/generate.py
157 42 5
def validate_preprocessing_args()
in pytorch_translate/options.py
75 34 1
def get_training_stats()
in pytorch_translate/evals.py
73 25 1
def build_model()
in pytorch_translate/semi_supervised.py
97 25 3
def set_default_args()
in pytorch_translate/train.py
57 21 1
def forward()
in pytorch_translate/common_layers.py
49 19 4
def build_model()
in pytorch_translate/multilingual_model.py
94 19 3
def forward_unprojected()
in pytorch_translate/rnn.py
79 19 4
def forward()
in pytorch_translate/ensemble_export.py
55 18 5
def get_outputs()
in pytorch_translate/ensemble_export.py
43 17 3
def __init__()
in pytorch_translate/transformer.py
72 17 5
def setup_training_model()
in pytorch_translate/train.py
76 17 1
def forward()
in pytorch_translate/ensemble_export.py
106 16 5
def preprocess_corpora()
in pytorch_translate/preprocess.py
67 15 2
def setup_training_state()
in pytorch_translate/train.py
51 15 4
def finalize_hypos()
in pytorch_translate/research/multisource/multisource_decode.py
44 14 4
def finalize_hypos()
in pytorch_translate/beam_decode.py
44 14 4
def forward()
in pytorch_translate/research/rescore/rescoring_criterion.py
100 13 4
def forward()
in pytorch_translate/vocab_reduction.py
49 12 4
def __init__()
in pytorch_translate/rescoring/rescorer.py
35 12 4