Mathematical Background#
This section provides the formal mathematical details underlying the Fair-Seldonian framework. The core algorithm follows the Quasi-Seldonian approach introduced in [Thomas2019].
Notation#
Symbol |
Definition |
|---|---|
Training dataset of i.i.d. samples |
|
Candidate and safety data splits |
|
Model parameters |
|
Primary objective function (to maximize) |
|
Behavioral constraint function ( required) |
|
Significance level; constraint holds with probability |
|
Upper confidence bound on |
|
Sensitive attribute (group membership) |
Quasi-Seldonian Algorithm#
The Quasi-Seldonian Algorithm (QSA) consists of two computational phases after data splitting.
Candidate selection. Find by solving:
where is the predicted upper bound — an estimate of what the safety test bound will be, computed using the candidate data.
The constraint is not imposed as a hard barrier. What is actually minimised is the log loss plus an exact penalty on the violation:
with set by
penalty. This is continuous
everywhere, order 1, and equal to the log loss on the feasible side.
Important
The tempting alternative — return a large constant plus when infeasible, and the loss when feasible — does not work here, and the reason is worth knowing because the failure is silent.
SciPy’s Powell convergence test is relative. With an objective of order
and the default ftol of , the stopping
threshold works out near , while varies by only
about across the whole parameter space. Powell then reports
success after a single iteration while still infeasible, and max_iter
never binds. Every run returns No Solution Found, and nothing about it
looks like a bug.
Keeping the objective order 1 is what gives the optimizer usable signal on the infeasible side.
Safety test. Given , compute the upper confidence bound on using the safety data:
Delta Splitting#
When the constraint expression tree has binary operators, the confidence level must be split between the left and right subtrees. By Boole’s inequality (the union bound) [Bonferroni1936], if each subtree’s bound holds with probability , the combined bound holds with probability .
Uniform splitting (base mode) assigns to each child of
every binary operator:
This is conservative: it does not account for constant nodes or repeated variables. The Algorithm Variants section describes three optimizations that address those, and a fourth, Affine-Form Compilation (affine), that sidesteps the per-leaf split altogether for constraints inside its fragment.
Interval Arithmetic#
Confidence intervals are propagated through the expression tree using standard interval arithmetic rules [Moore1966]. For intervals and :
Addition:
Subtraction:
Multiplication:
where . The implementation handles all sign combinations (both positive, both negative, mixed signs) as special cases for efficiency.
Division:
If , the result is .
Absolute value:
See fair_seldonian.constraints.bounds for the full implementation.
Predicted Bounds#
During candidate selection, the algorithm does not have access to the safety data. Instead, it predicts what the safety test bound will be by accounting for the statistical uncertainty from both data splits.
Standard prediction (base mode) uses a doubled Hoeffding term
[Hoeffding1963]:
Decomposed prediction (mod mode) separates candidate and safety
estimation error:
Here for a two-sided interval and for a one-sided one; the root of a constraint tree needs only its upper endpoint, so leaves that inherit that one-sidedness pay the smaller term. See Concentration Inequalities.
The decomposed form yields tighter bounds when and differ substantially. See Algorithm Variants for the full set of optimizations.