awslabs / keras-apache-mxnet
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 1,793 units with 22,855 lines of code in units (90.4% of code).
    • 2 very complex units (632 lines of code)
    • 19 complex units (2,149 lines of code)
    • 98 medium complex units (4,995 lines of code)
    • 177 simple units (4,152 lines of code)
    • 1,497 very simple units (10,927 lines of code)
2% | 9% | 21% | 18% | 47%
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
py2% | 9% | 21% | 18% | 47%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
keras/engine7% | 24% | 33% | 9% | 23%
keras/backend3% | 6% | 17% | 21% | 50%
keras/utils0% | 23% | 25% | 19% | 31%
keras0% | 5% | 12% | 30% | 52%
keras/layers0% | 1% | 19% | 15% | 63%
keras/legacy0% | 10% | 30% | 6% | 51%
benchmark/scripts0% | 0% | 34% | 32% | 32%
keras/datasets0% | 0% | 42% | 0% | 57%
keras/wrappers0% | 0% | 0% | 60% | 39%
benchmark/sparse0% | 0% | 0% | 62% | 37%
keras/preprocessing0% | 0% | 0% | 0% | 100%
keras/applications0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def get_model()
in keras/backend/mxnet_backend.py
296 116 0
def compile()
in keras/engine/training.py
336 98 9
def print_summary()
in keras/utils/layer_utils.py
121 46 4
def _standardize_user_data()
in keras/engine/training.py
141 46 7
def preprocess_weights_for_loading()
in keras/engine/saving.py
147 42 5
def rnn()
in keras/backend/mxnet_backend.py
303 42 10
def run_internal_graph()
in keras/engine/network.py
110 41 3
def standardize_input_data()
in keras/engine/training_utils.py
85 40 6
def rnn()
in keras/backend/cntk_backend.py
105 38 8
def multi_gpu_model()
in keras/utils/multi_gpu_utils.py
94 34 4
def test_loop()
in keras/engine/training_arrays.py
78 33 6
def _serialize_model()
in keras/engine/saving.py
106 33 3
def update()
in keras/utils/generic_utils.py
96 31 3
def set_model()
in keras/callbacks.py
100 31 2
def _init_graph_network()
in keras/engine/network.py
120 29 5
def evaluate_generator()
in keras/engine/training_generator.py
102 29 7
def rnn()
in keras/backend/theano_backend.py
120 29 8
def generate_legacy_interface()
in keras/legacy/interfaces.py
81 27 5
def __call__()
in keras/engine/base_layer.py
69 26 3
def predict_generator()
in keras/engine/training_generator.py
82 26 7