Stacking: private API

PortfolioOptimisers.BaseStackingOptimisationEstimatorType
abstract type BaseStackingOptimisationEstimator <: NonFiniteAllocationOptimisationEstimator

Abstract supertype for stacking-based portfolio optimisation estimators.

A stacking estimator treats each of several inner optimisers as one synthetic asset, and lets an outer optimiser allocate across that synthetic universe. It is the portfolio form of stacked generalisation: the outer model learns how much to trust each inner model, rather than the inner models being averaged by a fixed rule.

Related

References

  • [143] D. H. Wolpert. Stacked generalization. Neural Networks 5, 241–259 (1992).
source
PortfolioOptimisers.stacking_td_defaultsFunction
stacking_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}, opti::NoDefault, opto::NoDefault, wf::IterativeWeightFinaliser{Int64}}

Return the static defaults of the Stacking 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 and wf reset to their keyword defaults; fields whose static default is nothing (wb, fees, sets, scale, fb) are omitted.

Related

source
PortfolioOptimisers.reset_time_dependent_estimatorMethod
reset_time_dependent_estimator(opt::Stacking) -> Stacking

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.

source
PortfolioOptimisers.assert_special_nco_requirementsMethod
assert_special_nco_requirements(opt)

Assert that the optimiser meets special requirements for Nested Clustered Optimisation (NCO).

The default implementation does nothing. Overridden for estimators (e.g. Stacking) that have requirements which must be validated before NCO can proceed.

Arguments

  • opt: Optimisation estimator, result, or vector thereof.

Returns

  • nothing.

Related

source
PortfolioOptimisers.assert_special_nco_requirements_stacking_optiFunction
assert_special_nco_requirements_stacking_opti(
    opti::AbstractVector
)

Validate that a Stacking candidate vector contains no precomputed results.

The candidates in opti are refit on each inner cross-validation fold to produce the columns the outer optimiser stacks. A NonFiniteAllocationOptimisationResult is already solved, so it cannot be refit per fold and has no candidate semantics here; it is rejected at construction rather than silently producing a column that ignores the fold.

Arguments

  • opti::AbstractVector: Candidate optimisers to validate.

Validation

  • !any(x -> isa(x, NonFiniteAllocationOptimisationResult), opti).

Returns

  • nothing.

Related

source

References

[143]
D. H. Wolpert. Stacked generalization. Neural Networks 5, 241–259 (1992).