Nested Clustered: private API
PortfolioOptimisers.RiskBudgetingOptimiser — Type
const RiskBudgetingOptimiser = Union{<:RiskBudgeting, <:RelaxedRiskBudgeting}Alias for risk budgeting JuMP optimisers.
Matches either RiskBudgeting or RelaxedRiskBudgeting. Used for dispatch in NCO validation and constraint generation.
Related
PortfolioOptimisers.nested_clustered_td_defaults — Function
nested_clustered_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}, cle::ClustersEstimator{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}, Distance{Nothing, CanonicalDistance}, HClustAlgorithm{Symbol}, OptimalNumberClusters{Nothing, SecondOrderDifference{StandardisedValue{MeanValue{Nothing}, StdValue{Nothing, Bool}}}}}, opti::NoDefault, opto::NoDefault, wf::IterativeWeightFinaliser{Int64}}
Return the static defaults of the NestedClustered fields that may hold a TimeDependent.
Shared by the constructor's test-substitution pass and time_dependent_field_defaults. The optimiser-valued fields opti and opto are required and have no static default, so they are marked NoDefault: a schedule there must carry its own default to be usable outside a fold loop. pe, cle and wf reset to their keyword defaults; fields whose static default is nothing (wb, fees, sets, fb) are omitted.
Related
PortfolioOptimisers.is_time_dependent — Method
is_time_dependent(opt::NestedClustered) -> Any
Return true if the inner optimiser, outer optimiser, or fallback carries time-dependent constraints.
PortfolioOptimisers.reset_time_dependent_estimator — Method
reset_time_dependent_estimator(
opt::NestedClustered
) -> NestedClustered
Replace this meta-optimiser's own time-dependent fields with their static defaults.
Deliberately does not recurse into the wrapped optimisers: a standalone meta solve consumes inner per-fold schedules through its inner cross-validation leg, and its fold-less full-window inner solves reset themselves at their own _optimise seam. Only the meta's own fields (applied to the combined weights, resolved by an outer fold loop when one exists) are inert here. A bind = :nearest schedule in a field the meta hands across its own inner fold loop (see inner_fold_fields) is likewise left in place — resetting it here would replace it with its default before the inner cross-validation ever saw it.
PortfolioOptimisers.assert_rc_pl — Method
assert_rc_pl(opt)Assert that the optimiser does not use phylogeny risk contribution for NCO outer optimisation.
Checks that factor risk contribution optimisers do not use phylogeny-based constraints when used as the outer optimiser in NCO.
Arguments
opt: Optimisation estimator.
Returns
nothingon success; throws anArgumentErrorotherwise.
Related
PortfolioOptimisers.stated_constraint_space_basis — Function
stated_constraint_space_basis(space::FactorSpace) -> Bool
stated_constraint_space_basis(ece::ExposureConstraintEstimator) -> Bool
stated_constraint_space_basis(lcse::AbstractVector) -> Bool
stated_constraint_space_basis(::Any) -> BoolReport whether anything in an lcse slot carries a precomputed basis, so an outer optimiser can refuse it.
A stated basis is asset-indexed data written before the universe was known. An inner solve slices the universe, and port_opt_view slices the basis with it, so a stated basis is legal there. An outer solve replaces the universe with cluster names, and no slice of asset loadings follows that — so it must be refused, in the same shape as the refusals on opt.re and opt.rba.re.
The predicate is false for everything else, including a space whose re is an estimator: an estimator refits against whatever universe it is handed, which is exactly what makes it the remedy the message names.
Related
PortfolioOptimisers.assert_external_lcse — Function
assert_external_lcse(opt) -> NothingAssert that an outer optimiser's lcse slot carries no precomputed basis.
Factored out because the three JuMP-side assert_external_optimiser methods all need it and already share the precomputed-prior refusal. See stated_constraint_space_basis for why an outer solve refuses what an inner one views.
Related
PortfolioOptimisers.assert_external_optimiser — Method
assert_external_optimiser(opt)Assert that the outer optimiser is valid for use in NCO.
Checks that the outer optimiser does not use pre-computed prior results, regression results, or unsupported variance/phylogeny risk contribution configurations.
Arguments
opt: Outer optimisation estimator.
Returns
nothingon success; throws anArgumentErrorotherwise.
Related
PortfolioOptimisers.assert_rc_variance — Function
assert_rc_variance(opt)Assert that the optimiser does not use variance risk contribution for NCO outer optimisation.
Checks that risk budgeting-based JuMP optimisers do not use variance for risk contribution when used as the outer optimiser in NCO.
Arguments
opt: Optimisation estimator.
Returns
nothingon success; throws anArgumentErrorotherwise.
Related
PortfolioOptimisers._update_asset_sets — Function
_update_asset_sets(
nco::NestedClustered,
rdo::ReturnsResult
) -> Any
Align the outer optimiser's asset sets with the synthetic universe produced by the inner optimisations.
The outer optimiser of a NestedClustered does not see the original assets. It sees one synthetic asset per cluster, whose names are carried by the outer returns result rdo. An outer optimiser configured with UniverseSets built over the original universe would therefore resolve its constraints against the wrong names, so the sets are rebuilt over the cluster names before the outer solve.
Arguments
nco::NestedClustered: The nested clustered optimiser.rdo::ReturnsResult: Outer returns result, whosenxholds the cluster names.
Returns
nco::NestedClustered: Instance with the outer optimiser's asset sets rebuilt overrdo.nx, orncounchanged when it has no outer asset sets, or they already match.
Details
- Handles both shapes of outer optimiser: one that nests its own optimiser (
nco.opto.opt.sets) and one that carries the sets directly (nco.opto.sets). - The dictionary is copied before being reset, so the caller's
UniverseSetsis not mutated.
Related