Pyro
Conditional Complexity

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 2,624 units with 25,278 lines of code in units (64.6% of code).
    • 0 very complex units (0 lines of code)
    • 5 complex units (329 lines of code)
    • 97 medium complex units (3,884 lines of code)
    • 222 simple units (4,598 lines of code)
    • 2,300 very simple units (16,467 lines of code)
0% | 1% | 15% | 18% | 65%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
py0% | 1% | 15% | 18% | 65%
Legend:
51+
26-50
11-25
6-10
1-5
Conditional Complexity per Logical Component
primary logical decomposition
pyro0% | <1% | 14% | 18% | 65%
examples0% | 3% | 19% | 14% | 62%
profiler0% | 0% | 19% | 11% | 69%
tutorial0% | 0% | 0% | 34% | 65%
Legend:
51+
26-50
11-25
6-10
1-5
Most Complex Units
Top 50 most complex units
Unit# linesMcCabe index# params
def check_model_guide_match()
in pyro/util.py
53 40 3
def _sample_posterior_from_trace()
in pyro/infer/discrete.py
73 33 5
def naive_ubersum()
in pyro/ops/contract.py
52 29 3
def main()
in examples/svi_horovod.py
59 26 1
def main()
in examples/air/main.py
92 26 1
def main()
in examples/dmm/dmm.py
108 24 1
def backtest()
in pyro/contrib/forecast/evaluate.py
97 24 16
def sample()
in pyro/infer/mcmc/nuts.py
90 24 2
def main()
in examples/vae/ss_vae_M2.py
51 23 1
def __getattr__()
in pyro/nn/module.py
49 23 2
def fit_mcmc()
in pyro/contrib/epidemiology/compartmental.py
67 23 2
def main()
in examples/contrib/timeseries/gp_models.py
86 22 1
def fit_svi()
in pyro/contrib/epidemiology/compartmental.py
74 22 9
def _loss()
in pyro/infer/rws.py
54 22 5
def _compute_model_factors()
in pyro/infer/traceenum_elbo.py
49 22 2
def loss_and_grads()
in pyro/infer/renyi_elbo.py
60 22 5
def evaluate()
in examples/contrib/epidemiology/sir.py
74 21 3
def _partition_terms()
in pyro/ops/contract.py
24 21 3
def run_expt()
in examples/mixed_hmm/experiment.py
79 20 1
def allocate()
in pyro/contrib/funsor/handlers/runtime.py
26 20 2
def check_traceenum_requirements()
in pyro/util.py
26 19 2
def _get_traces()
in pyro/infer/energy_distance.py
40 19 5
def compute_expectation()
in pyro/infer/util.py
41 19 2
def _compute_downstream_costs()
in pyro/infer/tracegraph_elbo.py
41 19 3
def merge_points()
in pyro/contrib/tracking/hashing.py
42 18 2
def __init__()
in pyro/infer/mcmc/api.py
43 18 11
def vindex()
in pyro/ops/indexing.py
39 18 2
def check_site_shape()
in pyro/util.py
35 17 2
def _pyro_sample()
in pyro/poutine/broadcast_messenger.py
23 17 1
def predict()
in pyro/contrib/epidemiology/compartmental.py
39 17 2
def compute_posterior_stats()
in examples/sparse_regression.py
53 16 9
def main()
in examples/vae/vae.py
47 16 1
def main()
in examples/capture_recapture/cjs.py
47 16 1
def __setattr__()
in pyro/nn/module.py
58 16 3
def terms_from_trace()
in pyro/contrib/funsor/infer/traceenum_elbo.py
18 16 1
def _predictive()
in pyro/infer/predictive.py
45 16 4
def _monotonic_rational_spline()
in pyro/distributions/transforms/spline.py
107 16 12
def format_shapes()
in pyro/poutine/trace_struct.py
29 15 3
def __init__()
in pyro/contrib/easyguide/easyguide.py
29 15 3
def _quantized_model()
in pyro/contrib/epidemiology/compartmental.py
60 15 1
def differentiable_loss()
in pyro/contrib/funsor/infer/traceenum_elbo.py
34 15 5
def _build_tree()
in pyro/infer/mcmc/nuts.py
62 15 8
def _initialize_adapter()
in pyro/infer/mcmc/hmc.py
33 15 1
def einsum()
in pyro/ops/einsum/torch_log.py
27 15 2
def main()
in examples/sparse_gamma_def.py
34 14 1
def __init__()
in examples/vae/utils/mnist_cached.py
36 14 6
def _format_table()
in pyro/poutine/trace_struct.py
32 14 1
def bayesian_linear_model()
in pyro/contrib/oed/glmm/glmm.py
43 14 12
def _enum_strategy_mixture()
in pyro/contrib/funsor/handlers/enum_messenger.py
21 14 2
def conditional()
in pyro/contrib/gp/util.py
57 14 9