1 lightning.finite_horizon.selection
lightning.finite_horizon.selection
Closed QH selection policy, trainer normalization and saved-epoch ranking.
This owner admits current trainer inputs and authenticates saved checkpoint scores. Experiment composition owns admission order and publication; historical receipt readers validate their stored schema directly rather than replaying these controls.
1.1 Classes
| Name | Description |
|---|---|
| QhCheckpointSelectionSpec | Closed validation-checkpoint selection rule. |
1.1.1 QhCheckpointSelectionSpec
lightning.finite_horizon.selection.QhCheckpointSelectionSpec(
kind='validation_min_v1',
monitor='val/loss',
mode='min',
tie_break='earliest_optimizer_update',
)Closed validation-checkpoint selection rule.
1.1.1.1 Attributes
| Name | Description |
|---|---|
| kind | Final-update selection fixes the budget; diagnostic H1 regret selects an epoch by action cost. |
| monitor | Val/loss normally; diagnostic H1 regret uses the separately admitted scene-equal state mean. |
| mode | The explicitly admitted validation monitor is minimized. |
| tie_break | An exact metric tie retains the earlier optimizer update. |
1.2 Functions
| Name | Description |
|---|---|
| checkpoint_current_metric | Read this saved epoch’s score from its matching ModelCheckpoint state. |
| normalize_trainer | Bind run paths and closed selection callbacks to admitted current inputs. |
| select_checkpoint | Rank by admitted loss or diagnostic regret; return the selected calibration loss. |
1.2.1 checkpoint_current_metric
lightning.finite_horizon.selection.checkpoint_current_metric(payload, monitor)Read this saved epoch’s score from its matching ModelCheckpoint state.
best_model_score may refer to a different optimizer update. Only a unique ModelCheckpoint state with the exact monitor and finite scalar current_score establishes the saved checkpoint’s regret rank.
1.2.2 normalize_trainer
lightning.finite_horizon.selection.normalize_trainer(
trainer,
output,
selection,
*,
diagnostic=False,
)Bind run paths and closed selection callbacks to admitted current inputs.
Validation-selected policies restore explicitly disabled validation limits; final-update diagnostics retain training-only admission and reject debug overrides. Gradient clipping remains with the QH optimizer lifecycle.
1.2.3 select_checkpoint
lightning.finite_horizon.selection.select_checkpoint(
output,
*,
selection=None,
expected_final_update=None,
expected_validation_epochs=None,
)Rank by admitted loss or diagnostic regret; return the selected calibration loss.
Both policies break exact metric ties by earliest optimizer update. The returned loss always comes from that checkpoint’s validation loss buffers, even when a distinct callback current_score chooses the epoch.