pfhedge.nn.functional.quadratic_cvar¶
- pfhedge.nn.functional.quadratic_cvar(input, lam, dim=None)[source]¶
Returns the Quadratic CVaR of the given input tensor.
\[\rho (X) = \inf_\omega \left\{\omega + \lambda || \min\{0, X + \omega\}||_2\right\}.\]for \(\lambda\geq1\).
References
Buehler, Hans, Statistical Hedging (March 1, 2019). Available at SSRN: http://dx.doi.org/10.2139/ssrn.2913250 (See Conclusion.)
- Parameters
input (torch.Tensor) – The input tensor.
lam (float) – The \(lambda\) parameter, representing the weight given to the tail losses.
dim (int, optional) – The dimension to sort along. If None, the tensor is flattened.
- Returns
The Quadratic CVaR of the input tensor.
- Return type
Examples
>>> from pfhedge.nn.functional import quadratic_cvar >>> >>> input = -torch.arange(10.0) >>> input tensor([-0., -1., -2., -3., -4., -5., -6., -7., -8., -9.]) >>> quadratic_cvar(input, 2.0) tensor(7.9750)