cleverly.validation.planned_refits#

cleverly.validation.planned_refits(result: Any, **kwargs: Any) → PlannedRefits[source]#

Count the refits and learner fits refute() would make.

Takes exactly refute’s keywords and runs every check refute runs before its first draw, so a request refute refuses raises the same record here. It fits nothing.

Parameters:
resultTMLEResult or another fitted result that refute accepts

The fit.

**kwargsAny

refute’s keywords: estimand, tests, n_replicates, seed_spread and the rest. Only random_state and the arguments that decide what runs change the counts.

Returns:
PlannedRefits

One record per requested test.

Raises:
TypeError

If a keyword is not one refute takes.

ValueError

If an argument is malformed, as refute raises it.

CapabilityError

If refute refuses the request, with the same record, or if the fit’s estimator has no refit preview.

Notes

With checkpoint=, the preview reads the directory without writing to it, refuses a request refute would refuse there, and counts only the draws a resume would refit (PlannedRefitTest.stored holds the rest). progress is ignored.

The noise refits, the negative control and the future-treatment fit read data and seeds known before any draw, so they are counted exactly. Every other test refits drawn data and is counted at the learners’ nominal counts, as an upper bound with a floor that holds when no draw fails. A draw that a check refuses part way through (a subset draw, a band-rank placebo draw on a fit whose seed is drawn at the call) can still stop refute.