Subset resampling: private API

PortfolioOptimisers.BaseSubsetResamplingOptimisationEstimator — Type
abstract type BaseSubsetResamplingOptimisationEstimator <: NonFiniteAllocationOptimisationEstimator

Abstract supertype for the estimators that average one optimiser over random subsets of the assets.

A subtype draws random subsets of the assets, solves one base optimiser on each subset, and averages the subset weights into weights over all the assets. Each subset portfolio rests on parameters that are estimated more accurately than those of one solve over all the assets, and the average of the subset portfolios is diversified over all the assets, as in the abstract of [4].

Related

References

  • [4] W. Shen and J. Wang. Portfolio selection via subset resampling. In: Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence (2017); pp. 1517–1523. Abstract.
source
PortfolioOptimisers.reset_time_dependent_estimator — Method
reset_time_dependent_estimator(
    opt::SubsetResampling
) -> SubsetResampling

Reset each TimeDependent schedule in the fields of opt itself to its value outside a fold loop.

The method does not reset the schedules inside opt.opt or opt.fb. Each subset solve calls optimise, which resets the schedules of the optimiser that it solves, and optimise resets a fallback before it solves it.

Related

source
PortfolioOptimisers.subset_resampling_finaliser — Function
subset_resampling_finaliser(N::Integer, n_subsets::Integer, asset_idx::MatNum,
                            wb::WeightBounds, wf::WeightFinaliser,
                            ress::VecOpt, w::VecNum_VecVecNum)

Average the subset weights over all the assets, and finalise the average under the weight bounds.

The method computes $\boldsymbol{w}^*$ of the # Mathematical definition of SubsetResampling.

Algorithm

  1. Allocate w, a vector of $N$ zeros with the element type of the weights of the first subset.
  2. For each subset i, add ress[i].w into w at the asset indices asset_idx[:, i].
  3. Divide w by n_subsets.
  4. Finalise w with wf under wb through finalise_weight_bounds, giving retcode and the finalised w.
  5. Combine retcode with the return codes of ress through subset_resampling_retcode.

On an efficient frontier, the method runs the steps once for each point.

Arguments

  • N::Integer: Number of assets in the universe that the subsets come from.
  • n_subsets::Integer: Number of asset subsets.
  • asset_idx::MatNum: Asset indices, one column for each subset.
  • wb::WeightBounds: Weight bounds of the finaliser.
  • wf::WeightFinaliser: Weight finaliser that repairs a bounds violation.
  • ress::VecOpt: Subset optimisation results, in the column order of asset_idx.
  • w::VecNum_VecVecNum: Weights of the first subset. The method reads only the type of w. A vector of vectors selects the efficient-frontier method.

Returns

  • retcode: The return code from subset_resampling_retcode, or one for each point of an efficient frontier.
  • w: The averaged and finalised weights, or one vector for each point of an efficient frontier.

Related

source
PortfolioOptimisers.subset_resampling_retcode — Function
subset_resampling_retcode(ress::VecOpt, retcode::OptimisationReturnCode)

Combine the return codes of the subset optimisations with the return code of the weight finaliser.

Algorithm

  1. Read the return code of each subset result, giving resi_retcodes.
  2. Return retcode unchanged when no entry of resi_retcodes and not retcode is an OptimisationFailure.
  3. Otherwise build msg, with the line opti failed. when a subset failed, and then the line weight bounds finalisation failed. when the finaliser failed.
  4. Return an OptimisationFailure whose res is (; msg, opti = resi_retcodes, wb = retcode). Each return code keeps its own diagnostics.

Arguments

  • ress: Results of the subset optimisations.
  • retcode: Return code of the weight finaliser.

Returns

  • retcode::OptimisationReturnCode: retcode, or the failure of step 4.

Related

source
PortfolioOptimisers.subset_resampling_td_defaults — Function
subset_resampling_td_defaults(

) -> @NamedTuple{pe::EmpiricalPrior{PortfolioOptimisersCovariance{Covariance{SimpleExpectedReturns{Nothing, Nothing, Nothing}, GeneralCovariance{SimpleCovariance, Nothing, Nothing}, FullMoment, Nothing, Nothing, Nothing}, MatrixProcessing{Posdef{UnionAll, @NamedTuple{}}, Nothing, Nothing, Nothing, NTuple{4, Symbol}}, Nothing}, SimpleExpectedReturns{Nothing, Nothing, Nothing}, Nothing, Nothing, Nothing, Nothing, Nothing}, opt::NoDefault, wf::IterativeWeightFinaliser{Int64}, subset_size::PowerSubsetSize{Float64}, n_subsets::Int64}

Return the static defaults of the SubsetResampling fields that can hold a TimeDependent.

The constructor passes the defaults to assert_time_dependent_substitution, and time_dependent_field_defaults returns them. opt is a required keyword and has no static default, so its entry is NoDefault. A schedule in opt must have its own default to run outside a fold loop. pe, wf, subset_size and n_subsets take their keyword defaults. The tuple omits wb, fees, sets and fb, because their static default is nothing.

Related

source
PortfolioOptimisers.group_frames — Method
group_frames(opt::NestedClustered) -> ReturnsFrames
group_frames(opt::Union{BaseStackingOptimisationEstimator, BaseSubsetResamplingOptimisationEstimator}) -> ReturnsFrames

Walk the readers of a meta-optimiser, for the warning of a forgotten raw reader and the gap rule of the head.

The group of a meta-optimiser is the head and every reader in its own slots: the prior pe, and the clustering cle of a NestedClustered. field_frames walks every field. The walk stops at the inner optimisers, the outer optimiser and the fallback, because each one is a head with its own group.

Arguments

  • opt: The meta-optimiser.

Returns

  • fr::ReturnsFrames: The frames of the group of opt.

Related

source

References

[4]
W. Shen and J. Wang. Portfolio selection via subset resampling. In: Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence (2017); pp. 1517–1523.