clophfit.fitting.ctr_validation =============================== .. py:module:: clophfit.fitting.ctr_validation .. autoapi-nested-parse:: Control holdout / leave-one-control-out validation helpers. Functions --------- .. autoapisummary:: clophfit.fitting.ctr_validation.ctr_param_name clophfit.fitting.ctr_validation.free_ctr_param_name clophfit.fitting.ctr_validation.make_ctr_holdout_scheme clophfit.fitting.ctr_validation.iter_ctr_holdouts clophfit.fitting.ctr_validation.widen_heldout_k_prior clophfit.fitting.ctr_validation.weighted_mean_reference clophfit.fitting.ctr_validation.summarize_bayesian_ctr_holdout clophfit.fitting.ctr_validation.summarize_ctr_loo_table clophfit.fitting.ctr_validation.classical_ctr_holdout_rows Module Contents --------------- .. py:function:: ctr_param_name(group_name) Return the shared-control K parameter name used by Bayesian multi-fit. .. py:function:: free_ctr_param_name(group_name, well) Return the free-control K parameter name used by Bayesian multi-fit. .. py:function:: make_ctr_holdout_scheme(scheme, *, group_name, heldout_well) Return a PlateScheme copy with one control well removed. ``PlateScheme.names`` validates strictly as ``dict[str, set[str]]`` in ClopHfit, so this helper preserves that type. .. py:function:: iter_ctr_holdouts(scheme, *, min_remaining = 1) Yield holdout tasks from all named control groups. .. py:function:: widen_heldout_k_prior(results, heldout_well, *, n_sd, prior_sigma = 0.6) Return a deepcopy with the heldout well's K prior widened. ``fit_binding_pymc_multi`` uses ``p.stderr * n_sd`` as the prior sigma for unknown wells. Increasing ``stderr`` avoids a control-LOO posterior that is dominated by a tiny preliminary-fit uncertainty. .. py:function:: weighted_mean_reference(arrays) Return an inverse-variance weighted posterior reference per draw. .. py:function:: summarize_bayesian_ctr_holdout(trace, *, trace_id, ctr_group, heldout_well, remaining_ctr_wells = None, reference_mode = 'shared', rope = 0.1) Summarize posterior CTR holdout ``ΔK``. ``reference_mode="shared"`` compares heldout K to ``K_ctr_{group}``. ``reference_mode="weighted_mean"`` compares it to the inverse-variance weighted posterior mean of the remaining free-control K variables. .. py:function:: summarize_ctr_loo_table(ctr_loo_df) Collapse individual holdout rows into one row per model condition. .. py:function:: classical_ctr_holdout_rows(results, scheme, *, trace_id, rope = 0.1) Post-hoc CTR holdout table for classical fits. For each control well, compare its fitted K to the inverse-variance weighted mean K of the remaining control wells in the same group.