causalis.data_contracts.multicausaldata.MultiCausalDataMultiCausalData
Bases: pydantic.BaseModel
Data contract for cross-sectional causal data with multi-class one-hot treatments.
Parameters
- dfpd.DataFrame
The DataFrame containing the causal data.
- outcomestr
The name of the outcome column.
- treatment_namesList[str]
The names of the treatment columns.
- confoundersList[str], optional
The names of the confounder columns, by default [].
- user_idOptional[str], optional
The name of the user ID column, by default None.
- control_treatmentstr
Name of the control/baseline treatment column.
Notes
This class enforces several constraints on the data, including:
Maximum number of treatment_names (default 15).
No duplicate column names in the input DataFrame.
Disjoint roles for columns (outcome, treatment_names, confounders, user_id).
Non-empty normalized names for outcome and user_id (if provided).
Existence of all specified columns in the DataFrame.
Numeric or boolean types for outcome and confounders.
Finite values for outcome, confounders, and treatment_names.
Non-constant values for outcome, treatment_names, and confounders.
No NaN values in used columns.
Binary (0/1) encoding for treatment columns.
One-hot treatment assignment (exactly one active treatment per row).
A stable control treatment in position 0.
No identical values between different columns.
Unique values for user_id (if specified).
Initialization
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be
validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Canonical target
causalis.data_contracts.multicausaldata.MultiCausalData
Sections