in causalml/inference/tree/models.py [0:0]
def divideSet(self, X, treatment, y, column, value):
'''
Tree node split.
Args
----
X : ndarray, shape = [num_samples, num_features]
An ndarray of the covariates used to train the uplift model.
treatment : array-like, shape = [num_samples]
An array containing the treatment group for each unit.
y : array-like, shape = [num_samples]
An array containing the outcome of interest for each unit.
column : int
The column used to split the data.
value : float or int
The value in the column for splitting the data.
Returns
-------
(X_l, X_r, treatment_l, treatment_r, y_l, y_r) : list of ndarray
The covariates, treatments and outcomes of left node and the right node.
'''
# for int and float values
if isinstance(value, int) or isinstance(value, float):
filt = X[:, column] >= value
else: # for strings
filt = X[:, column] == value
return X[filt], X[~filt], treatment[filt], treatment[~filt], y[filt], y[~filt]