Skip to content

Bias scanning

sezgi.bias.*: the structural/central bias scanner (KS/AD/Holm battery against a null problem, plus a translation-invariance check) for auditing whether an algorithm's own search behavior clusters away from uniform, independent of the problem it is solving.

bias.f0 builtin

bias_f0(dim, seed)

sezgi.bias.f0(dim, seed) -- a [Problem] handle for [sezgi_bias::f0::F0Random], the BIAS-toolbox null problem (M3-4 Task 4): every evaluation is an independent U(0,1) draw, uncorrelated with the queried point, over the domain [0,1]^dim. Usable with EvalSession. for_problem / Algorithm.solve exactly like any other continuous [Problem] handle; optimum() is always None (there is no landscape to have an optimum), so log_dir is rejected the same way it is for from_callable(...) (nothing to record as f_opt). Collecting best_x over repeated runs and passing them to sezgi.bias.structural_positions is how a researcher's OWN algorithm gets the library's structural-bias scan without spec-driven engine involvement.

bias.structural

_bias_structural(spec, dim, budget, runs=30, seed=0)

Runs crates/bias's structural-bias battery (M3-1 Task 8): runs independent runs of spec on the BIAS-toolbox null problem (bias.f0), then a KS/AD/Holm test of whether the runs' final positions cluster away from uniform.

spec: dict (JSON-compatible algorithm spec) or a JSON string -- same convention as solve's own spec argument. dim, budget: as in solve. runs: number of independent runs whose final positions feed the KS/AD/Holm battery (mirrors crates/bias's own MIN_RUNS floor). seed: master seed for the runs independent runs.

Returns a dict with keys per_dim_ks (list of {d, p_value, n}), per_dim_ad (list of {a2, p_value, n}), holm_rejections_ks, holm_rejections_ad, verdict ("no_evidence" or "evidence"), detail (None for "no_evidence", the evidence-not-accusation detail string otherwise), final_positions (runs x dim).

bias.structural_positions

_bias_structural_positions(final_positions)

The bias bridge for externally-authored algorithms (M3-4 Task 4): runs the SAME KS/AD/Holm battery as bias.structural, but over caller-supplied final_positions (each row one run's final best x, e.g. collected from repeated Algorithm.solve(bias.f0(...)) calls) instead of an AlgorithmSpec-driven engine run.

final_positions: a runs x dim matrix (list of equal-length rows); dim is inferred from row length.

Returns the SAME shape bias.structural returns (see its own docstring). Raises ValueError for fewer than 5 rows or ragged rows (mirrors crates/bias's own MIN_RUNS floor).

bias.central

_bias_central(spec, dim, budget, fids=None, instances_shifted=None, runs_per=20, seed=0)

Runs crates/bias's central-bias test (M3-1 Task 8): compares spec's performance on a set of BBOB functions at their original optimum vs. an instance-shifted (off-center) variant.

spec, dim, budget: as in bias.structural. fids: BBOB function IDs to test; defaults to crates/bias's own [1, 4, 13] when omitted. Raises ValueError for a fid in {5, 6, 20, 24} (not translation-invariant). instances_shifted: BBOB instances for the shifted variant; defaults to crates/bias's own [1, 2] when omitted. runs_per: independent runs per (fid, instance, variant). seed: master seed.

Returns a dict with keys gap_centered, gap_shifted, wilcoxon ({w_statistic, z, p_value, n_effective, method}), effect, verdict ("no_evidence" or "evidence"), detail (None for "no_evidence", the evidence-not-accusation detail string otherwise).

bias.report

_bias_report(spec, dim, budget, seed=0, structural_runs=None, central_fids=None, central_instances=None, central_runs_per=None)

Runs the full bias report (M3-1 Task 8): bias.structural and bias.central together, plus a LaTeX-ready summary.

spec, dim, budget, seed: as in bias.structural/bias.central. structural_runs: forwarded to bias.structural as its own runs argument (that default, 30, applies when omitted). central_fids, central_instances, central_runs_per: forwarded to bias.central as fids, instances_shifted, runs_per respectively (their own defaults apply when omitted).

Returns a dict with keys structural (bias.structural's own shape), central (bias.central's own shape), signature (always None today -- the T6 Rajwar-Deep signature-bias test is DEFERRED in crates/bias itself: no reachable source fully specifies its statistical procedure), latex_summary (str, never containing the literal "NaN"), plot_data ({final_positions, gap_centered, gap_shifted}).