1 lightning.finite_horizon.datamodule
lightning.finite_horizon.datamodule
Stage admission and deterministic loaders for Q_H chain datasets.
Construction is a hard admission boundary: configured stages must be nonempty, share one population-independent fitted-Q semantics projection, and have disjoint scene sets. Candidate-generator, rollout-recipe, and behavior-policy vocabularies may differ by stage because they identify the sampled population, not the Bellman problem; the experiment bundle retains each stage’s full provenance. Once admitted, loaders preserve the dataset’s padded candidate width, seed each DataLoader’s torch generator from the configured module seed, and derive Python/NumPy worker seeds from each worker’s torch.initial_seed().
1.1 Classes
| Name | Description |
|---|---|
| QhDataModule | Admit semantically compatible, scene-disjoint fitted-Q populations. |
| QhLearningContract | Complete identity of replay semantics used to optimize and evaluate Q_H. |
1.1.1 QhDataModule
lightning.finite_horizon.datamodule.QhDataModule(
train,
val=None,
test=None,
batch_size=1,
num_workers=0,
pin_memory=False,
persistent_workers=False,
seed,
experiment_profile=None,
objective_profile='legacy_selected_rows_v1',
shuffle_h1_training_labels=False,
epoch_deterministic_training_order=False,
train_scene_sampling=None,
)Admit semantically compatible, scene-disjoint fitted-Q populations.
Equality of the full QhDataContract would accidentally require train, validation, and test to contain the same candidate-generator, rollout-recipe, and behavior-policy vocabularies. Those vocabularies are distribution provenance and may intentionally differ to measure population shift. Admission therefore compares QhDataContract.learning_semantics while the resulting QhLearningContract binds the full training contract. QhExperiment separately serializes every stage’s full provenance, so this relaxation does not erase or conflate artifact identity.
1.1.1.1 Attributes
| Name | Description |
|---|---|
| train_sampling_receipt | Return frozen TRAIN draw lineage; validation/test remain sequential. |
1.1.1.2 Methods
| Name | Description |
|---|---|
| train_dataloader | Build the deterministically shuffled training loader. |
| val_dataloader | Build the sequential validation loader when configured. |
| test_dataloader | Build the sequential test loader when configured. |
1.1.1.2.1 train_dataloader
lightning.finite_horizon.datamodule.QhDataModule.train_dataloader()Build the deterministically shuffled training loader.
1.1.1.2.2 val_dataloader
lightning.finite_horizon.datamodule.QhDataModule.val_dataloader()Build the sequential validation loader when configured.
1.1.1.2.3 test_dataloader
lightning.finite_horizon.datamodule.QhDataModule.test_dataloader()Build the sequential test loader when configured.
1.1.2 QhLearningContract
lightning.finite_horizon.datamodule.QhLearningContract(
data_contract,
max_horizon,
horizon_weighting=QH_HORIZON_WEIGHTING,
objective_profile='legacy_selected_rows_v1',
)Complete identity of replay semantics used to optimize and evaluate Q_H.
1.1.2.1 Attributes
| Name | Description |
|---|---|
| data_contract | Training-stage semantics and population identity bound into the model. |
| max_horizon | Largest acquisition horizon shared by the admitted stages. |
| horizon_weighting | Candidate-within-state, state-within-horizon, equal-horizon aggregation identity. |
| objective_profile | Closed fitted-Q support and padding semantics. |
1.1.2.2 Methods
| Name | Description |
|---|---|
| learning_semantics | Return the population-independent optimization contract. |
1.1.2.2.1 learning_semantics
lightning.finite_horizon.datamodule.QhLearningContract.learning_semantics()Return the population-independent optimization contract.
The complete training contract remains the model and bundle identity. This projection is only for compatibility checks against validation or held-out stages whose candidate-generator, rollout-recipe, and behavior-policy vocabularies may intentionally differ. Reward, target, mask, actor-source, horizon, weighting, and objective semantics remain exact; stage artifact identity remains separately bound by dataset configuration and provenance hashes.