microsoft / nlp-recipes
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 656 units with 8,219 lines of code in units (59.0% of code).
    • 0 very complex units (0 lines of code)
    • 6 complex units (556 lines of code)
    • 36 medium complex units (1,501 lines of code)
    • 61 simple units (1,732 lines of code)
    • 553 very simple units (4,430 lines of code)
0% | 6% | 18% | 21% | 53%
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% | 15% | 21% | 58%
c0% | 23% | 40% | 15% | 21%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
utils_nlp/models0% | 7% | 21% | 15% | 55%
utils_nlp/eval0% | 7% | 10% | 35% | 45%
utils_nlp/dataset0% | 0% | 22% | 14% | 62%
utils_nlp/common0% | 0% | 32% | 16% | 50%
utils_nlp/azureml0% | 0% | 0% | 40% | 59%
tools0% | 0% | 0% | 64% | 35%
utils_nlp/interpreter0% | 0% | 0% | 21% | 78%
utils_nlp/language_utils0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
int get_cooccurrence()
in utils_nlp/models/glove/src/cooccur.c
127 44 0
int save_params()
in utils_nlp/models/glove/src/glove.c
96 43 1
def _compute_ngrams_lcs()
in utils_nlp/eval/rouge/rouge_ext.py
104 32 4
def _fast_translate_batch()
in utils_nlp/models/transformers/bertsum/predictor.py
121 32 6
def encode_single()
in utils_nlp/models/transformers/extractive_summarization.py
49 30 4
def eval()
in utils_nlp/eval/SentEval/senteval/engine.py
59 28 2
int main()
in utils_nlp/models/glove/src/glove.c
90 24 2
def _create_qa_example()
in utils_nlp/models/transformers/question_answering.py
73 23 2
int get_word()
in utils_nlp/models/glove/src/cooccur.c
29 22 2
int get_word()
in utils_nlp/models/glove/src/vocab_count.c
29 22 2
def preprocess_classification_tokens()
in utils_nlp/models/bert/common.py
25 21 3
def preprocess_encoder_tokens()
in utils_nlp/models/bert/common.py
25 21 3
def _get_final_text()
in utils_nlp/models/transformers/question_answering.py
52 21 4
int get_counts()
in utils_nlp/models/glove/src/vocab_count.c
50 19 0
def advance()
in utils_nlp/models/transformers/bertsum/beam.py
49 19 3
def load_pandas_df()
in utils_nlp/dataset/xnli.py
46 18 3
def get_parallel_minibatch()
in utils_nlp/models/gensen/utils.py
80 18 4
int train_glove()
in utils_nlp/models/glove/src/glove.c
52 17 0
def find_best_thresh()
in utils_nlp/eval/question_answering.py
32 16 5
def _check_is_max_context()
in utils_nlp/models/transformers/question_answering.py
16 16 3