probly.data_generation.first_order_datagenerator¶
Backend/General First-Order data generator.
General implementation using pure Python constructs (no torch dependency).
Functions
|
Create a loader that yields inputs (and labels if present) with distributions. |
Classes
|
Minimal dataset protocol for typing (len and index access). |
|
General backend first-order data generator. |
|
Dataset wrapper pairing inputs (and labels if present) with distributions. |
|
A minimal Python data loader that batches items by index. |
- class probly.data_generation.first_order_datagenerator.DatasetLike(*args, **kwargs)[source]¶
Bases:
ProtocolMinimal dataset protocol for typing (len and index access).
- class probly.data_generation.first_order_datagenerator.FirstOrderDataGenerator(model, device='cpu', batch_size=64, output_mode='auto', output_transform=None, input_getter=None, model_name=None, return_numpy=True)[source]¶
Bases:
objectGeneral backend first-order data generator.
- Parameters:
- generate_distributions(dataset_or_loader, *, progress=True)[source]¶
Generate per-sample distributions for a dataset or loader.
- load_distributions(path, *, return_numpy=True)[source]¶
Load distributions and metadata from JSON.
When return_numpy is True (default), returns numpy arrays for each distribution row. If False, returns plain Python lists of floats.
- prepares_batch_inp(sample)[source]¶
Extract the model input from a dataset sample.
Behavior: - If input_getter is provided use it to obtain the input. - If the sample is a tuple like (input, label, …), return the first element. - Otherwise, return the sample as-is.
Notes: - Lists are treated as input-only feature vectors and are NOT unpacked.
- save_distributions(path, distributions, *, meta=None)[source]¶
Save distributions and optional metadata as JSON.
- model: Callable[..., Any]¶
- class probly.data_generation.first_order_datagenerator.FirstOrderDataset(base_dataset, distributions, input_getter=None, return_numpy=True)[source]¶
Bases:
objectDataset wrapper pairing inputs (and labels if present) with distributions.
- class probly.data_generation.first_order_datagenerator.SimpleDataLoader(dataset, batch_size=64, shuffle=False)[source]¶
Bases:
objectA minimal Python data loader that batches items by index.
- Parameters:
dataset (DatasetLike)
batch_size (int)
shuffle (bool)
- probly.data_generation.first_order_datagenerator.output_dataloader(base_dataset, distributions, *, batch_size=64, shuffle=False, num_workers=0, pin_memory=False, input_getter=None, return_numpy=True)[source]¶
Create a loader that yields inputs (and labels if present) with distributions.
Note: num_workers and pin_memory are kept for API parity with Torch but ignored here.
- Parameters:
- Return type: