skwdro.operations_research.Portfolio#
- class skwdro.operations_research.Portfolio(rho=0.01, eta=0.0, alpha=0.95, C=None, d=None, fit_intercept=None, cost='t-NC-1-1', solver='dedicated', solver_reg=0.001, reparam='softmax', learning_rate: float | None = None, n_zeta_samples: int = 10, random_state: int = 0, n_iter: int | ~typing.Tuple[int, int] | None=None, opt_cond: OptCondTorch | None = <skwdro.solvers.optim_cond.OptCondTorch object>)[source]#
A Wasserstein Distributionally Robust Mean-Risk Portfolio estimator.
Model for the portfolio optimization problem
\[\mathbb{E}[ - \langle x ; \xi \rangle ] + \eta \mathrm{CVar}_\alpha[- \langle x ; \xi \rangle]\]which amounts to using the following loss function
\[\ell(x,\tau;\xi) = - \langle x ; \xi \rangle + \eta \tau + \frac{1}{\alpha} \max( - \langle x ; \xi \rangle - \tau ; 0)\]where \(\tau\) is an extra real parameter accounting for the threshold of the CVaR (see [Rockafellar and Uryasev (2000)]). The parameter \(x\) is constrained to live in the simplex (This is encoded in the constraints of the problem in [Esfahani et al. (2018)] and by an exponential reparametrization for the entropy-regularized version).
- Parameters:
- rhofloat, default=1e-2
Robustness radius
- eta: float > 0, default=0
Risk-aversion parameter linked to the Conditional Value at Risk
- alpha: float in (0,1], default=0.95
Confidence level of the Conditional Value at Risk
- C(nb_constraints, nb_assets), default=None
Matrix of constraints observed by the user.
- d(nb_constraints,), default=None
Vector of constraints observed by the user.
- fit_intercept: boolean, default=None
Determines if an intercept is fit or not
- cost: str, default=”t-NC-1-1”
Tiret-separated code to define the transport cost: “<engine>-<cost id>-<k-norm type>-<power>” for \(c(x, y):=\|x-y\|_k^p\)
- solver: str, default=’entropic’
Solver to be used: ‘entropic’ or ‘dedicated’
- solver_reg: float, default=1.0
regularization value for the entropic solver
- learning_rate: float | None, default=None
if not set, use a default value depending on the problem, else specifies the stepsize of the gradient descent algorithm
- reparam: str, default=”softmax”
Reparametrization method of theta for the entropic torch loss
- random_state: int, default=None
Seed used by the random number generator when using non-deterministic methods on the estimator
- Examples
- >>> from skwdro.estimators import Portfolio
- >>> import numpy as np
- >>> X = np.random.normal(size=(10,2))
- >>> estimator = Portfolio()
- >>> estimator.fit(X)
- Portfolio()
- ——–