Subset resampling: private API
PortfolioOptimisers.BaseSubsetResamplingOptimisationEstimator — Type
abstract type BaseSubsetResamplingOptimisationEstimator <: NonFiniteAllocationOptimisationEstimatorAbstract 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.
PortfolioOptimisers.is_time_dependent — Method
is_time_dependent(opt::SubsetResampling) -> Any
Return true when opt holds a TimeDependent schedule.
The method reads the fields of opt itself, then asks the same question of opt.opt and opt.fb.
Related
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
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
- Allocate
w, a vector of $N$ zeros with the element type of the weights of the first subset. - For each subset
i, address[i].wintowat the asset indicesasset_idx[:, i]. - Divide
wbyn_subsets. - Finalise
wwithwfunderwbthroughfinalise_weight_bounds, givingretcodeand the finalisedw. - Combine
retcodewith the return codes ofressthroughsubset_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 ofasset_idx.w::VecNum_VecVecNum: Weights of the first subset. The method reads only the type ofw. A vector of vectors selects the efficient-frontier method.
Returns
retcode: The return code fromsubset_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
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
- Read the return code of each subset result, giving
resi_retcodes. - Return
retcodeunchanged when no entry ofresi_retcodesand notretcodeis anOptimisationFailure. - Otherwise build
msg, with the lineopti failed.when a subset failed, and then the lineweight bounds finalisation failed.when the finaliser failed. - Return an
OptimisationFailurewhoseresis(; 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
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
PortfolioOptimisers.group_frames — Method
group_frames(opt::NestedClustered) -> ReturnsFrames
group_frames(opt::Union{BaseStackingOptimisationEstimator, BaseSubsetResamplingOptimisationEstimator}) -> ReturnsFramesWalk 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 ofopt.
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.