CasualML
Unit Size

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 285 units with 4,927 lines of code in units (91.4% of code).
    • 3 very long units (410 lines of code)
    • 7 long units (512 lines of code)
    • 73 medium size units (2,337 lines of code)
    • 60 small units (869 lines of code)
    • 142 very small units (799 lines of code)
8% | 10% | 47% | 17% | 16%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
py8% | 10% | 47% | 17% | 16%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Logical Component
primary logical decomposition
causalml/inference14% | 11% | 45% | 14% | 13%
causalml/dataset0% | 19% | 71% | 8% | 1%
causalml/optimize0% | 22% | 22% | 26% | 29%
causalml/metrics0% | 0% | 56% | 21% | 22%
causalml0% | 0% | 36% | 30% | 32%
causalml/feature_selection0% | 0% | 44% | 31% | 24%
Legend:
101+
51-100
21-50
11-20
1-10
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
def growDecisionTreeFrom()
in causalml/inference/tree/models.py
182 35 11
def uplift_tree_plot()
in causalml/inference/tree/plot.py
121 19 2
def pruneTree()
in causalml/inference/tree/models.py
107 26 11
def make_uplift_classification()
in causalml/dataset/classification.py
100 20 30
def classify()
in causalml/inference/tree/models.py
88 15 4
def cat_continuous()
in causalml/inference/tree/utils.py
75 28 2
def _obj_func_midp()
in causalml/optimize/unit_selection.py
72 4 4
def fit()
in causalml/inference/meta/rlearner.py
64 12 6
def estimate_ate()
in causalml/inference/meta/tmle.py
57 11 7
def estimate_ate()
in causalml/inference/meta/xlearner.py
56 9 8
def get_synthetic_preds_holdout()
in causalml/dataset/synthetic.py
50 5 4
def get_tmleqini()
in causalml/metrics/visualize.py
49 14 5
def fit()
in causalml/inference/meta/xlearner.py
49 13 5
def fit()
in causalml/inference/meta/xlearner.py
49 13 5
def get_tmlegain()
in causalml/metrics/visualize.py
48 14 5
def normI()
in causalml/inference/tree/models.py
48 7 6
def get_synthetic_summary_holdout()
in causalml/dataset/synthetic.py
47 10 4
def fit()
in causalml/inference/meta/rlearner.py
47 11 6
def estimate_ate()
in causalml/inference/meta/rlearner.py
47 8 8
def fit()
in causalml/inference/meta/rlearner.py
47 11 6
def match()
in causalml/match.py
47 9 4
def estimate_ate()
in causalml/inference/meta/slearner.py
46 6 8
def estimate_ate()
in causalml/inference/meta/tlearner.py
45 4 7
def predict()
in causalml/inference/tree/models.py
44 8 3
def plot()
in causalml/metrics/sensitivity.py
41 11 6
def predict()
in causalml/inference/meta/xlearner.py
41 11 7
def predict()
in causalml/inference/meta/xlearner.py
41 11 7
def fit()
in causalml/inference/nn/dragonnet.py
39 2 4
def get_std_diffs()
in causalml/metrics/visualize.py
38 6 5
def predict()
in causalml/inference/tree/models.py
38 7 3
def get_actual_value()
in causalml/optimize/utils.py
37 3 6
def _filter_D_one_feature()
in causalml/feature_selection/filters.py
36 6 8
def __init__()
in causalml/inference/tree/models.py
36 3 12
def fit_predict()
in causalml/inference/meta/xlearner.py
36 7 10
def get_qini()
in causalml/metrics/visualize.py
35 10 6
def get_treatment_costs()
in causalml/optimize/utils.py
35 3 4
def tree_node_summary()
in causalml/inference/tree/models.py
35 4 6
def causalsens()
in causalml/metrics/sensitivity.py
34 3 1
def fit_predict()
in causalml/inference/meta/rlearner.py
33 7 9
def search_best_match()
in causalml/match.py
33 11 2
def get_cumlift()
in causalml/metrics/visualize.py
32 9 5
def uplift_tree_string()
in causalml/inference/tree/plot.py
32 6 2
def __init__()
in causalml/inference/meta/xlearner.py
32 9 8
def make_dragonnet()
in causalml/inference/nn/dragonnet.py
31 1 2
def synthetic_data()
in causalml/dataset/regression.py
30 1 5
def kpi_transform()
in causalml/inference/tree/utils.py
30 4 3
def get_importance()
in causalml/feature_selection/filters.py
28 3 9
def cat_transform()
in causalml/inference/tree/utils.py
28 5 3
def plot_tmlegain()
in causalml/metrics/visualize.py
27 6 5
def plot_tmleqini()
in causalml/metrics/visualize.py
27 6 5