Regularisation Constraints
PortfolioOptimisers.set_l1_regularisation! Function
set_l1_regularisation!(model::JuMP.Model, l1_val::Number)
set_l1_regularisation!(args...)Add an L1 regularisation penalty to the objective function.
The penalty is applied as given, so l1_val must be commensurate with the scale of the objective it is added to.
Mathematical definition
Where:
: L1 regularisation coefficient. : Portfolio weights vector .
Arguments
model::JuMP.Model: The JuMP optimisation model.l1_val::Number: L1 regularisation coefficient.
Returns
nothing.
Details
l1_val::Number: Introduces the auxiliary variablet_l1, bounds it with[t_l1; w] in MOI.NormOneCone, and addsl1_val * t_l1to the objective penalty viaadd_to_objective_penalty!.args...: No-op, used when no L1 regularisation is configured.
Related
sourcePortfolioOptimisers._set_l2_regularisation! Function
_set_l2_regularisation!(model::JuMP.Model, i::Integer, w::VecNum,
l2::L2Regularisation{<:Any, <:SOCRiskExpr}, sc::Number)
_set_l2_regularisation!(model::JuMP.Model, i::Integer, w::VecNum,
l2::L2Regularisation{<:Any, <:SquaredSOCRiskExpr}, sc::Number)
_set_l2_regularisation!(model::JuMP.Model, i::Integer, w::VecNum,
l2::L2Regularisation{<:Any, <:QuadRiskExpr}, args...)
_set_l2_regularisation!(model::JuMP.Model, i::Integer, w::VecNum,
l2::L2Regularisation{<:Any, <:RSOCRiskExpr}, sc::Number)Add the i-th L2 regularisation penalty to the objective, in the formulation given by l2.alg.
The coefficient l2.val is applied as given, so it must be consistent with the formulation it multiplies: SOCRiskExpr penalises SquaredSOCRiskExpr, QuadRiskExpr and RSOCRiskExpr penalise val therefore does not produce the same penalty across formulations.
QuadRiskExpr yields a quadratic objective term rather than a conic one; add_to_objective_penalty! promotes an affine penalty expression to a JuMP.QuadExpr to accommodate it.
Mathematical definition
Where:
: L2 regularisation coefficient, the valfield ofl2.: Portfolio weights vector .
Arguments
model::JuMP.Model: The JuMP optimisation model.i::Integer: Index of the term, used to suffix the variables and constraints it creates so that multiple terms do not collide.w::VecNum: Portfolio weights variable.l2::L2Regularisation: The L2 regularisation term.sc::Number: Constraint scale factor.
Returns
nothing.
Details
l2::L2Regularisation{<:Any, <:SOCRiskExpr}: Introducest_l2_i, constrains[t_l2_i; w] in SecondOrderConeso thatt_l2_i >= norm(w, 2), and penalisesval * t_l2_i.l2::L2Regularisation{<:Any, <:SquaredSOCRiskExpr}: Introducest_l2_i, constrains[t_l2_i; w] in SecondOrderConeso thatt_l2_i >= norm(w, 2), and penalisesval * t_l2_i^2.l2::L2Regularisation{<:Any, <:QuadRiskExpr}: Introduces no auxiliary variable, and penalisesval * dot(w, w)directly.l2::L2Regularisation{<:Any, <:RSOCRiskExpr}: Introducest_l2_i, constrains[t_l2_i; 0.5; w] in RotatedSecondOrderConeso thatt_l2_i >= norm(w, 2)^2, and penalisesval * t_l2_i.
Related
sourcePortfolioOptimisers.set_l2_regularisation! Function
set_l2_regularisation!(model::JuMP.Model, l2s::L2Reg_VecL2Reg)
set_l2_regularisation!(args...)Add one or more L2 regularisation penalties to the objective function.
Each L2Regularisation carries its own coefficient and cone formulation, so several may be combined in a single model. The penalties are applied as given, so each coefficient must be commensurate with the scale of the objective it is added to, and with the formulation used to express it.
Mathematical definition
Where:
: L2 regularisation coefficient of the -th term. : Portfolio weights vector .
Arguments
model::JuMP.Model: The JuMP optimisation model.l2s::L2Reg_VecL2Reg: One or more L2 regularisation terms.
Returns
nothing.
Details
l2s::L2Reg_VecL2Reg: Dispatches each term to_set_l2_regularisation!, which selects the cone formulation from the term'salgfield. Variables and constraints are suffixed by the term's index, so terms do not collide.args...: No-op, used when no L2 regularisation is configured.
Related
PortfolioOptimisers.set_lp_regularisation! Function
set_lp_regularisation!(model::JuMP.Model, lps::LpReg_VecLpReg)
set_lp_regularisation!(args...)Add one or more Lp regularisation penalties to the objective function.
Each LpRegularisation carries its own norm order and coefficient, so several may be combined in a single model. The penalties are applied as given, so each coefficient must be commensurate with the scale of the objective it is added to.
The same estimator also specifies a p-norm constraint when it is placed in the wnp field of JuMPOptimiser instead of the lp field, in which case its val field is a bound rather than a coefficient. See set_weight_norm_p_constraints!.
Mathematical definition
Where:
: Regularisation coefficient of the -th term, its valfield.: Norm order of the -th term, its pfield.: Portfolio weights vector .
Arguments
model::JuMP.Model: The JuMP optimisation model.lps::LpReg_VecLpReg: One or more Lp regularisation terms.
Returns
nothing.
Details
lps::LpReg_VecLpReg: For each term, introduces the auxiliary variablest_lp_iandr_lp_i, boundsabove by t_lp_iwith a set ofMOI.PowerConeconstraints, and addsval * t_lp_ito the objective penalty viaadd_to_objective_penalty!. Variables and constraints are suffixed by the term's index, so terms do not collide.args...: No-op, used when no Lp regularisation is configured.
Related
PortfolioOptimisers.set_linf_regularisation! Function
set_linf_regularisation!(model::JuMP.Model, linf::Number)
set_linf_regularisation!(args...)Add an L∞ regularisation penalty to the objective function.
The penalty is applied as given, so linf must be commensurate with the scale of the objective it is added to and with the range of values the weights can take.
Mathematical definition
Where:
: L∞ regularisation coefficient. : Portfolio weights vector .
Arguments
model::JuMP.Model: The JuMP optimisation model.linf::Number: L∞ regularisation coefficient.
Returns
nothing.
Details
linf::Number: Introduces the auxiliary variablet_linf, bounds it with[t_linf; w] in MOI.NormInfinityCone, and addslinf * t_linfto the objective penalty viaadd_to_objective_penalty!.args...: No-op, used when no L∞ regularisation is configured.
Related
set_linf_regularisation!(model::Model, linf::Number)Sets the L∞ regularisation term in the objective function. The penalty value is not adjusted so it must be consistent with the range of values the weights can take.
sourcePortfolioOptimisers.AbstractRegularisationEstimator Type
abstract type AbstractRegularisationEstimator <: AbstractEstimatorAbstract supertype for all portfolio weight regularisation estimators.
Related
sourcePortfolioOptimisers.LpRegularisation Type
struct LpRegularisation{__T_p, __T_val} <: AbstractRegularisationEstimatorLp-norm regularisation term added to the optimisation objective.
Penalises concentrated portfolios by encouraging weight smoothness for
The same estimator serves double duty. In the lp field of JuMPOptimiser it is a penalty, and val is the coefficient multiplying the norm. In the wnp field it is a constraint, and val is instead a lower bound on the p-norm effective number of assets. The norm order p means the same thing in both. See set_lp_regularisation! and set_weight_norm_p_constraints!.
Mathematical definition
Where:
: Regularisation coefficient. : Norm order. : Portfolio weights vector .
Fields
p: Norm order,p > 1.val: Penalty coefficient when the estimator is used as a regularisation term (thelpfield ofJuMPOptimiser), or the lower bound on the p-norm effective number of assets when it is used as a weight norm constraint (thewnpfield).
Constructors
LpRegularisation(; p::Number = 3, val::Number = 1e-3) -> LpRegularisationKeywords correspond to the struct's fields.
Validation
isfinite(p).p > 1.val > 0and finite.
Related
PortfolioOptimisers.VecL2Reg Type
const VecL2Reg = AbstractVector{<:L2Regularisation}Alias for a vector of L2Regularisation objects.
Represents a collection of L2-norm regularisation terms to be added to the optimisation objective.
Related
sourcePortfolioOptimisers.L2Regularisation Type
struct L2Regularisation{__T_val, __T_alg} <: AbstractRegularisationEstimatorL2-norm regularisation term added to the optimisation objective.
Penalises concentrated portfolios by shrinking the weights towards zero. The alg field selects the formulation used to express the penalty, which determines both the cones the solver sees and the power of the norm being penalised, so val must be interpreted in the light of the chosen formulation — see _set_l2_regularisation!.
Mathematical definition
Where:
: L2 regularisation coefficient, the valfield.: Portfolio weights vector .
The first form is used by SOCRiskExpr; the second by SquaredSOCRiskExpr, QuadRiskExpr and RSOCRiskExpr.
Fields
val: L2 regularisation penalty coefficient.alg: Second-moment formulation used to express the L2 penalty.
Constructors
L2Regularisation(;
val::Number = 1e-4,
alg::SecondMomentFormulation = SOCRiskExpr()
) -> L2RegularisationKeywords correspond to the struct's fields.
Validation
val > 0and finite.
Related
PortfolioOptimisers.L2Reg_VecL2Reg Type
const L2Reg_VecL2Reg = Union{<:L2Regularisation, <:VecL2Reg}Alias for a single or vector of L2 regularisation terms.
Matches either a single L2Regularisation or a vector of them (VecL2Reg).
Related
sourcePortfolioOptimisers.VecLpReg Type
const VecLpReg = AbstractVector{<:LpRegularisation}Alias for a vector of LpRegularisation objects.
Represents a collection of Lp-norm regularisation terms to be added to the optimisation objective.
Related
sourcePortfolioOptimisers.LpReg_VecLpReg Type
const LpReg_VecLpReg = Union{<:LpRegularisation, <:VecLpReg}Alias for a single or vector of Lp regularisation terms.
Matches either a single LpRegularisation or a vector of them (VecLpReg).
Related
source