Skip to content
Submodule
causalis.shared.rct_design.split

split

Submodule causalis.shared.rct_design.split with no child pages and 1 documented members.

Functions

Jump directly into the documented functions for this page.

1 items
function
causalis.shared.rct_design.split.assign_variants_df

assign_variants_df

Deterministically assign variants for each row in df based on id_col.

Parameters

dfpd.DataFrame

Input DataFrame with an identifier column.

id_colstr

Column name in df containing entity identifiers (user_id, session_id, etc.).

experiment_idstr

Unique identifier for the experiment (versioned for reruns).

variantsDict[str, float]

Mapping from variant name to weight (coverage). Weights must be non-negative and their sum must be in (0, 1]. If the sum is < 1, the remaining mass corresponds to “not in experiment” and the assignment will be None.

saltstr, default “global_ab_salt”

Secret string to de-correlate from other hash uses and make assignments non-gameable.

layer_idstr, default “default”

Identifier for mutual exclusivity layer or surface. In this case work like another random

variant_colstr, default “variant”

Name of output column to store assigned variant labels.

Returns

pd.DataFrame

A copy of df with an extra column variant_col. Entities outside experiment coverage will have None in the variant column.

Canonical target

causalis.shared.rct_design.split.assign_variants_df

Sections

ParametersReturns
Link to this symbol