Splits
splits
Traffic split coordinators, holdout groups, and exposure ramp schedules.
This module provides the TrafficSplitter class, which manages how traffic is divided between
multiple active variants, controls global experimental holdout structures, and configures step-wise
treatment exposure ramp schedules.
| CLASS | DESCRIPTION |
|---|---|
TrafficSplitter |
Manages traffic split fractions, global holdout configurations, and progressive exposure ramp schedules. |
TrafficSplitter
TrafficSplitter(
allocations: Dict[str, float],
holdout_percentage: float = 0.0,
ramp_schedule: List[float] = None,
)
Manages traffic split fractions, global holdout configurations, and progressive exposure ramp schedules.
A TrafficSplitter divides incoming traffic into discrete experimental buckets. It supports fractional
allocations, standard control and treatment arms, and long-term holdout groups.
Business and Operational Context
- Fractional Allocations: Allows unequal variants (e.g., 90% control, 10% treatment) to limit exposure during early launch states.
- Long-Term Holdouts: A portion of users can be entirely withheld from all experiments within a product area (the "holdout group") to measure the long-term cumulative effects and potential interaction effects of independent product changes over months.
- Exposure Ramp Schedules: Step-wise exposure schedules (e.g., exposing 1% of users, then 10%, then 50%, then 100%) act as standard release gates. This mitigates operational risk by validating telemetry and checking for guardrail breaches before exposing the entire user base.
| ATTRIBUTE | DESCRIPTION |
|---|---|
allocations |
A dictionary mapping variant names to their allocation weight fractions (values bounded in \([0, 1]\)).
TYPE:
|
holdout_percentage |
Percentage of global traffic completely excluded from selection and routed to a static holdout arm. Bounded in \([0, 1]\).
TYPE:
|
Examples:
Example
Validates that the sum of variant allocations and holdout percentages totals exactly 1.0.
| PARAMETER | DESCRIPTION |
|---|---|
allocations
|
Mapping of variant labels to active traffic split weights.
TYPE:
|
holdout_percentage
|
Fractional traffic diverted into a holdout group. Defaults to 0.0.
TYPE:
|
ramp_schedule
|
Custom progressive exposure percentages. Defaults to None.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If any individual allocation weight is negative. |
ValueError
|
If the total allocation weight including the holdout percentage does not sum to 1.0. |
ValueError
|
If ramp_schedule has values outside [0.0, 1.0], is non-monotonic, or does not end in 1.0. |
| METHOD | DESCRIPTION |
|---|---|
get_ramp_schedule |
Generates progressive exposure ramp-up schedule coordinates. |
Source code in src\xpyrment\design\splits.py
get_ramp_schedule
Generates progressive exposure ramp-up schedule coordinates.
Ramping exposure represents a crucial risk-management strategy. This method returns a list of active exposure fractions defining sequential release gating stages.
Mathematical Representation
Let \(R\) be the ramp-up schedule array: $$ R = [r_1, r_2, \dots, r_m] $$ where \(r_j \in [0, 1]\) represents the fraction of total traffic exposed to the experiment during step \(j\), such that \(r_j \le r_{j+1}\).
| RETURNS | DESCRIPTION |
|---|---|
List[float]
|
List[float]: Ordered list of target traffic fractions representing progressive exposure stages. |