mixle.inference.synthesize module¶
Verified synthetic dataset creation.
synthesize draws inputs from a generative source, optionally labels them
with a teacher callable, and optionally filters them through a verifier. The
result is a Dataset that carries its verifier so consumers can recheck
rows independently.
Supported sources include:
a fitted model with a
sampler;a list of real inputs, from which a generator is inferred and sampled;
a callable
() -> inputorrng -> input.
Without label the result is unlabeled. Without verify every draw is
accepted. max_tries bounds rejection sampling so an impossible verifier
returns a clear failure instead of looping indefinitely.
- class Dataset(inputs, labels=None, verify=None, acceptance_rate=1.0, n_rejected=0, provenance=<factory>)[source]
Bases:
objectA verified synthetic dataset: inputs, optional labels, and the verifier that vouched for them.
- Parameters:
- acceptance_rate: float = 1.0
- n_rejected: int = 0
- pairs()[source]
(input, label)pairs – raises if the dataset is unlabeled.
- synthesize(source, *, label=None, verify=None, n=100, max_tries=None, seed=0)[source]
Build a verified dataset of
naccepted rows from a generativesource(see module docstring).sourceis a fitted model (sampled), a list of real inputs (a generator is inferred over them), or a callable draw function.label(optional) is the teacher applied to each input.verify(optional) acceptsverify(x)orverify(x, label)and gates each row – rejected rows are resampled up tomax_triestotal draws. The verifier is attached to the returnedDatasetso consumers canrecheck()independently.