Online selection rules: the first set: private API

PortfolioOptimisers.NewtonStepState — Type
struct NewtonStepState{__T_n, __T_A, __T_b} <: AbstractPartialFitState

Carries the Gram matrix of the past gradients and their weighted sum, for the online Newton step.

NewtonStep seeds it with the identity matrix and a zero vector, and every update adds the gradient of the period to both in place. A view keeps the rows and the columns of the selected assets.

Fields

  • n: Number of observations folded into the state.
  • A: The Gram matrix $A_t = I + \sum_{s \leq t} \boldsymbol{g}_s \boldsymbol{g}_s^\intercal$, assets × assets. The update writes it in place.
  • b: The weighted gradient sum $\boldsymbol{b}_t = (1 + 1/\beta) \sum_{s \leq t} \boldsymbol{g}_s$, assets × 1. The update writes it in place.

Related

source
PortfolioOptimisers.ExpertMixtureState — Type
struct ExpertMixtureState{__T_n, __T_st, __T_h, __T_pst, __T_p} <: AbstractPartialFitState

Carries the Rule State and the allocation of every expert, and the Rule State and the weights of the weighting, for an expert mixture.

ExpertMixture seeds it and replaces every entry once per period. A view slices the carrier and the allocation of every expert to the selected assets, and carries the weighting's carrier and the weights unchanged, because they are stated over the experts.

Fields

  • n: Number of observations folded into the state.
  • st: The carrier of each expert, one entry per expert, nothing where the expert carries nothing.
  • h: The allocation that each expert holds during the current period, one vector per expert.
  • pst: The carrier of the weighting, or nothing.
  • p: The weight vector over the experts during the current period, experts × 1.

Related

source
PortfolioOptimisers.expert_start_allocation — Function
expert_start_allocation(alg::AbstractOnlinePortfolioSelectionAlgorithm, w::AbstractVector)
expert_start_allocation(alg::ConstantRebalancedPortfolio, w::AbstractVector)

Returns the allocation that an expert of an ExpertMixture holds during the first period.

A rule that reads w holds the Start Allocation. A constant rebalanced portfolio holds its own target, or the uniform allocation when its w is nothing, so a sampled expert's wealth is Cover's $S_t(\boldsymbol{b})$ from the first period. The head itself holds the Start Allocation for that period in both cases. The seed of the mixture then projects the answer onto the head's Allocation Set in the expert's geometry, through project_start. So the expert never holds a target that a bound of the set excludes, such as a one-hot allocation under a cap. The target comes back in the numeric type that the head's allocation and the target promote to. So an integer target, such as a one-hot expert of a switching portfolio, seeds a carrier that can hold the projected allocation.

Arguments

  • alg: The expert rule.
  • w: The Start Allocation of the head.

Returns

  • h::AbstractVector: The allocation that the expert holds during the first period, before the seed projects it.

Related

source
PortfolioOptimisers.expert_start_weights — Function
expert_start_weights(
    alg::ExpertMixture,
    K::Integer,
    datatype::DataType
) -> Any

Returns the weights over the K experts that an ExpertMixture starts from, projected onto the Expert Set.

The start is p0, or the uniform weights when p0 is nothing. The projection is in the weighting's geometry, as the head projects w0 onto the Allocation Set, so the projection makes a start outside the set feasible, and the function never refuses it. On the bare simplex the uniform start lies in the set, so the function skips the projection and the default start is exactly uniform.

Algorithm

  1. Set p0 to alg.p0, or to the uniform vector of length K in datatype when alg.p0 is nothing.
  2. When alg.p0 and alg.eset are both nothing, return p0.
  3. Otherwise, resolve the Expert Set with expert_allocation_set. Project p0 onto it in the geometry of alg.alg, from p0, and return the projection.

Arguments

  • alg: The mixture.
  • K: The number of experts.
  • datatype: The numeric type of the weights.

Returns

  • p::AbstractVector: The start weights, one entry per expert.

Related

source
PortfolioOptimisers.gradient_point — Function
gradient_point(grad::OwnPoint, w::AbstractVector)
gradient_point(grad::BlendPoint, w::AbstractVector)

Returns the Gradient Point that an ExpertMixture passes to its experts through the seven-argument online_update!.

Under OwnPoint the point is nothing, so every expert takes its own six-argument update. Under BlendPoint it is the blend w that the mixture played.

Arguments

  • grad: The Gradient Point of the mixture.
  • w: The blend that the mixture played during the period.

Returns

  • point::Option{<:AbstractVector}: nothing, or w.

Related

source
PortfolioOptimisers.expert_allocation_set — Function
expert_allocation_set(eset::Nothing, K::Integer, datatype::DataType)
expert_allocation_set(eset::BoundedAllocationSet, K::Integer, datatype::DataType)

Resolves the Expert Set over K experts.

A mixture that holds no Expert Set gets the bare simplex over the experts. A mixture that holds one gets its bounds, a scalar bound broadcast over the experts and a vector bound read with one entry per expert.

Arguments

  • eset: The Expert Set of the mixture, or nothing.
  • K: The number of experts.
  • datatype: The numeric type of the bounds.

Returns

  • set::BoundedAllocationSet: The resolved Expert Set.

Related

source