A decision tree that splits directly on uplift gain.
Classes
Single uplift tree that splits on the difference in treatment effects.
__init__( self, max_depth: Optional[int] = None, min_samples_split: int = 2, min_samples_leaf: int = 20, max_features: Optional[int] = None, random_state: Optional[int] = None, )
Summary
Overview
- For each candidate feature and threshold, split the node and estimate
- Choose the split that maximizes
- Recurse until a stopping rule fires, then store the leaf uplift.
Theory
Let a node contain n samples, n_t treated and n_c control, with outcomes y. Its estimated uplift is
A split sends the node's samples to a left child L and a right child R. The split is chosen to maximize the between-child uplift variance,
which is large exactly when the two children have very different treatment effects. This targets heterogeneity directly rather than the outcome level.
Parameters
max_depth
None for no limit).
min_samples_split
min_samples_leaf
max_features
None uses all).
random_state
Attributes
tree_
feature, threshold, left and right keys; leaves have uplift, n_treated and n_control.
n_features_in_
X.
n_nodes_
max_depth_
Notes
Complexity: each split sorts the node by each candidate feature, so training is roughly O(d \, n \log n) per level and prediction is O(\text{depth}) per sample.
When to use: when you want a single, inspectable tree (rather than a black-box meta-learner) and the treatment effect is piecewise-constant in the features.
References
>>> from tuiml.algorithms.causal import UpliftTreeClassifier
>>> import numpy as np
>>> rng = np.random.RandomState(0)
>>> X = rng.uniform(-1, 1, size=(500, 2))
>>> t = rng.randint(0, 2, size=500)
>>> y = 1.0 + X[:, 1] + t * (2.0 * X[:, 0]) + rng.normal(0, 0.1, size=500)
>>> model = UpliftTreeClassifier(max_depth=4, min_samples_leaf=20).fit(X, t, y)
>>> model.predict_uplift(X).shape
(500,)
Methods
fit
(self, X, treatment, y) -> 'UpliftTreeClassifier'
fit
(self, X, treatment, y) -> 'UpliftTreeClassifier'
Build the uplift tree.
Parameters
X
treatment
y
Returns
self