in causalPartition.py [0:0]
def _contain_zero(self, probabilities, rules, eps, delta, treated=None):
"""
For each observation (indicated by an element in the vector),
whether it has <= eps probability to belong to the partition implied by [rules]
Treated: == 1/0 if we want to append the rule for the treatment variable
== none otherwise
"""
if treated is None:
return np.mean(np.product([self.probabilities[key] <= th for key, sign, th in rules if sign == 0] + \
[self.probabilities[key] > th for key, sign, th in rules if sign == 1],
axis=0) > 0, axis=1
) <= eps
else:
# Also consider the treated conditions for egos.
# In separate trees, the treatment conditions for egos should also be considered
return np.mean(np.product([probabilities[key] <= th for key, sign, th in rules if sign == 0] + \
[probabilities[key] > th for key, sign, th in rules if sign == 1] + \
probabilities[self.treatment] == treated,
axis=0) > 0, axis=1
) <= eps