aws-samples / aws-deepcomposer-samples
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 133 units with 1,340 lines of code in units (84.7% of code).
    • 0 very complex units (0 lines of code)
    • 0 complex units (0 lines of code)
    • 2 medium complex units (91 lines of code)
    • 11 simple units (299 lines of code)
    • 120 very simple units (950 lines of code)
0% | 0% | 6% | 22% | 70%
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% | 0% | 6% | 22% | 70%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
transformer-xl/utils0% | 0% | 14% | 13% | 71%
ar-cnn0% | 0% | 10% | 17% | 72%
gan/utils0% | 0% | 0% | 35% | 64%
reinvent-labs/lab-2/utils0% | 0% | 0% | 35% | 64%
ar-cnn/utils0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def sample_notes_from_model()
in ar-cnn/inference.py
41 14 12
def convert()
in transformer-xl/utils/music_encoder.py
50 11 4
def plot_pianoroll()
in gan/utils/display_utils.py
40 10 10
def plot_pianoroll()
in reinvent-labs/lab-2/utils/display_utils.py
40 10 10
def plot_metrics()
in gan/utils/metrics_utils.py
31 8 1
def plot_metrics()
in reinvent-labs/lab-2/utils/metrics_utils.py
31 8 1
def __init__()
in ar-cnn/model.py
26 7 12
def generate_training_pairs()
in ar-cnn/data_generator.py
39 7 1
def find_files_by_extensions()
in transformer-xl/utils/midi_utils.py
13 7 2
def decode()
in transformer-xl/utils/performance_event_repo.py
17 7 3
def show_pianoroll()
in gan/utils/display_utils.py
24 6 8
def show_pianoroll()
in reinvent-labs/lab-2/utils/display_utils.py
24 6 8
def encode_event()
in transformer-xl/utils/performance_event_repo.py
14 6 2
def decode_event()
in transformer-xl/utils/performance_event_repo.py
19 5 2
def encode_transposition()
in transformer-xl/utils/performance_event_repo.py
13 5 2
def get_midi_paths()
in transformer-xl/utils/music_encoder.py
7 5 1
def convert_midi_to_tensor()
in ar-cnn/inference.py
20 4 2
def down_sampling()
in ar-cnn/model.py
22 4 5
def up_sampling()
in ar-cnn/model.py
23 4 6
def build_model()
in ar-cnn/model.py
40 4 1