quantlab.runs.trained_run.write_ensemble_run#
- quantlab.runs.trained_run.write_ensemble_run(directory, *, seeds, train_window, fitted_train_window, test_window, metrics, provenance=None)[source]#
Write the
run.jsonof an"ensemble"unit, atomically, as its last file.Member k is the
"model"unit inmember_directory(directory, k), which must already be written;seedsholds one entry per member.- Parameters:
- directoryPath or str
The unit’s directory.
- seedssequence
Each member’s seed, None when the ensemble does not vary seeds.
- train_window, fitted_train_window, test_windowtuple
(start, end)pairs of the ensemble, seeTrainedRun.- metricsdict
The metrics of the combined prediction.
- provenancemapping, optional
The top unit’s
data_fingerprintandcode, and for an assembled unitassembled_from; None (a member, a fold) records an empty fingerprint and no code.
- Returns:
- Path
The
run.jsonwritten, the ensemble’s load-mode checkpoint.
Examples
>>> path = write_ensemble_run(unit, seeds=[0, 1], ... train_window=("2024-01-01", "2024-02-09"), ... fitted_train_window=("2024-01-01", "2024-02-07"), ... test_window=("2024-02-12", "2024-02-23"), ... metrics={}) >>> TrainedRun.open(path).checkpoint == path True