Multiple Randomised Cross Validation

PortfolioOptimisers.MultipleRandomisedType
struct MultipleRandomised{__T_cv, __T_subset_size, __T_n_subsets, __T_max_comb, __T_window_size, __T_rng, __T_seed} <: NonOptimisationSequentialCrossValidationEstimator

Cross-validation scheme that draws multiple random asset subsets and applies a walk-forward estimator to each. Each combination of a random asset subset and a set of walk-forward folds forms one path.

Fields

  • cv: Cross-validation estimator.
  • subset_size: Size of each random subset.
  • n_subsets: Number of random subsets.
  • max_comb: Maximum number of unique asset subsets.
  • window_size: Rolling window size for randomised cross-validation.
  • rng: Random number generator.
  • seed: Seed for the random number generator.

Constructors

MultipleRandomised(    cv::WalkForwardEstimator;    subset_size::SubsetSizeE = 1,    n_subsets::NumberSubsetsE = 2,    max_comb::Integer = 1_000_000_000,    window_size::Option{<:WindowSizeE} = nothing,    rng::Random.AbstractRNG = Random.default_rng(),    seed::Option{<:Integer} = nothing) -> MultipleRandomised

cv is positional; remaining arguments are keyword and correspond to the struct's fields.

Validation

  • If subset_size is an Integer: subset_size >= 1.
  • If subset_size is a float: 0 < subset_size < 1.
  • If n_subsets is an Integer: n_subsets >= 2.
  • max_comb > 0 and finite.
  • If window_size is an Integer: window_size >= 2.
  • If window_size is a float: 0 < window_size < 1.

Related

References

  • [94] D. P. Palomar. Portfolio Optimization: Theory and Application (Cambridge University Press, 2025). Chapter 8.
source
PortfolioOptimisers.MultipleRandomisedResultType
struct MultipleRandomisedResult{__T_train_idx, __T_test_idx, __T_asset_idx, __T_path_ids} <: NonOptimisationSequentialCrossValidationResult

Stores the split result produced by MultipleRandomised. Contains the training, test, and asset index sets for every fold across all random paths, along with a path identifier for each fold.

Fields

  • train_idx: Training set indices.
  • test_idx: Test set indices.
  • asset_idx: Asset column indices per fold.
  • path_ids: Path identifiers for cross-validation splits.

Constructors

MultipleRandomisedResult(;    train_idx::VecVecInt,    test_idx::VecVecInt,    asset_idx::VecVecInt,    path_ids::VecInt) -> MultipleRandomisedResult

Keywords correspond to the struct's fields.

Validation

  • !isempty(train_idx).
  • !isempty(test_idx).
  • !isempty(asset_idx).
  • !isempty(path_ids).
  • length(train_idx) == length(test_idx) == length(asset_idx) == length(path_ids).

Related

source
Base.splitMethod
Base.split(mrcv::MultipleRandomised, rd::Prices_RR) -> MultipleRandomisedResult

Split the price- or returns-level data rd by drawing multiple random asset subsets and applying the internal walk-forward estimator to each subset. Each combination of a random asset subset and a set of walk-forward folds forms one path.

Unlike combinatorial cross-validation, multiple-randomised resampling draws over assets (columns) while every observation window comes from an inner walk-forward, so the rows of each fold stay contiguous. That is why it is admissible at the price level for a price-starting pipeline — the rolling-window rule that blocks combinatorial does not apply.

The draw is over the Coverage Universe of the path's own window

Each path draws its window first, then draws subset_size assets from the Coverage Universe of that window: the assets whose price or return is finite at every row of it, and whose active mask in the AssetPanel is true at every row of it. A subset is therefore always subset_size live assets, and a dead asset is never drawn, so no inner optimisation is handed a column it could not have traded.

max_comb applies per path, because the combination count is now binomial(live_assets, subset_size) of that path's window rather than one number for the whole sample. A window whose Coverage Universe is smaller than subset_size throws an IsEmptyError naming both counts.

Warning

The window draw and the asset draw swapped order in the one random stream the seed governs, so a seeded split gives different indices from the released one. The split is still deterministic in seed.

Arguments

  • mrcv::MultipleRandomised: Multiple randomised cross-validation estimator.
  • rd::Prices_RR: Price- or returns-level data to split.

Validation

  • Every path's Coverage Universe must hold at least subset_size assets.

Returns

  • MultipleRandomisedResult: Result containing training, test, and asset indices for every fold across all random paths, together with a path identifier for each fold. Every asset index names a column that is live throughout its own path's window.

Related

source

References

[94]
D. P. Palomar. Portfolio Optimization: Theory and Application (Cambridge University Press, 2025).