cleverly.validation.PlannedRefits#

class cleverly.validation.PlannedRefits(tests: tuple[PlannedRefitTest, ...], estimand: str, random_state: int | None, notes: tuple[str, ...] = ())[source]#

The refits and learner fits a refute() call would make, counted before any fit.

cleverly.validation.planned_refits() returns one.

Parameters:
teststuple of PlannedRefitTest

One record per requested test, in the order refute() runs them.

estimandstr

The estimand the tests refit.

random_stateint or None

The seed refute() would use, or None when it draws one at the call.

notestuple of str

Plain sentences about what the counts assume.

Attributes:
total_refitsint

The refits over every test.

total_learner_fitsint

The top-level learner fits over every test, an upper bound when not exact.

total_candidate_fitsint

The base-estimator fits over every test.

min_fitsint

The fewest top-level fits over every test when no draw fails.

exactbool

Whether every test is exact.

Methods#

PlannedRefits.summary(*, detail: Literal['short', 'full'] = 'short') → Summary[source]#

Return the printed table of the planned refits.

Parameters:
detail{“short”, “full”}, default “short”

"full" adds each test’s notes and the record’s notes.

Returns:
Summary

A str whose text is the printed table; a notebook renders it as HTML.

PlannedRefits.to_frame(backend: str | None = None) → Any[source]#

Return one row per test.

Parameters:
backend{“pandas”, “polars”, “pyarrow”} or None, default=None

Dataframe backend to return. None uses pandas when installed, then the first available backend.

Returns:
dataframe

Columns test, draws, refits_per_draw, refits, learner_fits, candidate_fits, min_fits, preparation, stored and bound.

Attributes#

PlannedRefits.exact#

Whether every test is exact.

PlannedRefits.min_fits#

The fewest top-level fits over every test when no draw fails.

PlannedRefits.notes: tuple[str, ...] = ()#
PlannedRefits.total_candidate_fits#

The base-estimator fits over every test.

PlannedRefits.total_learner_fits#

The top-level learner fits over every test, an upper bound when not exact.

PlannedRefits.total_refits#

The refits over every test.

PlannedRefits.tests: tuple[PlannedRefitTest, ...]#
PlannedRefits.estimand: str#
PlannedRefits.random_state: int | None#