Multiple Randomised Cross Validation: private API
PortfolioOptimisers.SubsetSizeEstimator — Type
abstract type SubsetSizeEstimator <: AbstractEstimatorAbstract supertype for estimators that determine the size of each asset subset.
A subtype reaches a MultipleRandomised through its subset_size field, and is called on the returns data to give the value.
Related
PortfolioOptimisers.NumberSubsetsEstimator — Type
abstract type NumberSubsetsEstimator <: AbstractEstimatorAbstract supertype for estimators that determine the number of random subsets to draw.
A subtype reaches a MultipleRandomised through its n_subsets field, and is called on the returns data to give the value.
Related
PortfolioOptimisers.WindowSizeEstimator — Type
abstract type WindowSizeEstimator <: AbstractEstimatorAbstract supertype for estimators that determine the rolling window size.
A subtype reaches a MultipleRandomised through its window_size field, and is called on the returns data to give the value.
Related
PortfolioOptimisers.SubsetSizeEC — Type
const SubsetSizeECUnion of SubsetSizeEstimator subtypes and plain functions that compute a subset size from a returns dataset.
PortfolioOptimisers.NumberSubsetsEC — Type
const NumberSubsetsECUnion of NumberSubsetsEstimator subtypes and plain functions that compute the number of subsets from a returns dataset.
PortfolioOptimisers.WindowSizeEC — Type
const WindowSizeECUnion of WindowSizeEstimator subtypes and plain functions that compute a window size from a returns dataset.
PortfolioOptimisers.SubsetSizeE — Type
const SubsetSizeEUnion of a concrete subset-size value or an estimator/function for it.
PortfolioOptimisers.NumberSubsetsE — Type
const NumberSubsetsEUnion of a concrete number-of-subsets value or an estimator/function for it.
PortfolioOptimisers.WindowSizeE — Type
const WindowSizeEUnion of a concrete window-size value or an estimator/function for it.
PortfolioOptimisers.MRCVR — Type
const MRCVR = Union{<:MultipleRandomised, <:MultipleRandomisedResult}Alias for a multiple-randomised cross-validation estimator or result.
Matches either a MultipleRandomised estimator or a MultipleRandomisedResult.
Related
PortfolioOptimisers.path_fit_and_predict — Function
path_fit_and_predict(opt, rd, train_idx, test_idx, cols; ex, id, cv)Fit and predict along a sequence of (train, test, asset) triples, respecting sequential constraints.
The path runs through fold_loop, which takes each fold's asset-subset view of (opt, rd) and resolves the fold's time-dependent entries. The path runs sequentially when the optimiser needs the previous fold's weights, and in parallel over ex otherwise. A time-dependent optimiser alone does not force sequential execution, because its per-fold values are known upfront. cv is the scheme the path belongs to, handed on so the loop reads its Fold Fit (fold_fit): under an OnlineStep the path's estimator is sliced to the subset once and threaded through the path's folds.
Arguments
opt::NonFiniteAllocationOptimisationEstimator: Portfolio optimisation estimator.rd::ReturnsResult: FullMoment returns data.train_idx: Sequence of training index vectors.test_idx: Sequence of test index vectors.cols: Sequence of asset column indices for each fold.ex::FLoops.Transducers.Executor: Executor for parallel processing.id: Optional path identifier.cv: The scheme the path belongs to, ornothing.
Returns
MultiPeriodPredictionResultwith predictions sorted by test index.
Related
PortfolioOptimisers.combination_by_index — Function
combination_by_index(idx::Integer, N::Integer, k::Integer) -> VecIntReturn the idx-th combination of k items from N total items.
Internal helper for combinatorial path generation. Converts a lexicographic combination index to the actual combination elements.
Arguments
idx: Combination index (1-based).N: Total number of items.k: Number of items in each combination.
Returns
- Vector of
kitem indices.
Related
PortfolioOptimisers.get_window_size — Function
get_window_size(window_size, rd, args...)Get the actual rolling window size for multiple-randomised cross-validation.
Resolves the window size from nothing (no windowing), an integer (direct count), a float (fraction of observations), or a callable.
Arguments
window_size: Window size specification (nothing, integer, float, or callable).rd: Returns result or prior.args...: Additional arguments.
Returns
- Integer window size or
nothing.
Related
PortfolioOptimisers.get_n_subsets — Function
get_n_subsets(n_subsets, args...)Get the number of asset subsets for multiple-randomised cross-validation.
Resolves the number of subsets from either an integer (direct count) or a callable that computes it from the returns data.
This is the single point at which the (possibly TimeDependent or callable) subset count becomes a concrete integer, so it is where the RESOURCE_LIMITS max_n_subsets ceiling is enforced — a constructor check could not see the value a schedule or callable ultimately produces. Every subset runs a full inner optimisation, so an absurd count is a compute-exhaustion sink rather than a merely large allocation.
Arguments
n_subsets: Integer or callable number-of-subsets specification.args...: Additional arguments (returns result or prior).
Returns
- Integer number of subsets.
Related
PortfolioOptimisers.sample_unique_assets — Function
sample_unique_assets(N, k, n_subsets; kwargs...)Sample n_subsets unique asset subsets of size k from N assets.
Internal function used in multiple-randomised cross-validation to generate diverse asset subsets for resampling.
Arguments
N: Total number of assets.k: Subset size.n_subsets: Number of unique subsets to sample.kwargs...: Additional keyword arguments (e.g., random seed).
Returns
- Matrix of size
(k, n_subsets)with asset indices.
Related
PortfolioOptimisers.get_subset_size — Function
get_subset_size(subset_size, rd, args...)Get the actual asset subset size for multiple-randomised cross-validation.
Resolves the subset size from either an integer (direct count) or a fraction of the total assets.
Arguments
subset_size: Integer or float subset size specification.rd: Returns result or prior.args...: Additional arguments.
Returns
- Integer subset size.
Related