Online selection rules: the third set
These rules solve an optimisation at each period. FollowTheLeader solves an optimisation estimator again on the past rows that a sample selector names, and moves the weights part of the way to the solution. The selectors are Prefix, which takes every row so far, LastRows, which takes the last W rows, and five pattern matchers, HistogramMatch, KernelMatch, NearestNeighbourMatch, CorrelationMatch and ClusterMatch. A pattern matcher takes the rows whose preceding window resembles the latest one. AllocationSetConstraint adds the set of allowed weights of OnlinePortfolioSelection to that optimisation. ShortTermLossControlPortfolio is a follow-the-leader rule over the rank-one covariance, and LowDimensionEnsemblePortfolio is one over the low-dimension ensemble prior. FollowTheLeadingHistory mixes copies of one rule started at different periods.
PortfolioOptimisers.AbstractSampleSelector — Type
abstract type AbstractSampleSelector <: AbstractAlgorithmNames the past periods on which a follow-the-leader rule re-solves its held estimator.
A FollowTheLeader rule holds a Sample Selector on sel. The solved rules of the online selection literature solve one programme and differ in the sample alone. Follow the leader takes every period so far, and the successive variable rebalanced portfolio takes the last W. The pattern-matching rules take the periods whose preceding window resembles the latest window, by histogram cell, kernel radius, nearest neighbours, correlation or cluster. A selector reads the price relatives that the head holds and returns row indices. It holds no rows of its own.
Interfaces
In order to implement a new selector, subtype AbstractSampleSelector with the paper's parameters as part of the struct, and implement:
select_rows(sel::AbstractSampleSelector, X::AbstractMatrix) -> AbstractVector{<:Integer}: The indices of the rows ofXin the sample, in time order. An empty vector is the empty sample.rows_needed(sel::AbstractSampleSelector) -> Union{Nothing, Integer}: The number of rows that the selector reads at a step, ornothingfor every row folded so far.
Arguments
sel: The selector.X: The price relatives1 .+ rof every row that the head holds,observations × assets, in time order. A gap reads as one, throughprice_relative. So a window that spans a listing compares as a window in which that asset sat in cash, which is the number that the step reads there.
Returns
idx::AbstractVector{<:Integer}: The row indices of the sample, in time order.
Related
PortfolioOptimisers.select_rows — Function
select_rows(sel::AbstractSampleSelector, X::AbstractMatrix)Returns the row indices of the sample that a Sample Selector names, from the price relatives that the head holds.
Arguments
sel: The selector.X: The price relatives,observations × assets, in time order.
Returns
idx::AbstractVector{<:Integer}: The row indices of the sample $C_t$, in time order, with $t$ the row count ofX.
Related
PortfolioOptimisers.Prefix — Type
struct Prefix <: AbstractSampleSelectorSelects every period so far, the sample of follow the leader.
Under the default log-optimal estimator the leader is the best constant rebalanced portfolio to date. This is the successive constant rebalanced portfolio (SCRP) of Gaivoronski and Stella (2000).
Mathematical definition
\[\begin{align} C_t &= \left\lbrace 1, \ldots, t \right\rbrace\,. \end{align}\]
Where:
- $C_t$: Sample of period $t$, the past periods whose price relatives the leader re-solves on.
- $t$: Period index, counted from one.
Examples
julia> Prefix()Prefix()Related
AbstractSampleSelectorFollowTheLeaderLastRows: the sample of the lastWperiods, which equals this sample while $t \leq W$.
References
PortfolioOptimisers.LastRows — Type
struct LastRows{T1<:Integer} <: AbstractSampleSelectorSelects the last W periods, the sample of the successive variable rebalanced portfolio.
Under the default log-optimal estimator the leader is the best constant rebalanced portfolio of a moving window. Gaivoronski and Stella (2000) call the rule the successive variable rebalanced portfolio, and Li and Hoi (2014) call it the variable rebalanced portfolio (VRP). Before W periods exist the sample is every period so far, as in the paper of Gaivoronski and Stella.
Mathematical definition
\[\begin{align} C_t &= \left\lbrace \max(1,\, t - W + 1), \ldots, t \right\rbrace\,. \end{align}\]
Where:
- $C_t$: Sample of period $t$, the past periods whose price relatives the leader re-solves on.
- $W$: Window of the sample, the
Wfield. - $t$: Period index, counted from one.
Fields
W: The number of rows of the window.
Constructors
LastRows(; W::Integer = 30) -> LastRowsKeywords correspond to the struct's fields.
Validation
W >= 1. ADomainErroris thrown otherwise.
Examples
julia> LastRows()LastRows W ┴ Int64: 30Related
AbstractSampleSelectorFollowTheLeaderPrefix: the sample of every period so far, which this sample equals while $t \leq W$.
References
PortfolioOptimisers.AbstractPatternMatchSelector — Type
abstract type AbstractPatternMatchSelector <: AbstractSampleSelectorSelects the periods whose preceding window resembles the latest window, the pattern-matching family.
The selector compares each candidate period through the window of the window periods before it. The latest window holds the last window periods, and it precedes the next period, which has no price relative yet. Before window + 1 periods exist no candidate exists, the sample is empty, and the rule plays the uniform portfolio. Every selector of the family reads every row folded so far.
Mathematical definition
\[\begin{align} C_t &= \left\lbrace w < i \leq t : m\left(\boldsymbol{x}_{i-w}^{i-1},\, \boldsymbol{x}_{t-w+1}^{t}\right) \right\rbrace\,. \end{align}\]
Where:
- $C_t$: Sample of period $t$, the past periods whose price relatives the leader re-solves on.
- $w$: Window length, the number of periods in each window that a pattern-matching selector compares.
- $\boldsymbol{x}_{a}^{b}$: Window of periods $a$ to $b$, the price relatives of those periods concatenated into one vector.
- $m$: Similarity test of the selector, true when a candidate window matches the latest window.
- $t$: Period index, counted from one.
Algorithm
The steps of select_rows on every selector of the family:
- Call
pattern_candidatesonsel.windowandX, giving the candidate rowsrows, their flattened windowscandsand the flattened latest windowlatest. When it returnsnothing, return the empty vector. - Call
matched_rowsonsel,X,candsandlatest, giving the matched positions. - Return
rowsat those positions.
Interfaces
In order to implement a new pattern-matching selector, subtype AbstractPatternMatchSelector with a window field and the paper's similarity parameters, and implement:
matched_rows(sel::AbstractPatternMatchSelector, X::AbstractMatrix, cands::AbstractVector, latest::AbstractVector) -> AbstractVector{<:Integer}: The positions incandsof the candidates that match.candsholds one flattened window for each candidate, andlatestis the latest window flattened the same way.
Related
PortfolioOptimisers.matched_rows — Function
matched_rows(sel::AbstractPatternMatchSelector, X::AbstractMatrix, cands::AbstractVector, latest::AbstractVector)Returns the positions of the candidates that a pattern-matching selector matches against the latest window.
Arguments
sel: The selector.X: The price relatives that the head holds, for a selector that reads more than the windows.cands: One flattened window for each candidate period, in time order.latest: The latest window, flattened the same way.
Returns
idx::AbstractVector{<:Integer}: The positions incandsof the matched candidates, increasing.
Related
PortfolioOptimisers.HistogramMatch — Type
struct HistogramMatch{T1<:Integer, T2<:(AbstractVector{<:Real})} <: AbstractPatternMatchSelectorSelects the periods whose preceding window falls in the same histogram cell as the latest window (BH).
This is the histogram rule of Györfi and Schäfer (2003). The paper quantises each price relative vector by a partition of the positive orthant, and a period matches when its window gives the same string of cell labels as the latest window. The paper leaves the partition to the user. Its consistency theorem asks for a nested sequence of partitions whose cells shrink, and the paper mixes the experts of that sequence by wealth. That mixture is an ExpertMixture over FollowTheLeader rules with one selector each.
Mathematical definition
\[\begin{align} C_t &= \left\lbrace w < i \leq t : G\left(\boldsymbol{x}_{i-w}^{i-1}\right) = G\left(\boldsymbol{x}_{t-w+1}^{t}\right) \right\rbrace\,, \\ G(\boldsymbol{v})_j &= \left\lvert \left\lbrace k : e_k \leq v_j \right\rbrace \right\rvert\,. \end{align}\]
Where:
- $C_t$: Sample of period $t$, the past periods whose price relatives the leader re-solves on.
- $w$: Window length, the number of periods in each window that a pattern-matching selector compares.
- $\boldsymbol{x}_{a}^{b}$: Window of periods $a$ to $b$, the price relatives of those periods concatenated into one vector.
- $G$: Cell map, which sends a flattened window to the bin index of each of its entries.
- $e_1 < \cdots < e_m$: Cell edges, the
edgesfield. - $v_j$: Entry $j$ of a flattened window $\boldsymbol{v}$.
- $t$: Period index, counted from one.
The bins of every entry form a partition of the positive orthant into products of intervals, which is one partition of the paper's kind. At the default edges = [1] the bin of an entry shows whether the asset rose or fell. So two windows match when every asset moved the same way in every period of the window. More edges give a finer partition and a smaller sample.
Fields
window: The number of rows of the windows compared.
edges: The cell boundaries of every entry's binning, increasing.
Constructors
HistogramMatch(; window::Integer = 5, edges::AbstractVector{<:Real} = [1]) -> HistogramMatchKeywords correspond to the struct's fields.
Validation
window >= 1. ADomainErroris thrown otherwise.!isempty(edges). AnIsEmptyErroris thrown otherwise.edgesis finite and strictly increasing. AnArgumentErroris thrown otherwise.
Examples
julia> HistogramMatch()HistogramMatch window ┼ Int64: 5 edges ┴ Vector{Int64}: [1]Related
AbstractPatternMatchSelectorFollowTheLeaderKernelMatch: the rule that matches by distance in place of a cell.ExpertMixture: the mixture by wealth over a grid of these selectors.
References
PortfolioOptimisers.KernelMatch — Type
struct KernelMatch{T1<:Integer, T2<:Real} <: AbstractPatternMatchSelectorSelects the periods whose preceding window lies within radius of the latest window (BK).
This is the kernel rule of Györfi, Lugosi and Udina (2006) under the uniform kernel, in the Euclidean norm of the flattened windows. The paper's experts run over a grid of windows $w$ and radii $c / \ell$, and the paper mixes them by wealth. That mixture is an ExpertMixture over FollowTheLeader rules with one selector each, and each selector holds one radius.
Three later rules use this selector under another objective, which the held estimator on the rule's opt states. The semi-log-optimal rule of Györfi, Urbán and Vajda (2007) maximises the second-order expansion of the log at one. The Markowitz-type rule of Ottucsák and Vajda (2007) maximises a mean-variance utility. The rule of Györfi and Vajda (2008) compares windows of one period and maximises the log return net of proportional costs.
Mathematical definition
\[\begin{align} C_t &= \left\lbrace w < i \leq t : \left\lVert \boldsymbol{x}_{i-w}^{i-1} - \boldsymbol{x}_{t-w+1}^{t} \right\rVert_2 \leq r \right\rbrace\,. \end{align}\]
Where:
- $C_t$: Sample of period $t$, the past periods whose price relatives the leader re-solves on.
- $w$: Window length, the number of periods in each window that a pattern-matching selector compares.
- $\boldsymbol{x}_{a}^{b}$: Window of periods $a$ to $b$, the price relatives of those periods concatenated into one vector.
- $r$: Radius of the uniform kernel, the
radiusfield. - $t$: Period index, counted from one.
Fields
window: The number of rows of the windows compared.
radius: The radius of the uniform kernel, in the Euclidean norm of the concatenated windows.
Constructors
KernelMatch(; window::Integer = 5, radius::Real) -> KernelMatchKeywords correspond to the struct's fields. The radius has no default, because the papers scan it. Its scale is the scale of a window of price relatives.
Validation
window >= 1. ADomainErroris thrown otherwise.radius > 0and finite. ADomainErroris thrown otherwise.
Examples
julia> KernelMatch(; radius = 0.1)KernelMatch window ┼ Int64: 5 radius ┴ Float64: 0.1Related
AbstractPatternMatchSelectorFollowTheLeaderNearestNeighbourMatch: the rule that keeps a count of the nearest windows in place of a radius.ExpertMixture: the mixture by wealth over a grid of these selectors.
References
- [202] L. Györfi, G. Lugosi and F. Udina. Nonparametric kernel-based sequential investment strategies. Mathematical Finance 16, 337–357 (2006).
- [203] L. Györfi, A. Urbán and I. Vajda. Kernel-based semi-log-optimal empirical portfolio selection strategies. International Journal of Theoretical and Applied Finance 10, 505–516 (2007).
- [204] G. Ottucsák and I. Vajda. An asymptotic analysis of the mean-variance portfolio selection. Statistics & Decisions 25, 63–88 (2007).
- [205] L. Györfi and I. Vajda. Growth optimal investment with transaction costs. In: Algorithmic Learning Theory, Lecture Notes in Computer Science 5254, 108–122 (Springer, 2008).
PortfolioOptimisers.NearestNeighbourMatch — Type
struct NearestNeighbourMatch{T1<:Integer, T2<:Real} <: AbstractPatternMatchSelectorSelects the periods whose preceding windows are the neighbours nearest to the latest window (BNN).
This is the nearest-neighbour rule of Györfi, Udina and Walk (2008), in the Euclidean norm of the flattened windows. The paper invests at period $n = t + 1$ with $\lfloor p\, n \rfloor$ neighbours, a count that grows with the history. So neighbours is an Integer count or a fraction in (0, 1). The fraction applies to the $t - w$ candidates and not to the period, so the count never exceeds the candidates. It is below the paper's count by at most $\lceil p (w + 1) \rceil$. A fraction that rounds down to zero gives the empty sample. The paper assumes that ties have zero probability. Here the earlier period wins a tie at the boundary.
Mathematical definition
\[\begin{align} C_t &= \left\lbrace w < i \leq t : \boldsymbol{x}_{i-w}^{i-1} \text{ is one of the } \ell \text{ windows nearest to } \boldsymbol{x}_{t-w+1}^{t} \right\rbrace\,, \\ \ell &= \begin{cases} \min(k,\, t - w) & \text{for a count } k\,, \\ \lfloor p\, (t - w) \rfloor & \text{for a fraction } p\,. \end{cases} \end{align}\]
Where:
- $C_t$: Sample of period $t$, the past periods whose price relatives the leader re-solves on.
- $w$: Window length, the number of periods in each window that a pattern-matching selector compares.
- $\boldsymbol{x}_{a}^{b}$: Window of periods $a$ to $b$, the price relatives of those periods concatenated into one vector.
- $\ell$: Neighbour count at period $t$.
- $k$: Count, the
neighboursfield when it is anInteger. - $p$: Fraction, the
neighboursfield when it is a real in(0, 1). - $t$: Period index, counted from one.
The distance between two windows is the Euclidean norm of their difference.
Fields
window: The number of rows of the windows compared.
neighbours: The number of neighbours to keep, anIntegercount or a fraction in(0, 1)of the candidate rows.
Constructors
NearestNeighbourMatch(; window::Integer = 5, neighbours::Real = 0.1) -> NearestNeighbourMatchKeywords correspond to the struct's fields.
Validation
window >= 1. ADomainErroris thrown otherwise.neighbours >= 1for anInteger, and0 < neighbours < 1for another real. ADomainErroris thrown otherwise.
Examples
julia> NearestNeighbourMatch()NearestNeighbourMatch window ┼ Int64: 5 neighbours ┴ Float64: 0.1Related
AbstractPatternMatchSelectorFollowTheLeaderKernelMatch: the rule that keeps every window within a radius in place of a count.
References
- [206] L. Györfi, F. Udina and H. Walk. Nonparametric nearest neighbor based empirical portfolio selection strategies. Statistics & Decisions 26, 145–157 (2008).
PortfolioOptimisers.CorrelationMatch — Type
struct CorrelationMatch{T1<:Integer, T2<:Real} <: AbstractPatternMatchSelectorSelects the periods whose preceding window correlates with the latest window at rho or more (CORN).
This is the correlation-driven rule of Li, Hoi and Gopalkrishnan (2011). The correlation is the Pearson correlation of the two flattened windows.
The paper's CORN-U mixes the experts of the windows 1 to $W$ at one threshold, from a uniform start and by wealth. Its CORN-K runs over the windows 1 to $W$ and the thresholds $0, 1/P, \ldots, (P - 1)/P$, and it keeps the $K$ wealthiest experts, weighted by wealth. Both are an ExpertMixture over FollowTheLeader rules with one selector each, CORN-K under the TopK weighting. The paper sets $W = 5$, $P = 10$ and $K = 5$, and it runs CORN-U at the threshold 0.1 with no tuning. The defaults of one selector take the window 5 and the threshold 0.1 from these values.
Wang, Wang, Wang and Zhang (2018) add a risk penalty to each expert (RACORN-K). Their programme maximises the mean log return over the sample less $\lambda$ times the standard deviation of the log return $\log \langle \boldsymbol{w}, \boldsymbol{x}_i \rangle$. Their experts run over windows, thresholds and values of $\lambda$, and the wealthiest tenth of them combine as in CORN-K. The nearest programme of the library is MeanRisk under MaximumUtility at l = λ over StandardDeviation, with LogarithmicReturn. It penalises the standard deviation of the return $\langle \boldsymbol{w}, \boldsymbol{x}_i \rangle - 1$ in place of the log return, and the two penalties agree to the first order in the return.
Mathematical definition
\[\begin{align} C_t &= \left\lbrace w < i \leq t : \rho\left(\boldsymbol{x}_{i-w}^{i-1},\, \boldsymbol{x}_{t-w+1}^{t}\right) \geq \bar{\rho} \right\rbrace\,, \\ \rho(\boldsymbol{u}, \boldsymbol{v}) &= \begin{cases} \dfrac{\operatorname{cov}(\boldsymbol{u}, \boldsymbol{v})}{\sigma(\boldsymbol{u})\, \sigma(\boldsymbol{v})} & \text{if } \sigma(\boldsymbol{u})\, \sigma(\boldsymbol{v}) > 0\,, \\ 0 & \text{otherwise}\,. \end{cases} \end{align}\]
Where:
- $C_t$: Sample of period $t$, the past periods whose price relatives the leader re-solves on.
- $w$: Window length, the number of periods in each window that a pattern-matching selector compares.
- $\boldsymbol{x}_{a}^{b}$: Window of periods $a$ to $b$, the price relatives of those periods concatenated into one vector.
- $\rho(\boldsymbol{u}, \boldsymbol{v})$: Correlation of two flattened windows, taken over their entries.
- $\operatorname{cov}$, $\sigma$: Covariance and standard deviation over the entries of a flattened window.
- $\bar{\rho}$: Threshold, the
rhofield. - $t$: Period index, counted from one.
A window with no variation correlates at zero, as the paper sets it. So it matches at a threshold of zero or less, and at no positive threshold.
Fields
window: The number of rows of the windows compared.
rho: The correlation threshold a candidate window must reach.
Constructors
CorrelationMatch(; window::Integer = 5, rho::Real = 0.1) -> CorrelationMatchKeywords correspond to the struct's fields.
Validation
window >= 1. ADomainErroris thrown otherwise.-1 <= rho <= 1. ADomainErroris thrown otherwise.
Examples
julia> CorrelationMatch()CorrelationMatch window ┼ Int64: 5 rho ┴ Float64: 0.1Related
AbstractPatternMatchSelectorFollowTheLeaderExpertMixture: CORN-U and CORN-K combine rules over this selector.TopK: the weighting of CORN-K and RACORN-K.
References
- [194] B. Li, S. C. H. Hoi and V. Gopalkrishnan. CORN: Correlation-driven nonparametric learning approach for portfolio selection. ACM Transactions on Intelligent Systems and Technology 2(3), 21:1–21:29 (2011). Equation 6, Algorithms 1 to 3 and Section 5.2.
- [207] Y. Wang, D. Wang, Y. Wang and Y. Zhang. RACORN-K: Risk-aversion pattern matching-based portfolio selection. arXiv:1802.10244 (2018). Equation 3.
PortfolioOptimisers.ClusterMatch — Type
struct ClusterMatch{T1<:Integer, T2<:AbstractClustersEstimator} <: AbstractPatternMatchSelectorSelects the periods whose preceding window falls in the same cluster as the latest window (KMNLOG).
This follows the cluster-based rule of Khedmati and Azin (2020). The paper clusters the windows by k-means (KMNLOG), k-medoids (KMDLOG), spectral clustering (SPCLOG) and hierarchical clustering (HRCLOG). The clusterer field takes one of the library's clustering estimators, which partitions the windows through a distance that it forms from them. KMeansAlgorithm and HClustAlgorithm are among its algorithms. The paper puts a transaction cost into its programme, and the fees slot of the rule's opt holds that cost. Fewer than two candidates cannot be partitioned, so they give the empty sample.
Mathematical definition
\[\begin{align} C_t &= \left\lbrace w < i \leq t : \kappa\left(\boldsymbol{x}_{i-w}^{i-1}\right) = \kappa\left(\boldsymbol{x}_{t-w+1}^{t}\right) \right\rbrace\,. \end{align}\]
Where:
- $C_t$: Sample of period $t$, the past periods whose price relatives the leader re-solves on.
- $w$: Window length, the number of periods in each window that a pattern-matching selector compares.
- $\boldsymbol{x}_{a}^{b}$: Window of periods $a$ to $b$, the price relatives of those periods concatenated into one vector.
- $\kappa$: Cluster label of a window, from one clustering of the $t - w$ candidate windows and the latest window together.
- $t$: Period index, counted from one.
Algorithm
The steps of matched_rows on this selector:
- When
candsholds fewer than two windows, return the empty vector. - Lay the candidate windows and
latestout as the columns ofM, withlatestin the last column. - Cluster the columns of
Mwithclusteriseonsel.clusterer, givinglabels. - Return the positions of the candidates whose label is the label of
latest.
Fields
window: The number of rows of the windows compared.
clusterer: The clustering estimator that partitions the windows.
Constructors
ClusterMatch(; window::Integer = 5, clusterer::AbstractClustersEstimator = ClustersEstimator(; alg = KMeansAlgorithm())) -> ClusterMatchKeywords correspond to the struct's fields.
Validation
window >= 1. ADomainErroris thrown otherwise.
Examples
julia> ClusterMatch(; clusterer = ClustersEstimator()).window5Related
AbstractPatternMatchSelectorFollowTheLeaderClustersEstimator: the default clusterer.KMeansAlgorithm: the default algorithm of the clusterer, the paper's KMNLOG.HClustAlgorithm: the paper's HRCLOG.
References
- [208] M. Khedmati and P. Azin. An online portfolio selection algorithm using clustering approaches and considering transaction costs. Expert Systems with Applications 159, 113546 (2020).
PortfolioOptimisers.AllocationSetConstraint — Type
struct AllocationSetConstraint{T1<:AbstractAllocationSet, T2<:(AbstractVector), T3<:(Union{Nothing, var"#s7444"} where var"#s7444"<:ReturnsResult)} <: CustomJuMPConstraintAdds the head's Allocation Set to the programme of a follow-the-leader re-solve, the Allocation Set Constraint.
The type is a CustomJuMPConstraint that holds the resolved set, the Price-Adjusted Allocation of the step and the head's rows. A FollowTheLeader rule appends it to the ccnt of its held optimiser for one solve. add_custom_constraint! on it calls add_allocation_set_constraints!, which runs the set's own builders on the leader's model. So the feasible region of the programme is the set intersected with the region of the held optimiser. The turnover ceiling measures from the Price-Adjusted Allocation. The variance ceiling and the tracking error read the set's own pe on the head's rows, as they do in a projection. A constraint can live on the set or on the held optimiser, and a caller who wants one home leaves the other bare.
Fields
set: The Allocation Set, resolved over the pinned universe.
w: The Price-Adjusted Allocation the step trades from.
X: The rows carrier the head holds through the period, aReturnsResult, ornothing.
View parameters
When port_opt_view is called on this type, its fields are subset to the selected assets. set takes its own view, against the unreduced returns matrix of the carrier when one exists, because the view of a tracking estimator asks for it. The view slices w, and X takes the view of the carrier. The reduction of the held estimator to its Investable Mask views its ccnt with the rest of the optimiser. So the set stays in the reduced programme. A custom constraint with no view drops out of it.
Related
FollowTheLeaderadd_allocation_set_constraints!: the builders that this constraint calls.CustomJuMPConstraintAbstractAllocationSetinvestable_reduction: the reduction that views this constraint with the held optimiser.
PortfolioOptimisers.FollowTheLeader — Type
struct FollowTheLeader{T1<:AbstractSampleSelector, T2<:(Union{var"#s7444", var"#s7443"} where {var"#s7444"<:BestConstantRebalancedPortfolio, var"#s7443"<:JuMPOptimisationEstimator}), T3<:Real, T4<:EuclideanProjection} <: AbstractOnlinePortfolioSelectionAlgorithmRe-solves an optimisation estimator on a sample of past periods at every step, the follow-the-leader rule.
The Sample Selector on sel names the sample, and the estimator on opt solves on it. The solution is the leader. The rule plays the leader, or at gamma > 0 the leader damped towards the allocation that it held.
Every solved rule of the online selection literature is this rule under one selector and one objective. Prefix under the log-optimal objective is follow the leader, the successive constant rebalanced portfolio of Gaivoronski and Stella (2000). At gamma > 0 it is their weighted rule (WSCRP). LastRows gives their successive variable rebalanced portfolio. The pattern-matching selectors give the histogram, kernel, nearest-neighbour, correlation and cluster rules. The papers of those rules mix a grid of selectors by wealth, which is an ExpertMixture over rules of this kind.
The objective is the held estimator's. BestConstantRebalancedPortfolio, the default, is the log-optimal portfolio with no solver. MeanRisk under LogarithmicReturn and MaximumReturn solves the same programme on a solver. Under Prefix and on the simplex, that estimator with l2 = L2Regularisation(; val = 1 / (2t), alg = QuadRiskExpr()) on its JuMPOptimiser and $t$ rows is the Exp-Concave-FTL of Hazan and Kale (2015). The paper subtracts $\tfrac{1}{2} \lVert \boldsymbol{w} \rVert^2$ from the sum of the log returns, and LogarithmicReturn states their mean, so the weight is $1 / (2t)$. One fixed val is that leader at one sample size alone. MaximumUtility over a risk measure gives a mean-risk leader, and fees on the estimator gives a cost-aware leader.
The solver-free default runs Cover's fixed point, which stops on a certificate, a bound on the shortfall of its log wealth from the leader's. At a leader that drops an asset, the weight of that asset decays slowly. So the default budget can stop before the certificate meets tol, and the rule then warns once and names the certificate. On the first 30 rows of the returns 0.02 .* randn(StableRNG(11), 40, 4) the default stops 0.066 from the leader in weight and 6.2e-5 short of it in log wealth. At iters = 10_000_000 the certificate meets tol = 1e-12 after 1 437 030 steps, 1.6e-9 from the leader in weight. A JuMP head solves the leader to the solver's tolerance, and the two forms agree to that tolerance at a leader inside the simplex.
The re-solve takes the head's Allocation Set as its feasible region. The rule wraps the set, the Price-Adjusted Allocation and the head's rows into an AllocationSetConstraint, and appends it to the ccnt of the held JuMP estimator for the solve. It passes the Price-Adjusted Allocation through factory as a fold loop does, so a turnover term or a fee on opt reads the same book. It plays the optimum with no projection, because the projected leader is not the leader. The solver-free estimator has no model. So a BoundedAllocationSet goes into its wb and sets, and the rule plays its repaired fixed point. The head refuses a ProgrammeAllocationSet over the solver-free estimator at construction. Under a programme set the constrained leader is MeanRisk under LogarithmicReturn.
The rule projects the damped mix alone. It uses the Euclidean geometry on proj, with the Price-Adjusted Allocation as the reference. On a static convex set the projection returns the mix unchanged. A turnover ceiling or a MIP kind needs the repair on a day when the mix leaves the set. The rule skips the projection by type on a BoundedAllocationSet, and at gamma = 0. An empty sample, or a sample too small for the estimator, gives the uniform portfolio projected onto the set, as the papers do. A JuMP head fits a covariance, so it needs two rows. A re-solve that fails after the fallback chain of the held estimator is a Held Step. The rule then plays the Price-Adjusted Allocation, so the fund trades nothing that period.
Under a time-varying panel the re-solve is the batch path. The estimator reads the head's rows carrier viewed at the sample, with the returns as they are, NaN where no return exists, and the active mask. So the estimator reduces to its own universe, as it does on any carrier, and writes a zero at every asset outside it. That universe is the Coverage Universe of the sample for the solver-free leader and for a head with no prior, and the Investable Mask of its prior for a JuMP head. An asset that is not listed for a part of the sample stays outside the universe of a plain estimator until the sample clears that span. A Prefix sample never clears it, and a LastRows sample clears it when its window has passed the listing. A prior that reads the mask admits the asset after its own warm-up. The selector reads a gap as a price relative of one, as if the asset sat in cash, so it compares a window that spans a listing and does not drop it. The damped mix and the projection read a zero from the leader at such an asset as they read any other zero.
Mathematical definition
\[\begin{align} \boldsymbol{w}^\star_t &= \underset{\boldsymbol{w} \in \mathcal{W}}{\arg\max}\; \sum_{i \in C_t} \log \langle \boldsymbol{w}, \boldsymbol{x}_i \rangle\,, \\ \boldsymbol{w}_{t+1} &= \mathrm{Proj}_{\mathcal{W}}\left( (1 - \gamma)\, \boldsymbol{w}^\star_t + \gamma\, \boldsymbol{w}_t \right)\,. \end{align}\]
Where:
- $\boldsymbol{w}^\star_t$: Leader of period $t$, the allocation that the held optimisation estimator solves for on the sample $C_t$. The first line is the leader under the default log-optimal estimator. Another estimator on
optreplaces the objective. - $\boldsymbol{w}$: Decision allocation of the leader's programme.
- $\mathcal{W}$: Allocation Set.
- $C_t$: Sample of period $t$, the past periods whose price relatives the leader re-solves on.
- $\boldsymbol{x}_t$: Price relative vector of period $t$, each asset's price over its price one period earlier.
- $\boldsymbol{w}_t$: Iterate of the rule at period $t$, the allocation its update reads.
- $\gamma$: Damping towards the held allocation, in $[0, 1]$, the
gammafield. - $\mathrm{Proj}_{\mathcal{W}}$: Euclidean projection onto the Allocation Set $\mathcal{W}$.
- $t$: Period index, counted from one.
At $\gamma = 0$ the rule plays the leader. The leader lies in $\mathcal{W}$, so the mix leaves $\mathcal{W}$ only when $\boldsymbol{w}_t$ is outside it, as under a turnover ceiling, or when $\mathcal{W}$ is not convex, as under a cardinality bound. Under the log-optimal estimator and Prefix, the leader on $\mathcal{W} = \Delta_N$ is the best constant rebalanced portfolio of the first $t$ periods. The Exp-Concave-FTL of Hazan and Kale is
\[\begin{align} \boldsymbol{w}^\star_t &= \underset{\boldsymbol{w} \in \Delta_N}{\arg\max}\; \sum_{i=1}^{t} \log \langle \boldsymbol{w}, \boldsymbol{x}_i \rangle - \frac{1}{2} \lVert \boldsymbol{w} \rVert_2^2\,. \end{align}\]
Where:
- $\Delta_N$: Probability simplex over the $N$ assets.
- $N$: Number of assets.
Algorithm
The steps of the Online Update:
- Compute
wh, the Price-Adjusted Allocation ofwoverx. - Select
idx, the rows of the sample, withselect_rowsonalg.seland the price relatives ofrows. - When
idxholds fewer rows thanleader_min_rows(alg.opt), setwstarto the uniform portfolio projected ontosetwithalg.proj, fromwh. Otherwise setwstarto the result ofleader_allocationonalg.opt, the view ofrowsatidx,wh,setandrows. - When
wstarisnothing, the step is a Held Step. Return the carrierstand a copy ofwh. - When
alg.gammais zero, returnstandwstar. - Set
mixto(1 - alg.gamma) .* wstar .+ alg.gamma .* w. Returnstand the result ofblend_projectionofmixontosetwithalg.proj, fromwh.
Fields
sel: The Sample Selector that names the rows the estimator re-solves on.
opt: The optimisation estimator re-solved on the selected rows.
gamma: The damping towards the held allocation, in[0, 1]. At0the rule plays the leader.
proj: The Projection Geometry the rule projects its raw step onto the Allocation Set in; the slot's type bound names the geometries the rule's theorem covers.
Constructors
FollowTheLeader(; sel::AbstractSampleSelector = Prefix(), opt::LeaderOptimiser = BestConstantRebalancedPortfolio(), gamma::Real = 0, proj::EuclideanProjection = EuclideanProjection()) -> FollowTheLeaderKeywords correspond to the struct's fields.
Validation
0 <= gamma <= 1. ADomainErroris thrown otherwise.
View parameters
When port_opt_view is called on this type, opt is viewed to the selected indices and sel, gamma and proj are carried unchanged.
Examples
julia> FollowTheLeader()FollowTheLeader sel ┼ Prefix() opt ┼ BestConstantRebalancedPortfolio │ wb ┼ WeightBounds │ │ lb ┼ Float64: 0.0 │ │ ub ┴ Float64: 1.0 │ fees ┼ nothing │ sets ┼ nothing │ wf ┼ IterativeWeightFinaliser │ │ iter ┴ Int64: 100 │ fb ┼ nothing │ iters ┼ Int64: 20000 │ tol ┼ Float64: 1.0e-12 │ strict ┴ Bool: false gamma ┼ Int64: 0 proj ┴ EuclideanProjection()Related
AbstractOnlinePortfolioSelectionAlgorithmOnlinePortfolioSelectionAbstractSampleSelectorAllocationSetConstraint: the adapter that adds the head's set to the programme.BestConstantRebalancedPortfolio: the default estimator.ExpertMixture: the mixture by wealth over a grid of these rules.FollowTheLeadingHistoryShortTermLossControlPortfolio: this rule overLastRowsunder a loss-control programme.LowDimensionEnsemblePortfolio: this rule overLastRowsunder an ensemble forecast.
References
- [200] A. A. Gaivoronski and F. Stella. Stochastic nonstationary optimization for finding universal portfolios. Annals of Operations Research 100, 165–188 (2000).
- [209] E. Hazan and S. Kale. An online portfolio selection algorithm with regret logarithmic in price variation. Mathematical Finance 25, 288–310 (2015). Section 2.2, Equation 1.
- [151] B. Li and S. C. H. Hoi. Online portfolio selection: A survey. ACM Computing Surveys 46(3), 1–36 (2014). Sections 3.2.3 and 3.4.
PortfolioOptimisers.ShortTermLossControlPortfolio — Function
ShortTermLossControlPortfolio(; window::Integer = 5, gamma::Real = 0.025, slv::Slv_VecSlv, pe::AbstractPriorEstimator = EmpiricalPrior(; ce = RankOneCovariance()), proj::EuclideanProjection = EuclideanProjection())Builds the short-term portfolio optimisation with loss control of Lai, Tan, Wu and Fang (2020) (SPOLC).
The rule is a FollowTheLeader over the last window periods. Its programme maximises the worst increasing factor of the window less gamma times the portfolio variance under the RankOneCovariance. MeanRisk states it as the minimum of WorstRealisation plus Variance scaled by gamma. The variance reads the rank-one matrix as a quadratic form under QuadRiskExpr, which needs no factor of the singular matrix. The head's Allocation Set enters the programme as in every follow-the-leader programme. The paper does not state the rule before the window fills. Here the rule re-solves on the periods that it has, and on one period it plays the uniform portfolio, because the programme reads a covariance.
Mathematical definition
\[\begin{align} \boldsymbol{w}^\star_t &= \underset{\boldsymbol{w} \in \Delta_N}{\arg\max}\; \min_{i \in C_t} \langle \boldsymbol{w}, \boldsymbol{x}_i \rangle - \gamma\, \boldsymbol{w}^\intercal \hat{\mathbf{\Sigma}}_{\mathrm{RO}} \boldsymbol{w}\,, \\ C_t &= \left\lbrace \max(1,\, t - w + 1), \ldots, t \right\rbrace\,. \end{align}\]
Where:
- $\boldsymbol{w}^\star_t$: Leader of period $t$, the allocation that the held optimisation estimator solves for on the sample $C_t$.
- $\boldsymbol{w}$: Decision allocation of the leader's programme.
- $\Delta_N$: Probability simplex over the $N$ assets.
- $C_t$: Sample of period $t$, the past periods whose price relatives the leader re-solves on.
- $\boldsymbol{x}_t$: Price relative vector of period $t$, each asset's price over its price one period earlier.
- $\gamma$: Weight of the variance against the worst increasing factor, the paper's $\gamma$.
- $\hat{\mathbf{\Sigma}}_{\mathrm{RO}}$: Rank-one covariance estimate of a window, the matrix that
RankOneCovariancecomputes. - $w$: Window of the rule, the paper's $w$.
- $N$: Number of assets.
- $t$: Period index, counted from one.
This is the paper's equation 51 at period $t$. On the simplex $\langle \boldsymbol{w}, \boldsymbol{x}_i \rangle - 1$ is the portfolio return of period $i$. So the worst increasing factor less one is the negative of the worst realisation over the sample, and the two programmes have one maximiser.
Arguments
window: The paper's $w$, the number of periods of the window.gamma: The paper's $\gamma$, the weight of the variance against the worst increasing factor.slv: The solver of the programme.pe: The prior estimator of the programme, whose covariance is the rank-one estimate.proj: The geometry of the damped mix. The rule'sgamma = 0does not read it.
Validation
window >= 1. ADomainErroris thrown otherwise.gamma >= 0. ADomainErroris thrown otherwise.
Returns
alg::FollowTheLeader: The rule overLastRowsatW = window, whoseoptis the loss-control programme.
Examples
julia> alg = ShortTermLossControlPortfolio(; slv = Solver(; solver = nothing));julia> alg.selLastRows W ┴ Int64: 5julia> alg.opt.r[2].settings.scale0.025Related
FollowTheLeaderLastRowsRankOneCovariance: the paper's rank-one estimate.WorstRealisationVarianceMeanRisk
References
- [64] Z.-R. Lai, L. Tan, X. Wu and L. Fang. Loss control with rank-one covariance estimate for short-term portfolio optimization. Journal of Machine Learning Research 21, 1–37 (2020). Equation 51 and Section 4.2.1.
PortfolioOptimisers.LowDimensionEnsemblePortfolio — Function
LowDimensionEnsemblePortfolio(; N::Integer, window::Integer = 5, gamma::Real = 0.25, xi::Real = 0.002, slv::Slv_VecSlv, pe::AbstractPriorEstimator = LowDimensionEnsemblePrior(), proj::EuclideanProjection = EuclideanProjection())Builds the online low-dimension ensemble method of Xi, Li, Song and Ning (2023) (OLDEM).
The rule is a FollowTheLeader over the last window regression pairs. Its programme maximises the forecast return of the ensemble, less gamma times the portfolio variance under the predictive covariance of the ensemble, less a linear turnover fee at the rate xi. MeanRisk states it as MaximumUtility at the risk aversion gamma over Variance under QuadRiskExpr. The ensemble prior on pe gives the forecast and the covariance from one fit. A Fees whose Turnover rate is xi gives the $\ell_1$ term, and the head passes the reference allocation through factory, as it does for every fee. The head's Allocation Set enters the programme as in every follow-the-leader programme.
The paper relaxes $\boldsymbol{w} \geq \boldsymbol{0}$, runs a coordinate-wise descent on the change of the allocation, and projects the result onto the simplex. The programme here keeps $\boldsymbol{w} \geq \boldsymbol{0}$ inside the solve. So it returns the minimiser of the paper's programme, which the relaxed and projected result is not in general. window regression pairs need window + 1 rows, so the selector holds one row more than the paper's $w$. Before the window fills the rule re-solves on the rows that it has. Below three rows the covariance of the regressors does not exist, and the rule plays the uniform portfolio.
The turnover fee holds a reference allocation of the universe's length from construction, and the head replaces it at every update. So the constructor takes the number of assets N, as UniversalPortfolio does.
Mathematical definition
\[\begin{align} \boldsymbol{w}^\star_t &= \underset{\boldsymbol{w} \in \Delta_N}{\arg\min}\; -\hat{\boldsymbol{x}}_{t+1}^\intercal \boldsymbol{w} + \gamma\, \boldsymbol{w}^\intercal \hat{\mathbf{\Sigma}}_{t+1} \boldsymbol{w} + \xi\, \lVert \boldsymbol{w} - \hat{\boldsymbol{w}}_t \rVert_1\,. \end{align}\]
Where:
- $\boldsymbol{w}^\star_t$: Leader of period $t$, the allocation that the held optimisation estimator solves for on the sample $C_t$.
- $\boldsymbol{w}$: Decision allocation of the leader's programme.
- $\Delta_N$: Probability simplex over the $N$ assets.
- $\hat{\boldsymbol{x}}_{t+1}$: Price Relative Forecast for period $t + 1$, made after the row of period $t$.
- $\gamma$: Risk aversion over the predictive variance, the paper's $\gamma$.
- $\hat{\mathbf{\Sigma}}_{t+1}$: Predictive covariance of the price relatives of period $t + 1$, made after the row of period $t$.
- $\xi$: Rate of the linear turnover fee, the paper's $\xi$.
- $\hat{\boldsymbol{w}}_t = \boldsymbol{w}_t \odot \boldsymbol{x}_t / \langle \boldsymbol{w}_t, \boldsymbol{x}_t \rangle$: Price-Adjusted Allocation, the wealth held in each asset at the end of period $t$.
- $N$: Number of assets.
- $t$: Period index, counted from one.
This is the paper's equation 14, with one change. The paper measures the turnover from its own last allocation $\hat{\boldsymbol{b}}_t$, and the programme here measures it from the Price-Adjusted Allocation $\hat{\boldsymbol{w}}_t$, the book that the fund holds when it trades. On the simplex $\hat{\boldsymbol{x}}^\intercal \boldsymbol{w}$ and $(\hat{\boldsymbol{x}} - \boldsymbol{1})^\intercal \boldsymbol{w}$ differ by one, so the programme over the forecast return has the same minimiser.
Arguments
N: The number of assets, the length of the reference allocation of the fee.window: The paper's $w$, the number of regression pairs of the window. The selector holdswindow + 1rows.gamma: The paper's $\gamma$, the risk aversion over the predictive variance.xi: The paper's $\xi$, the rate of the linear turnover fee.slv: The solver of the programme.pe: The prior estimator of the programme, the ensemble by default. Any prior gives the two moments that the programme reads.proj: The geometry of the damped mix. The rule'sgamma = 0does not read it.
Validation
N >= 1. ADomainErroris thrown otherwise.window >= 2, the fewest pairs whose regressor covariance exists. ADomainErroris thrown otherwise.gamma >= 0. ADomainErroris thrown otherwise.xi >= 0. ADomainErroris thrown otherwise.
Returns
alg::FollowTheLeader: The rule overLastRowsatW = window + 1, whoseoptis the ensemble programme.
Examples
julia> alg = LowDimensionEnsemblePortfolio(; N = 3, slv = Solver(; solver = nothing));julia> alg.selLastRows W ┴ Int64: 6julia> alg.opt.objMaximumUtility l ┴ Float64: 0.25julia> alg.opt.opt.fees.tnTurnover w ┼ Vector{Float64}: [0.3333333333333333, 0.3333333333333333, 0.3333333333333333] val ┼ Float64: 0.002 fixed ┴ Bool: falseRelated
FollowTheLeaderLastRowsLowDimensionEnsemblePrior: the ensemble that gives the forecast and the predictive covariance.MaximumUtilityVarianceFeesTurnoverMeanRisk
References
- [110] W. Xi, Z. Li, X. Song and H. Ning. Online portfolio selection with predictive instantaneous risk assessment. Pattern Recognition 144, 109872 (2023). Equation 14, Section 4.2 and Section 5.3.
PortfolioOptimisers.FollowTheLeadingHistory — Type
struct FollowTheLeadingHistory{T1<:AbstractOnlinePortfolioSelectionAlgorithm, T2<:Real, T3<:Bool, T4<:(Union{Nothing, var"#s7439"} where var"#s7439"<:BoundedAllocationSet), T5<:EuclideanProjection} <: AbstractOnlinePortfolioSelectionAlgorithmMixes copies of one rule started at different periods, with a fixed share for the newest copy (FLH).
This is follow the leading history of Hazan and Seshadhri (2009). A multiplicative update weights the copies by their returns, and at every period a new copy starts with a fixed share of the weight. Under prune the rule keeps a working set of copies of logarithmic size. The paper's experiments use the Online Newton Step as the base rule, which is NewtonStep here, and any rule of the family serves.
A new copy starts at the base rule's own start from the uniform portfolio, projected onto the Allocation Set in the base rule's geometry. So a constant rebalanced base starts at the projection of its own w. The rule reads nothing of a given Start Allocation beyond its first copy, which starts there through project_start. The rule projects the weight vector onto the Expert Set on eset in the entropic geometry, after the share and the pruning. So a cap on eset caps the trust in one copy. The working set changes size, so eset admits a scalar bound alone. The rule projects the blend onto the head's Allocation Set once more in the Euclidean geometry on proj, as an ExpertMixture does, and skips it by type on a BoundedAllocationSet.
Mathematical definition
\[\begin{align} \hat{p}_{t+1, k} &= \frac{p_{t, k}\, r_{t, k}^{\alpha}}{\sum_{j \in S_t} p_{t, j}\, r_{t, j}^{\alpha}}\,, \quad k \in S_t\,, \\ \bar{p}_{t+1, k} &= \begin{cases} \left( 1 - \dfrac{1}{t + 1} \right) \hat{p}_{t+1, k} & k \in S_t\,, \\ \dfrac{1}{t + 1} & k = t + 1\,, \end{cases} \\ p_{t+1, k} &= \frac{\bar{p}_{t+1, k}}{\sum_{j \in S_{t+1}} \bar{p}_{t+1, j}}\,, \quad k \in S_{t+1}\,, \\ \boldsymbol{w}_{t+1} &= \sum_{k \in S_{t+1}} p_{t+1, k}\, \boldsymbol{h}_k(t+1)\,. \end{align}\]
Where:
- $\boldsymbol{p}_t$: Weight vector over the experts at period $t$, with entries $p_{t,k}$ that sum to one. Here expert $k$ is the copy started at period $k$, and $p_{1, 1} = 1$.
- $\hat{p}_{t+1, k}$, $\bar{p}_{t+1, k}$: Weights after the multiplicative update, and after the share of the new copy.
- $\boldsymbol{r}_t$: Expert-return vector of period $t$, with entries $r_{t,k} = \langle \boldsymbol{h}_k(t), \boldsymbol{x}_t \rangle$.
- $\boldsymbol{h}_k(t)$: Allocation that expert $k$ holds during period $t$.
- $\boldsymbol{x}_t$: Price relative vector of period $t$, each asset's price over its price one period earlier.
- $\alpha$: Exponent of the multiplicative update, the
alphafield. - $S_t$: Working set of period $t$, the start periods of the live copies, with $S_1 = \lbrace 1 \rbrace$.
- $\boldsymbol{w}_t$: Iterate of the rule at period $t$, the allocation its update reads.
- $t$: Period index, counted from one.
The factor $r_{t, k}^{\alpha}$ is the paper's $e^{-\alpha f_t}$ under the log-wealth loss $f_t(\boldsymbol{w}) = -\log \langle \boldsymbol{w}, \boldsymbol{x}_t \rangle$, and at $\alpha = 1$ it is the wealth weighting. Without prune, $S_{t+1} = \lbrace 1, \ldots, t + 1 \rbrace$ and the last normalisation divides by one. Under prune, $S_{t+1}$ holds the start periods that are alive at $t + 1$ under the lifetime of expert_alive, which the paper takes from Woodruff. Then $S_t$ holds $O(\log t)$ copies, and for every $s \leq t$ it holds a start period in $[s, (s + t)/2]$.
Suppose that the base rule's regret on every interval $I$ is $\alpha^{-1} \log |I|$, and that every loss is $\alpha$-exp-concave. When the copy started at $r$ lives through $I = [r, s]$, the paper bounds the regret of the rule on $I$ by $O(\alpha^{-1} (\ln r + \ln |I|))$ (Lemma 3.1). Without prune every copy lives, so this bound holds on every interval. Under prune the paper's bound on every interval is $O(\alpha^{-1} \log s \cdot \log |I| + 1)$ (Lemma 3.2).
Algorithm
The steps of the Online Update:
- Set
ttost.n + 1, andrto the return $\langle \boldsymbol{h}, \boldsymbol{x} \rangle$ of the allocationhof each live copy. - Set
phattost.p .* r .^ alg.alpha, divided by its sum. - Step every live copy with its own Online Update, which gives its Rule State and its allocation for the next period.
- Start a new copy at the base rule's start from the uniform portfolio, projected onto
setin the base rule's geometry, with the start periodt + 1. - Set
pto(1 - 1 / (t + 1)) .* phat, followed by the share1 / (t + 1)of the new copy. - Under
alg.prune, keep the copies thatexpert_alivefinds alive att + 1, with their entries ofp. - Project
ponto the Expert Set with the entropic projection. On the bare simplex over the copies this dividespby its sum. - Set
qto the sum ofp[k] .* hover the copies. Return the new carrier, and the result ofblend_projectionofqontosetwithalg.proj, from the Price-Adjusted Allocation.
Fields
alg: The base rule every expert is a copy of.
alpha: The exponent of the multiplicative update, the paper's $\alpha$. At1the update is the wealth weighting.
prune: Whether the rule prunes the working set to the paper's streaming set of logarithmic size.
eset: The Expert Set onto which the rule projects the weight vector, a scalar bound over the live experts, ornothingfor the bare simplex over them.
proj: The geometry of the last projection of the blend onto the head's Allocation Set.
Constructors
FollowTheLeadingHistory(; alg::AbstractOnlinePortfolioSelectionAlgorithm = NewtonStep(), alpha::Real = 1, prune::Bool = true, eset::Option{<:BoundedAllocationSet} = nothing, proj::EuclideanProjection = EuclideanProjection()) -> FollowTheLeadingHistoryKeywords correspond to the struct's fields.
Validation
alpha > 0. ADomainErroris thrown otherwise.eset, when given, holds aWeightBoundswhose bounds are scalars and nosets: the working set changes size, so a vector bound has no length to match. AnArgumentErroris thrown otherwise.
View parameters
When port_opt_view is called on this type, the base rule is viewed and the rest is carried unchanged.
Examples
julia> FollowTheLeadingHistory()FollowTheLeadingHistory alg ┼ NewtonStep │ beta ┼ Int64: 1 │ delta ┼ Float64: 0.125 │ eta ┼ Int64: 0 │ proj ┴ EuclideanProjection() alpha ┼ Int64: 1 prune ┼ Bool: true eset ┼ nothing proj ┴ EuclideanProjection()Related
AbstractOnlinePortfolioSelectionAlgorithmOnlinePortfolioSelectionFollowTheLeadingHistoryStateExpertMixture: the mixture over a fixed set of experts.NewtonStep: the base rule of the paper's experiments.expert_alive: the lifetime that the pruning reads.
References
- [210] E. Hazan and C. Seshadhri. Efficient learning algorithms for changing environments. In: Proceedings of the 26th International Conference on Machine Learning, 393–400 (2009). Algorithm 1, Lemmas 3.1 and 3.2, and Appendix A.
References
- [64]
- Z.-R. Lai, L. Tan, X. Wu and L. Fang. Loss control with rank-one covariance estimate for short-term portfolio optimization. Journal of Machine Learning Research 21, 1–37 (2020).
- [110]
- W. Xi, Z. Li, X. Song and H. Ning. Online portfolio selection with predictive instantaneous risk assessment. Pattern Recognition 144, 109872 (2023).
- [151]
- B. Li and S. C. Hoi. Online portfolio selection: A survey. ACM Computing Surveys 46, 1–36 (2014).
- [194]
- B. Li, S. C. Hoi and V. Gopalkrishnan. CORN: Correlation-driven nonparametric learning approach for portfolio selection. ACM Transactions on Intelligent Systems and Technology 2, 21:1–21:29 (2011).
- [200]
- A. A. Gaivoronski and F. Stella. Stochastic nonstationary optimization for finding universal portfolios. Annals of Operations Research 100, 165–188 (2000).
- [201]
- L. Györfi and D. Schäfer. Nonparametric prediction. In: Advances in Learning Theory: Methods, Models and Applications (IOS Press, 2003); pp. 339–354.
- [202]
- L. Györfi, G. Lugosi and F. Udina. Nonparametric kernel-based sequential investment strategies. Mathematical Finance 16, 337–357 (2006).
- [203]
- L. Györfi, A. Urbán and I. Vajda. Kernel-based semi-log-optimal empirical portfolio selection strategies. International Journal of Theoretical and Applied Finance 10, 505–516 (2007).
- [204]
- G. Ottucsák and I. Vajda. An asymptotic analysis of the mean-variance portfolio selection. Statistics & Decisions 25, 63–88 (2007).
- [205]
- L. Györfi and I. Vajda. Growth optimal investment with transaction costs. In: Algorithmic Learning Theory, Vol. 5254 of Lecture Notes in Computer Science (Springer, 2008); pp. 108–122.
- [206]
- L. Györfi, F. Udina and H. Walk. Nonparametric nearest neighbor based empirical portfolio selection strategies. Statistics & Decisions 26, 145–157 (2008).
- [207]
- Y. Wang, D. Wang, Y. Wang and Y. Zhang. RACORN-K: Risk-aversion pattern matching-based portfolio selection (2018), arXiv:1802.10244.
- [208]
- M. Khedmati and P. Azin. An online portfolio selection algorithm using clustering approaches and considering transaction costs. Expert Systems with Applications 159, 113546 (2020).
- [209]
- E. Hazan and S. Kale. An online portfolio selection algorithm with regret logarithmic in price variation. Mathematical Finance 25, 288–310 (2015).
- [210]
- E. Hazan and C. Seshadhri. Efficient learning algorithms for changing environments. In: Proceedings of the 26th International Conference on Machine Learning (2009); pp. 393–400.