The programme Allocation Set and the Constrained Update's programme
ProgrammeAllocationSet is a set of allowed weights that takes every constraint a JuMPOptimiser takes, with the same field names and types, and the objective penalties of a JuMPOptimiser. A projection onto it is an optimisation, so it needs a solver. The set resolves the constraints that name assets once per fold, and rebuilds the constraints that read returns at every update. This page also has the two barrier geometries of the first-order rule, TsallisProjection and LogBarrierProjection. Their projection onto a BoundedAllocationSet is a root search on one scalar.
PortfolioOptimisers.ProgrammeAllocationSet — Type
struct ProgrammeAllocationSet{__T_pe, __T_slv, __T_r, __T_wb, __T_sbgt, __T_gbgt, __T_xbgt, __T_lt, __T_st, __T_lcse, __T_cte, __T_gcarde, __T_sgcarde, __T_smtx, __T_sgmtx, __T_slt, __T_sst, __T_sglt, __T_sgst, __T_tn, __T_sets, __T_tr, __T_ple, __T_ret, __T_ccnt, __T_cobj, __T_sc, __T_so, __T_ss, __T_card, __T_scard, __T_l2c, __T_lpc, __T_linfc, __T_l1, __T_l2, __T_lp, __T_linf} <: AbstractProgrammeAllocationSetConstrains an online allocation with every constraint kind of a JuMP optimiser, and projects onto the set with a solver.
The set takes the field names and the type bounds of JuMPOptimiser, and the direct objective penalties of the optimiser. A projection onto the set is a programme, so slv has no default. The budget is one, and the set has no budget field. Cash is an asset whose price relative is one, and the rule allocates it as any other asset.
The projection is a bare JuMP model with the variables and rows of the Weight Finaliser, which are w, k = 1, Σw = 1, the constraint scale and the objective scale. set_allocation_set_constraints! adds the constraint kinds through the builders of the optimiser, in the order that assemble_jump_model! runs them. set_projection_objective! sets the objective, the divergence of the rule's Projection Geometry plus the set's penalties.
The kinds read their data at two times. Once per fold, resolve_allocation_set resolves the kinds that hold the caller's object or a name over sets. These are wb, sbgt, gbgt, xbgt, lt, st, lcse, gcarde, sgcarde, smtx, sgmtx, slt, sst, sglt, sgst, tn, card, scard, ss, l2c, lpc, linfc, ccnt, l1, l2, lp, linf and cobj. Each goes to the builder that JuMPOptimiser gives it to. At every step, resolve_allocation_set_rows resolves the kinds that read the head's rows, on the prior result of pe fitted on those rows:
r, the risk ceilings. Each measure goes through its own JuMP builder, with the set as theRiskConstraintOwnerandsettings.ubas the ceiling.factoryfirst materialises the measure against the prior, so a moment that the measure carries is the moment its row uses. AVarianceorStandardDeviationthat holds its matrix reads no rows and no prior. It goes through the same builder with no prior, so the source of the matrix does not change the formulation (set_allocation_risk_ceiling!).tr, the tracking errors, andcte, the centrality rows.ple, the integer and semidefinite phylogeny kinds.- An exposure row in
lcse. The row goes through the loadings that itsFactorSpacefixes, because the rows carry no factor returns to fit the loadings again. ret, a floor on the prior's expected return of the allocation.
At every step factory replaces the reference of a turnover ceiling, and of a WeightsTracking, with the Price-Adjusted Allocation of the step. That is the book the fund trades from. A fixed object keeps the caller's reference.
A set that reads the rows, for which rows_needed returns nothing, fits its prior once over the whole prefix at every step, and then solves its programme. A caller who wants a window states it on pe. A covariance of one observation does not exist. So while the head holds fewer than two rows, the set fits no prior, and the step is a Held Step with its reason recorded (allocation_set_ready). A caller who wants a covariance ceiling from the first row gives r its matrix. A MIP projection is not unique. So the identity between the Causal Pass and the Recursion Read-out is a property of the code path, the same solves in the same order on the same rows, and it holds exactly only with a deterministic solver.
The set has no field for a budget, fees, the return term as an objective, the scalariser, the execution settings of the optimiser or a TimeDependent schedule. At construction assert_risk_ceiling refuses a frontier or a per-asset ub on a measure, because a ceiling is one number. The set does not read the rke or the scale of a measure. The ceiling is a constraint, and the objective is the divergence plus the penalties. The Euclidean, Gram and diagonal geometries admit a negative lower bound. The entropic, Tsallis and log-barrier geometries refuse it, at the head's construction when the bound is a value (assert_geometry_admits_set) and at the projection when an estimator resolves it. The wealth factor of a leveraged allocation can reach zero on an extreme day. At that point the log wealth and the next gradient are undefined, and the set does not guard against it.
Mathematical definition
\[\begin{align} \mathcal{W} &= \left\{ \boldsymbol{w} \in \mathbb{R}^N : \boldsymbol{1}^\intercal \boldsymbol{w} = 1,\; \boldsymbol{w} \in \mathcal{C}_k \text{ for every kind } k \text{ of the set} \right\}\,, \\ \boldsymbol{w}^{+} &= \underset{\boldsymbol{w} \in \mathcal{W}}{\arg\min} \; D_\Psi(\boldsymbol{w}, \boldsymbol{q}) + \pi(\boldsymbol{w})\,. \end{align}\]
Where:
- $\mathcal{W}$: Allocation Set.
- $\boldsymbol{w}$: Portfolio weights vector $N \times 1$.
- $N$: Number of assets.
- $\mathcal{C}_k$: Feasible set of the constraint kind $k$, which the builder of
JuMPOptimiserfor that kind writes. A risk ceiling, a tracking error, a centrality row, a phylogeny kind, an exposure row and a return floor take $\mathcal{C}_k$ from the prior of the step, and a turnover ceiling takes it from the Price-Adjusted Allocation. - $\boldsymbol{w}^{+}$: Projected allocation, the answer of the projection onto the Allocation Set.
- $D_\Psi$: Bregman divergence of $\Psi$.
- $\Psi$: Potential of the Projection Geometry.
- $\boldsymbol{q}$: Raw step, the vector the rule's unconstrained step gives before the projection onto the Allocation Set.
- $\pi$: Objective Penalty of the set, zero when the set has no penalty.
set_projection_objective! states the divergence of each geometry.
Fields
pe: The prior estimator that the set fits on the head's rows at every step. The risk ceilings, the tracking errors, the centrality and phylogeny rows, an exposure row and the return floor use its result. The set does not read it when no slot reads the rows.
slv: Solver or vector of solvers.
r: The risk ceilings, aRiskMeasureor a vector of them, each withsettings.ubthe ceiling, ornothing.
wb: Weight bounds estimator or weight bounds.
sbgt: Short-side budget,sum(sw). A number pins it, aBudgetRangebounds it; by default it bounds, sosbgt = 0.3means at most 30% short unlessxbgtpins the long/short decomposition. Together withbgtthis fixes the net and gross exposures only jointly; to constrain the gross exposure on its own seegbgt.
gbgt: Gross budget (leverage) constraint,sum(lw) + sum(sw). A number pins the gross exposure; aBudgetRangebounds it, e.g.BudgetRange(; lb = nothing, ub = 2.0)caps leverage at 2x. Unlikebgtandsbgt— which pin the net and gross exposures only together — this constrains the gross exposure on its own, leaving the net free. Requires weight bounds that admit short positions, and is bounded rather than pinned unlessxbgtis set.
xbgt: Whether to pin the long/short decomposition exactly. Whenfalse(the default),lwandsware upper bounds on the positive and negative parts ofw, sobgt,sbgtandgbgtbound the realised exposures rather than pinning them — a short budget of0.3means at most 30% short. Whentrue, the long/short binary indicators forcelw == max(w, 0)andsw == max(-w, 0), so the budgets hold exactly, at the cost of turning the problem into a mixed-integer program. It reuses the indicators the cardinality, threshold and fee builders already create (seeshort_mip_threshold_constraints) rather than adding its own, and is ignored when the weight bounds admit no shorts.
lt: Long-side minimum holding threshold.
st: Short-side minimum holding threshold.
lcse: Linear constraint set estimator(s). This is the one constraint slot that also admits anExposureConstraintEstimator, so a row may be written in the names of another basis — factor names, say — and re-based through the prior's loadings at generation time. What reaches the model is an ordinary asset-spaceLinearConstrainteither way.
cte: The centrality rows: aCentralityConstraint, a vector of them, or an already-generatedLinearConstraint, resolved on the head's rows at every step.
gcarde: Grouped cardinality constraint estimator.
sgcarde: Sub-grouped cardinality constraint estimator(s).
smtx: Sub-group selection matrix or estimator.
sgmtx: Sub-grouped selection matrix or estimator.
slt: Sub-group long threshold.
sst: Sub-group short threshold.
sglt: Sub-grouped long threshold.
sgst: Sub-grouped short threshold.
tn: The turnover ceilings: aTurnover, aTurnoverEstimatorthat resolves oversets, or a vector of them. At every step the set replaces the reference of each ceiling with the Price-Adjusted Allocation, unless the ceiling isfixed.
sets: Sets used to map estimator values to assets.
tr: The tracking errors, anyAbstractTrackingor a vector of them, over the head's rows: aWeightsTrackingthat is notfixedtracks the Price-Adjusted Allocation, and aReturnsTrackingseries stated over the fold is cut to the prefix the head has folded so far.
ple: Phylogeny constraint estimator(s).
ret: The return floor: a return term, or a vector of them, whosesettings.lbbounds the prior's expected return of the projected allocation from below; the term's objective role is not read.
ccnt: CustomJuMPconstraint.
cobj: CustomJuMPobjective.
sc: Constraint scale factor.
so: Objective scale factor.
ss: Optional scalar shrinkage parameter.
card: Global cardinality constraint.
scard: Sub-group cardinality constraint(s).
l2c: 2-norm ceiling on the weights. It boundsnorm(w, 2) <= l2c * k, wherekis the homogenisation variable, so the ceiling holds on the weights the result reports and the budget does not scale it. Smallerl2cforces a more evenly spread portfolio. Used as a diversification floor via the reciprocal:l2c = 1 / sqrt(m)requires at leastmeffective assets (inv(norm(w, 2)^2) >= m). Norm-constraint family withlpcandlinfc. The bound isNum_NormCeilCalunder the time-dependent wrapper, so the slot takes the ceiling itself, anAbstractNormCeilingCalibrationAlgorithmthat computes it from the prior result, or a plain function of the same five arguments.
lpc: p-norm ceiling(s) on the weights at an arbitrary norm order. EachLpRegularisationsupplies a norm orderpand a boundval, enforcingnorm(w, p) <= val * k. Smallervalforces a more evenly spread portfolio. Used as a diversification floor via the reciprocal:val = m^(1/p - 1)requires at leastmorder-peffective assets (sum(abs.(w) .^ p)^inv(1 - p) >= m), which isnumber_effective_assetstaken to an arbitrary order. Norm-constraint family withl2candlinfc.
linfc: ∞-norm ceiling on the weights — a cap on the largest absolute weight:norm(w, Inf) <= linfc * k. Solinfc = 0.2caps the largest weight at 20% of a fully invested portfolio. Used as a diversification floor via the reciprocal:linfc = 1 / mspreads the portfolio across at leastmassets. Norm-constraint family withl2candlpc. The bound isNum_NormCeilCalunder the time-dependent wrapper, so the slot takes the ceiling itself, anAbstractNormCeilingCalibrationAlgorithmthat computes it from the prior result, or a plain function of the same five arguments.
l1: L1 regularisation coefficient. It is the ambiguity radius of a type-$\infty$ Wasserstein ground metric, whose dual norm is the 1-norm, so the bound isNum_AmbRadCalunder the time-dependent wrapper and the slot takes anAbstractAmbiguityRadiusCalibrationAlgorithmthat computes it from the prior result, or a plain function of the same five arguments.
l2: L2 regularisation term(s).
lp: Lp regularisation specification(s).
linf: L∞ regularisation coefficient. It is the ambiguity radius of a type-1 Wasserstein ground metric, whose dual norm is the $\infty$-norm, so the bound isNum_AmbRadCalunder the time-dependent wrapper and the slot takes anAbstractAmbiguityRadiusCalibrationAlgorithmthat computes it from the prior result, or a plain function of the same five arguments.
Constructors
ProgrammeAllocationSet(; slv::Slv_VecSlv, pe::AbstractPriorEstimator = EmpiricalPrior(), r::Option{<:RM_VecRM} = nothing, wb::Option{<:WbE_Wb} = WeightBounds(), sbgt::Option{<:Num_BgtRg} = nothing, gbgt::Option{<:Num_BgtRg} = nothing, xbgt::Bool = false, lt::Option{<:BtE_Bt} = nothing, st::Option{<:BtE_Bt} = nothing, lcse::Option{<:EcE_LcE_Lc_VecEcE_LcE_Lc} = nothing, cte::Option{<:Lc_CC_VecCC} = nothing, gcarde::Option{<:LcE_Lc} = nothing, sgcarde::Option{<:LcE_Lc_VecLcE_Lc} = nothing, smtx::Option{<:MatNum_ASetMatE_VecMatNum_ASetMatE} = nothing, sgmtx::Option{<:MatNum_ASetMatE_VecMatNum_ASetMatE} = nothing, slt::Option{<:BtE_Bt_VecOptBtE_Bt} = nothing, sst::Option{<:BtE_Bt_VecOptBtE_Bt} = nothing, sglt::Option{<:BtE_Bt_VecOptBtE_Bt} = nothing, sgst::Option{<:BtE_Bt_VecOptBtE_Bt} = nothing, tn::Option{<:TnE_Tn_VecTnE_Tn} = nothing, sets::Option{<:UniverseSets} = nothing, tr::Option{<:Tr_VecTr} = nothing, ple::Option{<:PlCE_PlC_VecPlCE_PlC} = nothing, ret::Option{<:JRE_VecJRE} = nothing, ccnt::Option{<:JuMPConstr_VecJuMPConstr} = nothing, cobj::Option{<:JuMPObj_VecJuMPObj} = nothing, sc::Number = 1, so::Number = 1, ss::Option{<:Number} = nothing, card::Option{<:Integer} = nothing, scard::Option{<:Int_VecInt} = nothing, l2c::Option{<:Num_NormCeilCal} = nothing, lpc::Option{<:LpReg_VecLpReg} = nothing, linfc::Option{<:Num_NormCeilCal} = nothing, l1::Option{<:Num_AmbRadCal} = nothing, l2::Option{<:L2Reg_VecL2Reg} = nothing, lp::Option{<:LpReg_VecLpReg} = nothing, linf::Option{<:Num_AmbRadCal} = nothing) -> ProgrammeAllocationSetKeywords correspond to the struct's fields. slv has no default, because every projection onto the set is a programme.
Validation
- If
slvis a vector:!isempty(slv). AnIsEmptyErroris thrown otherwise. - If
sbgtorgbgtis a number: non-negative and finite. ADomainErroris thrown otherwise. - If
gbgtis given:sbgtis not a number, because the budget of one and a number insbgtalready fix the gross exposure. Ifwbis aWeightBounds, one of its bounds admits a short weight. AnArgumentErroris thrown otherwise. - If
ris given: thesettings.ubof every measure is a finite non-negative number, the ceiling (assert_risk_ceiling). AnArgumentErroris thrown otherwise, and anIsEmptyErrorfor an empty vector. - If
cte,tn,tr,l2,lp,lpcorretis a vector:!isempty(x). AnIsEmptyErroris thrown otherwise. - If
cardis given:card > 0and finite. Ifl2c,linfc,l1orlinfis a number:> 0and finite. ADomainErroris thrown otherwise. - An
LpRegularisationinlpholds no norm ceiling rule, and one inlpcholds no ambiguity radius rule. AnArgumentErroris thrown otherwise. - The sub-group and sub-grouped MIP slots agree in shape (
assert_subgroup_mip_fields,assert_subgrouped_mip_fields). - If a slot holds an estimator keyed by name (
name_keyed):!isnothing(sets). AnIsNothingErroris thrown otherwise.
View parameters
ProgrammeAllocationSet defines its own port_opt_view method rather than deriving one from field tags.
- The method passes the arguments after
ito the tracking errorstralone. It views the risk ceilingsrwithnothingin place of those arguments. - The prior estimator
pe, the per-asset slotswb,lt,st,lcse,smtx,sgmtx,slt,sst,sglt,sgst,tn,sets,ret,ccntandcobj, and the ceilings and tracking errors recurse throughport_opt_view, as the fields ofJuMPOptimiserdo. - The centrality rows
cte, the grouped cardinality slotsgcardeandsgcarde, and the phylogeny kindsplepass through unchanged, as they do on the optimiser. A precomputedLinearConstraintis the identity under a view. - When a sub-group slot and its sub-grouped slot hold one object, such as
smtxandsgmtx, the method views it once, and the two slots stay one object.
Examples
julia> ProgrammeAllocationSet(; slv = Solver(; solver = nothing), tn = Turnover(; w = fill(0.25, 4), val = 0.1))ProgrammeAllocationSet pe ┼ EmpiricalPrior │ ce ┼ PortfolioOptimisersCovariance │ │ ce ┼ Covariance │ │ │ me ┼ SimpleExpectedReturns │ │ │ │ w ┴ nothing │ │ │ ce ┼ GeneralCovariance │ │ │ │ ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true) │ │ │ │ w ┴ nothing │ │ │ alg ┼ FullMoment() │ │ │ w ┴ nothing │ │ mp ┼ MatrixProcessing │ │ │ pdm ┼ Posdef │ │ │ │ alg ┼ UnionAll: NearestCorrelationMatrix.Newton │ │ │ │ kwargs ┴ @NamedTuple{}: NamedTuple() │ │ │ dn ┼ nothing │ │ │ dt ┼ nothing │ │ │ alg ┼ nothing │ │ │ order ┴ NTuple{4, Symbol}: (:pdm, :dn, :dt, :alg) │ me ┼ SimpleExpectedReturns │ │ w ┴ nothing │ horizon ┼ nothing │ fill_limit ┴ nothing slv ┼ Solver │ name ┼ String: "" │ solver ┼ nothing │ settings ┼ nothing │ check_sol ┼ @NamedTuple{}: NamedTuple() │ add_bridges ┴ Bool: true r ┼ nothing wb ┼ WeightBounds │ lb ┼ Float64: 0.0 │ ub ┴ Float64: 1.0 sbgt ┼ nothing gbgt ┼ nothing xbgt ┼ Bool: false lt ┼ nothing st ┼ nothing lcse ┼ nothing cte ┼ nothing gcarde ┼ nothing sgcarde ┼ nothing smtx ┼ nothing sgmtx ┼ nothing slt ┼ nothing sst ┼ nothing sglt ┼ nothing sgst ┼ nothing tn ┼ Turnover │ w ┼ Vector{Float64}: [0.25, 0.25, 0.25, 0.25] │ val ┼ Float64: 0.1 │ fixed ┴ Bool: false sets ┼ nothing tr ┼ nothing ple ┼ nothing ret ┼ nothing ccnt ┼ nothing cobj ┼ nothing sc ┼ Int64: 1 so ┼ Int64: 1 ss ┼ nothing card ┼ nothing scard ┼ nothing l2c ┼ nothing lpc ┼ nothing linfc ┼ nothing l1 ┼ nothing l2 ┼ nothing lp ┼ nothing linf ┴ nothingRelated
AbstractAllocationSetBoundedAllocationSet: the set of weight bounds alone, with a scalar root for every geometry but the Gram one.JuMPOptimiserprojectprojection_programmeset_allocation_set_constraints!set_projection_objective!resolve_allocation_setresolve_allocation_set_rowsHeldStepOnlinePortfolioSelectionport_opt_view
PortfolioOptimisers.TsallisProjection — Type
struct TsallisProjection{T1<:Real} <: AbstractProjectionGeometryProjects the raw step onto the Allocation Set in the Bregman divergence of the Tsallis potential of power alpha.
This is the geometry of the Tsallis-entropy steps of Abernethy, Lee and Tewari (2015) and of the Tsallis-INF algorithm of Zimmert and Seldin (2021). The potential of the first paper is $\alpha \Psi_\alpha$ plus a constant, and the potential of the second is $\Psi_\alpha$ plus an affine term. So each divergence is $D_{\Psi_\alpha}$ times a constant factor, which a learning rate absorbs. Both papers bound the regret of the multi-armed bandit with bounded losses. At the tuned rate the expected regret is at most $\sqrt{2 T N / (\alpha (1 - \alpha))}$ (Abernethy, Lee and Tewari, 2015, Corollary 3.2). The log-wealth loss of a portfolio has no bounded gradient, so that bound does not apply to it as it stands. The geometry cannot set a positive entry to zero, and a zero entry stays zero. The geometry refuses a negative lower bound, because the potential is undefined below zero.
Mathematical definition
\[\begin{align} \Psi_\alpha(\boldsymbol{w}) &= \frac{1}{\alpha (\alpha - 1)} \sum_i w_i^{\alpha}\,, \\ \mathrm{Proj}^{\alpha}_{\mathcal{W}}(\boldsymbol{q}) &= \underset{\boldsymbol{w} \in \mathcal{W}}{\arg\min} \; D_{\Psi_\alpha}(\boldsymbol{w}, \boldsymbol{q})\,, \\ w_i(\theta) &= \min\left(\max\left(\left(q_i^{\alpha - 1} + \theta\right)^{1 / (\alpha - 1)},\, l_i\right),\, u_i\right)\,, \\ w_{t+1, i} &= \left( w_{t, i}^{\alpha - 1} + (1 - \alpha) \eta_t g_{t, i} + \theta \right)^{1 / (\alpha - 1)}\,. \end{align}\]
Where:
- $\Psi_\alpha$: Tsallis potential, the potential of this geometry.
- $\alpha$: Power of the potential, in $(0, 1)$.
- $D_\Psi$: Bregman divergence of $\Psi$.
- $\boldsymbol{q}$: Raw step, the vector the rule's unconstrained step gives before the projection onto the Allocation Set.
- $\mathcal{W}$: Allocation Set.
- $l_i$, $u_i$: Lower and upper bounds of asset $i$ on a
BoundedAllocationSet. - $\theta$: Budget multiplier, the root of $\sum_i w_i(\theta) = 1$.
- $\boldsymbol{w}_t$: Iterate of the rule at period $t$, the allocation its update reads.
- $\eta_t$: Learning rate of the update at period $t$.
- $\boldsymbol{g}_t$: Gradient of the loss of period $t$, taken at the iterate.
The mirror image is $\nabla \Psi_\alpha(\boldsymbol{w})_i = w_i^{\alpha - 1} / (\alpha - 1)$, so the projection sets $\nabla \Psi_\alpha(\boldsymbol{w}) - \nabla \Psi_\alpha(\boldsymbol{q})$ to one constant over the free entries. On a BoundedAllocationSet the projection is $\boldsymbol{w}(\theta)$ at the root. A base $q_i^{\alpha - 1} + \theta$ at or below zero puts its asset at $u_i$. The budget $\sum_i w_i(\theta)$ does not increase in $\theta$. The last line is a first-order step from $\boldsymbol{w}_t$ and its projection onto the simplex together, one scalar root. As $\alpha \to 1$, $D_{\Psi_\alpha}$ tends to the relative entropy of EntropicProjection. As $\alpha \to 0$, it tends to the Itakura–Saito divergence of LogBarrierProjection.
Fields
alpha: The power of the potential, in(0, 1).
Constructors
TsallisProjection(; alpha::Real = 0.5) -> TsallisProjectionKeywords correspond to the struct's fields. The default is the $\alpha = 1/2$ of Zimmert and Seldin (2021).
Validation
0 < alpha < 1. ADomainErroris thrown otherwise.
Examples
julia> TsallisProjection()TsallisProjection alpha ┴ Float64: 0.5Related
References
- [185] J. D. Abernethy, C. Lee and A. Tewari. Fighting bandits with a new kind of smoothness. In: Advances in Neural Information Processing Systems 28 (2015).
- [186] J. Zimmert and Y. Seldin. Tsallis-INF: An optimal algorithm for stochastic and adversarial bandits. Journal of Machine Learning Research 22(28), 1–49 (2021).
PortfolioOptimisers.LogBarrierProjection — Type
struct LogBarrierProjection <: AbstractProjectionGeometryProjects the raw step onto the Allocation Set in the Itakura–Saito divergence, the Bregman divergence of the Burg entropy.
Orseau, Lattimore and Legg (2017, §7) name the Burg entropy as the natural regulariser of mirror descent on the log loss, the alternative to their Soft-Bayes step. They state, without a proof in the paper, that its regret is $O(\sqrt{N T \log (T / N)})$ and does not depend on the largest gradient. For a portfolio, this means that the bound needs no lower bound on the price relatives. The geometry cannot set a positive entry to zero, and a zero entry stays zero. The geometry refuses a negative lower bound, because the logarithm is undefined below zero.
Mathematical definition
\[\begin{align} \Psi(\boldsymbol{w}) &= -\sum_i \log w_i\,, \\ D_\Psi(\boldsymbol{w}, \boldsymbol{q}) &= \sum_i \left( \frac{w_i}{q_i} - 1 - \log \frac{w_i}{q_i} \right)\,, \\ \mathrm{Proj}^{\mathrm{IS}}_{\mathcal{W}}(\boldsymbol{q}) &= \underset{\boldsymbol{w} \in \mathcal{W}}{\arg\min} \; D_\Psi(\boldsymbol{w}, \boldsymbol{q})\,, \\ w_i(\theta) &= \min\left(\max\left(\frac{1}{1 / q_i + \theta},\, l_i\right),\, u_i\right)\,, \\ w_{t+1, i} &= \frac{1}{1 / w_{t, i} + \eta_t g_{t, i} + \theta}\,. \end{align}\]
Where:
- $\Psi$: Burg entropy, the potential of this geometry.
- $D_\Psi$: Bregman divergence of $\Psi$.
- $\boldsymbol{q}$: Raw step, the vector the rule's unconstrained step gives before the projection onto the Allocation Set.
- $\mathcal{W}$: Allocation Set.
- $l_i$, $u_i$: Lower and upper bounds of asset $i$ on a
BoundedAllocationSet. - $\theta$: Budget multiplier, the root of $\sum_i w_i(\theta) = 1$.
- $\boldsymbol{w}_t$: Iterate of the rule at period $t$, the allocation its update reads.
- $\eta_t$: Learning rate of the update at period $t$.
- $\boldsymbol{g}_t$: Gradient of the loss of period $t$, taken at the iterate.
The mirror image is $\nabla \Psi(\boldsymbol{w})_i = -1 / w_i$, so the projection sets $\nabla \Psi(\boldsymbol{w}) - \nabla \Psi(\boldsymbol{q})$ to one constant over the free entries. On a BoundedAllocationSet the projection is $\boldsymbol{w}(\theta)$ at the root. A base $1 / q_i + \theta$ at or below zero puts its asset at $u_i$. The budget $\sum_i w_i(\theta)$ does not increase in $\theta$. The last line is a first-order step from $\boldsymbol{w}_t$ and its projection onto the simplex together, one scalar root. The Hessian of $\Psi$ is $\mathrm{diag}(1 / w_i^2)$, so the step moves a small weight in proportion to its square.
Examples
julia> LogBarrierProjection()LogBarrierProjection()Related
References
- [187] L. Orseau, T. Lattimore and S. Legg. Soft-Bayes: Prod for mixtures of experts with log-loss. In: Proceedings of the 28th International Conference on Algorithmic Learning Theory, PMLR 76, 372–399 (2017).
PortfolioOptimisers.mirror_step — Function
mirror_step(proj::EuclideanProjection, u::AbstractVector, s::AbstractVector)
mirror_step(proj::EntropicProjection, u::AbstractVector, s::AbstractVector)
mirror_step(proj::TsallisProjection, u::AbstractVector, s::AbstractVector)
mirror_step(proj::LogBarrierProjection, u::AbstractVector, s::AbstractVector)Takes the unconstrained mirror step from the iterate u along the scaled gradient s, in the potential of the geometry.
The answer is the raw step that project then puts onto the Allocation Set. A barrier geometry has a step only while every base is positive. A base at or below zero is a step to an unbounded allocation, and the function refuses it and does not clip it. Under the plain log-wealth gradient every rate below one has a step. A transformed gradient changes that condition. The first step of AdaptiveMomentGradient with gamma1 = 0.9 and gamma2 = 0.999 scales every entry of the gradient to about -3.16, so at the rate 0.9 the log-barrier step fails when one asset holds more than 0.352 of the iterate.
Mathematical definition
\[\begin{align} \boldsymbol{q} &= \nabla \Psi^{*}\left(\nabla \Psi(\boldsymbol{u}) - \boldsymbol{s}\right)\,, \\ q^{\mathrm{E}}_i &= u_i - s_i\,, \\ q^{\mathrm{KL}}_i &= u_i \exp(-s_i)\,, \\ q^{\alpha}_i &= \left( u_i^{\alpha - 1} + (1 - \alpha) s_i \right)^{1 / (\alpha - 1)}\,, \\ q^{\mathrm{IS}}_i &= \frac{1}{1 / u_i + s_i}\,. \end{align}\]
Where:
- $\boldsymbol{q}$: Raw step, the vector the rule's unconstrained step gives before the projection onto the Allocation Set.
- $\Psi$: Potential of the Projection Geometry.
- $\nabla \Psi^{*}$: Inverse of the mirror map $\nabla \Psi$.
- $\boldsymbol{u}$: The iterate the step starts from.
- $\boldsymbol{s}$: The scaled gradient, $\eta_t \boldsymbol{g}_t$ for a plain gradient.
- $q^{\mathrm{E}}$, $q^{\mathrm{KL}}$, $q^{\alpha}$, $q^{\mathrm{IS}}$: The raw step under
EuclideanProjection,EntropicProjection,TsallisProjectionandLogBarrierProjection. - $\alpha$: Power of the Tsallis potential, in $(0, 1)$.
- $\eta_t$: Learning rate of the update at period $t$.
- $\boldsymbol{g}_t$: Gradient of the loss of period $t$, taken at the iterate.
- $\boldsymbol{x}_t$: Price relative vector of period $t$, each asset's price over its price one period earlier.
Under the log-wealth loss with a plain gradient, $\boldsymbol{s} = -\eta_t \boldsymbol{x}_t / \langle \boldsymbol{u}, \boldsymbol{x}_t \rangle$. The log-barrier base $1 / u_i + s_i$ is then positive exactly while $\eta_t \hat{u}_i < 1$ for every asset, with $\hat{\boldsymbol{u}} = \boldsymbol{u} \odot \boldsymbol{x}_t / \langle \boldsymbol{u}, \boldsymbol{x}_t \rangle$ the Price-Adjusted Allocation of the iterate. Each $\hat{u}_i$ is at most one, so a rate below one always has a step. The Tsallis base is positive exactly while $(1 - \alpha) \eta_t \hat{u}_i u_i^{-\alpha} < 1$ for every asset.
Arguments
proj: The Projection Geometry.u: The iterate the step starts from.s: The scaled gradient.
Validation
- Under
TsallisProjectionandLogBarrierProjection: every base is positive. ADomainErroris thrown otherwise (assert_mirror_base).
Returns
q::AbstractVector: The raw step.
Related
PortfolioOptimisers.rows_needed — Method
rows_needed(set::ProgrammeAllocationSet)Returns the number of rows that a programme set reads at a step.
The set reads every row that the head has folded when one of its slots reads the rows. These slots are a risk ceiling that reads them (risk_reads_rows), a tracking error, a centrality or phylogeny estimator (fitted_on_rows), an exposure row (exposure_keyed), a return floor, and a Calibration Rule in a norm ceiling or in a penalty (calibrated).
Returns
::Union{Nothing, Int}:nothing, every row folded, when a slot reads the rows, and0otherwise.
Related
References
- [185]
- J. D. Abernethy, C. Lee and A. Tewari. Fighting bandits with a new kind of smoothness. In: Advances in Neural Information Processing Systems, Vol. 28 (2015).
- [186]
- J. Zimmert and Y. Seldin. Tsallis-INF: An optimal algorithm for stochastic and adversarial bandits. Journal of Machine Learning Research 22, 1–49 (2021).
- [187]
- L. Orseau, T. Lattimore and S. Legg. Soft-Bayes: Prod for mixtures of experts with log-loss. In: Proceedings of the 28th International Conference on Algorithmic Learning Theory, Vol. 76 of Proceedings of Machine Learning Research (2017); pp. 372–399.