quantlab.runs.trained_run.write_walk_forward_run#
- quantlab.runs.trained_run.write_walk_forward_run(directory, *, folds, cv_mean, provenance=None)[source]#
Write the
run.jsonof a"walk_forward"unit and return the unit.Fold i is the unit in
fold_directory(directory, i), which must already be written; its windows and metrics are copied from its ownrun.jsoninto the walk-forward record.- Parameters:
- directoryPath or str
The unit’s directory.
- foldssequence of int
The fold indices, in fold order.
- cv_meandict
The fold means of the metrics; NaN and inf become null.
- 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:
- TrainedRun
The walk-forward unit, as
TrainedRun.openreads it.
Examples
>>> run = write_walk_forward_run(trial, folds=[0, 1], cv_mean={}) >>> run.kind, [fold.index for fold in run.folds] ('walk_forward', [0, 1])