dataset
dataset
¶
Dataset-based explanation source.
DatasetExplanationSource
¶
DatasetExplanationSource(config, policy, split, batch_size, sample_stride, max_samples, data_path_override=None, zarr_cache_directory=None)
Yield explanation batches from versatil schema-based zarr data.
Note
Missing zarr data is created from raw data described by the dataset schema. Override inputs must use the same schema type as the checkpoint configuration.
Initialize the dataset-backed source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
DatasetRunnerConfig
|
Instantiated training configuration loaded from the checkpoint. |
required |
policy
|
Policy
|
Loaded policy whose normalizer should be reused by the dataset sample builder. |
required |
split
|
str
|
Dataset split to explain: |
required |
batch_size
|
int
|
Number of sampled windows per explanation batch. |
required |
sample_stride
|
int
|
Keep every Nth sample in deterministic dataset order. |
required |
max_samples
|
int | None
|
Optional cap on the number of sampled windows. |
required |
data_path_override
|
str | list[str] | None
|
Optional offline input location to explain
instead of the training data path stored in the checkpoint task config.
- |
None
|
zarr_cache_directory
|
Path | None
|
Directory used to store zarr data created from
raw |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/versatil/explainability/sources/dataset.py
__iter__
¶
Yield deterministic explanation batches.
Returns:
| Type | Description |
|---|---|
Iterator[ExplanationBatch]
|
Iterator of model-ready batches. Dataset samples are already |
Iterator[ExplanationBatch]
|
normalized/tokenized, so |