personalitylinmult.data.dataset¶
Random-access reads from the built FI HDF5 file.
This dataset touches the HDF5 file and nothing else — no feature directories,
no label CSV, no pickles. That is what makes a training run reproducible from a
single published artifact, and what keeps __getitem__ down to one chunk
read per feature.
Analysis window. The file stores whole clips; the window is applied here, on
read, using each feature’s rate_hz. Changing window_seconds from 15 to
10 to 5 is a config edit, not a rebuild, and the crop is pushed into the HDF5
read itself so windowed-away data never crosses the bus.
Worker safety. h5py handles do not survive fork. The handle is therefore
opened lazily inside whichever process first calls __getitem__, and stripped
from the pickled state so spawn-based workers construct their own.
Attributes¶
Module-level logger. |
|
|
Exceptions¶
Raised when the HDF5 file cannot serve the requested configuration. |
Classes¶
Resolved read plan for one feature within one dataset. |
|
Reads FI samples for one split out of the built HDF5 file. |
Module Contents¶
- personalitylinmult.data.dataset.logger¶
Module-level logger.
- personalitylinmult.data.dataset.NO_RATE_SENTINEL = -1.0¶
rate_hzattribute value meaning “no wall-clock time axis”.
- exception personalitylinmult.data.dataset.DatasetError[source]¶
Bases:
RuntimeErrorRaised when the HDF5 file cannot serve the requested configuration.
Initialize self. See help(type(self)) for accurate signature.
- class personalitylinmult.data.dataset.FeatureView(name: str, dim: int, stored_time_dim: int, window_time_dim: int, rate_hz: float | None, n_layers: int)[source]¶
Resolved read plan for one feature within one dataset.
- Parameters:
name (str) – Feature name.
dim (int) – Feature width.
stored_time_dim (int) – Time dimension as stored in the file.
window_time_dim (int) – Time dimension after windowing.
rate_hz (float | None) – Native rate, or
Noneif not wall-clock.n_layers (int) – Layer count,
0when there is no layer axis.
- property is_multi_layer: bool¶
Whether reads carry a layer axis.
- Returns:
Truewhen the model should see(B, L, T, F).- Return type:
bool
- property is_windowed: bool¶
Whether the analysis window crops this feature.
- Returns:
Truewhen the stored clip is longer than the window.- Return type:
bool
- class personalitylinmult.data.dataset.FiHdf5Dataset(h5_path: str | pathlib.Path, subset: str, feature_names: collections.abc.Sequence[str], target_names: collections.abc.Sequence[str], window_seconds: float | None = None, crop_mode: str = 'head', seed: int = 42)[source]¶
Bases:
torch.utils.data.DatasetReads FI samples for one split out of the built HDF5 file.
- Parameters:
h5_path (str | Path) – The built dataset.
subset (str) – One of
"train","valid","test".feature_names (Sequence[str]) – Features to return, in model input order.
target_names (Sequence[str]) – Label columns to return, in head order.
window_seconds (float | None) – Analysis window.
Nonereads whole clips.crop_mode (str) –
"head","center", or"random"."random"is honoured only on the training split; evaluation always uses"center"so it stays deterministic.seed (int) – Base seed for
"random"cropping.
- Raises:
DatasetError – If the file is missing, has the wrong schema version, or lacks a requested feature or target.
SchemaError – If
subsetorcrop_modeis not recognised.
- property handle: h5py.File¶
The process-local HDF5 handle, opened on first use.
Opening lazily is what makes the dataset fork-safe: each worker creates its own handle rather than inheriting a parent’s, which HDF5 does not support and which corrupts reads.
- Returns:
The open file.
- Return type:
h5py.File