metacausal.infer_outcome_type¶
- metacausal.infer_outcome_type(Y)[source]¶
Detect the outcome type from the values of
Y.Detection is on the value set, not cardinality: continuous
Ywith only two distinct values is correctly classified as continuous unless those values are exactly{0, 1}. BooleanYis silently treated as binary. A single-valuedY(only one distinct value) is rejected, since treatment-effect estimation needs at least two levels.- Parameters:
Y (array-like) – Outcome vector. NumPy array, list, pandas Series, etc.
- Returns:
“binary” or “continuous”
- Raises:
ValueError – If
Yhas non-numeric dtype, contains NaN, is empty, has only one distinct value, or otherwise cannot be unambiguously classified.- Return type:
Literal[‘continuous’, ‘binary’]