clophfit.fitting.ctr_validation#
Control holdout / leave-one-control-out validation helpers.
Functions#
|
Return the shared-control K parameter name used by Bayesian multi-fit. |
|
Return the free-control K parameter name used by Bayesian multi-fit. |
|
Return a PlateScheme copy with one control well removed. |
|
Yield holdout tasks from all named control groups. |
|
Return a deepcopy with the heldout well's K prior widened. |
|
Return an inverse-variance weighted posterior reference per draw. |
|
Summarize posterior CTR holdout |
|
Collapse individual holdout rows into one row per model condition. |
|
Post-hoc CTR holdout table for classical fits. |
Module Contents#
- clophfit.fitting.ctr_validation.ctr_param_name(group_name)#
Return the shared-control K parameter name used by Bayesian multi-fit.
- Parameters:
group_name (str)
- Return type:
str
- clophfit.fitting.ctr_validation.free_ctr_param_name(group_name, well)#
Return the free-control K parameter name used by Bayesian multi-fit.
- Parameters:
group_name (str)
well (str)
- Return type:
str
- clophfit.fitting.ctr_validation.make_ctr_holdout_scheme(scheme, *, group_name, heldout_well)#
Return a PlateScheme copy with one control well removed.
PlateScheme.namesvalidates strictly asdict[str, set[str]]in ClopHfit, so this helper preserves that type.- Parameters:
scheme (Any)
group_name (str)
heldout_well (str)
- Return type:
Any
- clophfit.fitting.ctr_validation.iter_ctr_holdouts(scheme, *, min_remaining=1)#
Yield holdout tasks from all named control groups.
- Parameters:
scheme (Any)
min_remaining (int)
- Return type:
Iterator[dict[str, Any]]
- clophfit.fitting.ctr_validation.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_multiusesp.stderr * n_sdas the prior sigma for unknown wells. Increasingstderravoids a control-LOO posterior that is dominated by a tiny preliminary-fit uncertainty.- Parameters:
results (Any)
heldout_well (str)
n_sd (float)
prior_sigma (float)
- Return type:
Any
- clophfit.fitting.ctr_validation.weighted_mean_reference(arrays)#
Return an inverse-variance weighted posterior reference per draw.
- Parameters:
arrays (list[numpy.ndarray])
- Return type:
tuple[numpy.ndarray, numpy.ndarray]
- clophfit.fitting.ctr_validation.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 toK_ctr_{group}.reference_mode="weighted_mean"compares it to the inverse-variance weighted posterior mean of the remaining free-control K variables.- Parameters:
trace (Any)
trace_id (str)
ctr_group (str)
heldout_well (str)
remaining_ctr_wells (list[str] | None)
reference_mode (str)
rope (float)
- Return type:
dict[str, Any]
- clophfit.fitting.ctr_validation.summarize_ctr_loo_table(ctr_loo_df)#
Collapse individual holdout rows into one row per model condition.
- Parameters:
ctr_loo_df (pandas.DataFrame)
- Return type:
pandas.DataFrame
- clophfit.fitting.ctr_validation.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.
- Parameters:
results (dict[str, Any])
scheme (Any)
trace_id (str)
rope (float)
- Return type:
pandas.DataFrame