microsoft / EconML
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 1,408 units with 14,640 lines of code in units (75.4% of code).
    • 7 very long units (985 lines of code)
    • 26 long units (1,616 lines of code)
    • 147 medium size units (4,577 lines of code)
    • 234 small units (3,320 lines of code)
    • 994 very small units (4,142 lines of code)
6% | 11% | 31% | 22% | 28%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py6% | 11% | 30% | 23% | 28%
pyx0% | 0% | 59% | 6% | 33%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
econml/solutions36% | 8% | 18% | 19% | 17%
econml/tree34% | 0% | 32% | 2% | 30%
monte_carlo_tests33% | 18% | 28% | 12% | 6%
econml/grf17% | 9% | 34% | 16% | 23%
prototypes/dynamic_dml15% | 7% | 54% | 10% | 11%
econml/inference13% | 0% | 27% | 25% | 32%
econml/iv0% | 15% | 38% | 19% | 26%
econml0% | 15% | 27% | 23% | 34%
econml/orf0% | 24% | 33% | 23% | 18%
econml/dml0% | 17% | 25% | 11% | 45%
prototypes/orthogonal_forests0% | 16% | 12% | 40% | 30%
econml/sklearn_extensions0% | 11% | 35% | 22% | 29%
econml/cate_interpreter0% | 32% | 41% | 13% | 12%
econml/policy0% | 10% | 31% | 37% | 20%
econml/data0% | 16% | 33% | 30% | 20%
prototypes/dml_iv0% | 0% | 28% | 33% | 37%
econml/dynamic0% | 0% | 41% | 19% | 38%
econml/dr0% | 0% | 37% | 28% | 34%
econml/metalearners0% | 0% | 35% | 28% | 36%
econml/automated_ml0% | 0% | 27% | 33% | 38%
econml/_ensemble0% | 0% | 0% | 59% | 40%
econml/score0% | 0% | 0% | 61% | 38%
doc0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def fit()
in econml/solutions/causal_analysis/_causal_analysis.py
187 55 4
def fit()
in econml/tree/_tree_classes.py
153 48 8
def run_all_mc()
in monte_carlo_tests/monte_carlo_statsmodels.py
140 24 11
def _process_feature()
in econml/solutions/causal_analysis/_causal_analysis.py
131 22 15
def fit()
in econml/grf/_base_grf.py
127 40 7
def run_mc()
in prototypes/dynamic_dml/coverage_panel_hetero.py
126 12 11
def __getattr__()
in econml/inference/_bootstrap.py
121 34 2
def fit()
in econml/_ortho_learner.py
86 27 15
def print_aggregate()
in monte_carlo_tests/monte_carlo_statsmodels.py
77 4 4
def individualized_policy()
in econml/solutions/causal_analysis/_causal_analysis.py
76 9 7
def create_splits()
in econml/orf/_causal_tree.py
74 31 8
def einsum_sparse()
in econml/utilities.py
71 51 2
def __init__()
in econml/iv/dr/_dr.py
69 1 35
def _predict_point_and_var()
in econml/grf/_base_grf.py
67 17 7
def __init__()
in econml/orf/_ortho_forest.py
67 6 10
def run_mc()
in prototypes/dynamic_dml/coverage_panel.py
65 6 11
def interpret()
in econml/cate_interpreter/_interpreters.py
64 20 4
def summary()
in econml/iv/dml/_dml.py
62 20 5
61 14 1
def metrics_subfig()
in prototypes/orthogonal_forests/comparison_plots.py
61 19 4