typedecide.data.validate¶
Dataset checks that run without a tokenizer or a model. Every finding code is explained in Read a validation report.
typedecide.data.validate
¶
Telling someone their dataset is broken before they spend a night training on it.
The two checks that earn this module its place are the label balance and the contradiction check. A criterion whose gold is 94% one class trains a model that has learned the prior and nothing else, and it will still score 94%. Two rows with the same evidence, the same question and different answers put a ceiling on accuracy that no amount of training moves, and it is invisible in a metrics table.
Finding
dataclass
¶
One thing worth saying about a dataset. severity is error, warning or note.
render
¶
Source code in src/typedecide/data/validate.py
DataReport
dataclass
¶
DataReport(
findings: tuple[Finding, ...],
counts: dict[str, int] = dict(),
label_balance: dict[str, dict[str, int]] = dict(),
)
What validate found. ok is the one thing a caller must look at.
label_balance
class-attribute
instance-attribute
¶
render
¶
Source code in src/typedecide/data/validate.py
estimate_tokens
¶
A tokenizer-free estimate, so validation never downloads a model.
Deliberately pessimistic: the larger of ~1.3 tokens per whitespace word and one token per four characters. It is a smoke alarm, not a scale.
Source code in src/typedecide/data/validate.py
validate
¶
validate(
decisions: Sequence[Decision],
*,
min_per_class: int = 5,
max_state_tokens: int = DEFAULT_MAX_STATE_TOKENS
) -> DataReport
Look for the problems that make a training run a waste of an afternoon.