Skip to content

dew.data.holdout

Held-out records: a dataset split into the part a run trains on and the parts it scores.

NameSummary
RecordSliceThe records [start, stop) of source, by index (holdout(records=)): the first start held out of the part a run trains on, or those a run scores.
HashPartThe rows of source whose identity (its key field, or its content) hashes into [low, high) of the unit interval (held), or the rows that do not: a row is in exactly one part, the same in every run, read, machine and resume (holdout(fraction)).
holdoutDataset.holdout.
selectingsource, then each source its holdout selections select from, down to their store, each with the selections above it, outermost first.
SelectedGenerationThe rows generation holds for the inputs of source, the source it was published from, that the holdout selections keep (outermost first, source below the last), in their order: the generation standing in for its steps under selections written before it, each picking the inputs it picks uncached (dew.data.analysis._in_place).

dataclass source

class RecordSlice(source: Source, start: int, stop: int | None = None)

The records [start, stop) of source, by index (holdout(records=)): the first start held out of the part a run trains on, or those a run scores. A run’s record names it.

def describe() -> str
def fingerprint() -> Mapping[str, object]
def records(read: Read)
def part(records: Records) -> Records

Its part of records, its source’s: a Grain slice of them (row 4145).

def admits(position: int, row: Batch | bytes | None) -> bool

Whether the record at position among its source’s is in this slice.

def admitted(records: int) -> None

Refuse a slice past the records it was offered (bounds).

def bounds(records: int) -> tuple[int, int]

The first and the one past the last of records it keeps, refusing a slice past them.

def metadata() -> Mapping[str, object]
def lengths() -> np.ndarray | None
def manifest(version: int) -> ShardManifest

dataclass source

class HashPart(
source: Source,
low: float,
high: float,
held: bool,
key: str | None = None,
)

The rows of source whose identity (its key field, or its content) hashes into [low, high) of the unit interval (held), or the rows that do not: a row is in exactly one part, the same in every run, read, machine and resume (holdout(fraction)). A run’s record names it.

def describe() -> str
def fingerprint() -> Mapping[str, object]
def records(read: Read)
def part(records: Records) -> Records

Its part of records, its source’s: those whose identity it holds.

def keeps(row: Batch | bytes | None) -> bool

Whether this part holds row: one that is there, its identity in the part.

def admits(position: int, row: Batch | bytes | None) -> bool

Whether this part holds row, wherever it is (keeps).

def admitted(records: int) -> None

Any number of rows holds a hash part.

def lengths() -> np.ndarray | None
def manifest(version: int) -> ShardManifest

The source’s shards, each read through the hash. Which of a shard’s rows the hash keeps is known only once they are read, so no shard states its rows; the rows it keeps stream in the order its source’s do, which is its index order where theirs is (records).

function source

def holdout(
dataset: Dataset,
fraction: float | None = None,
*,
key: str | None = None,
records: int | None = None,
split: str | tuple[str, ...] | None = None,
**named: float = {},
) -> tuple[Pipeline, ...]

Dataset.holdout.

function source

def selecting(
source: Source,
) -> Iterator[tuple[tuple[RecordSlice | HashPart, ...], Source]]

source, then each source its holdout selections select from, down to their store, each with the selections above it, outermost first.

dataclass source

class SelectedGeneration(
generation: Generation,
selections: tuple[RecordSlice | HashPart, ...],
source: Source,
placing: Read,
)

The rows generation holds for the inputs of source, the source it was published from, that the holdout selections keep (outermost first, source below the last), in their order: the generation standing in for its steps under selections written before it, each picking the inputs it picks uncached (dew.data.analysis._in_place). The selections name the part, as the run wrote them; source is read as the fill read it (_consumed), numbering its inputs by their place in a memory or indexed read (placing), or by its shards’ rows in a stream, as the fill did (_source_ids). Ids that name other inputs than the fill’s are refused, never read as none.

whole: Source

The generation’s rows for every input: the whole store this part’s measured facts are measured over (dew.data.analysis._stated), as uncached they are over the store below its selections.

def label() -> str
def describe() -> str
def fingerprint() -> Mapping[str, object]
def supports(read: Read) -> bool
def can_provision(read: Read) -> bool
def preparation_bytes() -> int | None
def provision() -> SelectedGeneration
def records(read: Read) -> Records
def manifest(version: int) -> ShardManifest
def metadata() -> Mapping[str, object]

The selections’ facts, as uncached (what they hold out included), with this part’s rows and the generation’s count rules.

def stated() -> Mapping[str, object]
def order_fingerprints() -> Mapping[str, str]

Which of the generation’s rows this part reads, in their order.

def lengths() -> np.ndarray | None

None: a part packs as it does uncached, where the steps the generation stands for come between it and the pack.