fair_seldonian.data package#
Submodules#
fair_seldonian.data.synthetic module#
- fair_seldonian.data.synthetic.get_data(
- N,
- features,
- t_ratio,
- tp0_ratio,
- tp1_ratio,
- random_seed,
- signal_noise=0.5,
- include_sensitive_feature=True,
Synthetic binary-classification data with a base-rate gap between groups.
T ~ Bernoulli(t_ratio)selects the group; the label is then drawn withP(Y=1 | T=0) = tp0_ratioandP(Y=1 | T=1) = tp1_ratio. The gap between those two base rates is what makes the fairness constraint bite.The signal feature is
Y + N(0, signal_noise), giving a Bayes error ofPhi(-1 / (2 * signal_noise)). Additive noise is essential: a construction likeY * uniform(0, 1)is zero exactly whenY = 0and positive otherwise, so the label is perfectly recoverable, the Bayes error is zero, and there is no accuracy-fairness frontier to trade along - any loss the constrained model paid would be an artifact rather than a real cost.- Parameters:
N (int) – number of samples.
features (int) – total number of columns in the returned feature block, including the sensitive column when
include_sensitive_featureis set.t_ratio (float) –
P(T = 1).tp0_ratio (float) –
P(Y = 1 | T = 0).tp1_ratio (float) –
P(Y = 1 | T = 1).random_seed (float) – seed; distinct values give independent datasets.
signal_noise (float) – standard deviation of the label noise in the signal feature.
include_sensitive_feature (bool) – whether
Tis also supplied to the model as an input feature (“fairness through awareness”). Explicit because it materially changes the problem: withTavailable the classifier can condition directly on group membership. Easy to leave unstated, too, since appendingTto the feature block survives the column slicing indata_split()without comment.
- Returns:
frame of
features + 2columns - the feature block, thenY, thenT.- Return type: