pfhedge.nn.functional.expected_shortfall¶
- pfhedge.nn.functional.expected_shortfall(input, p, dim=None)[source]¶
Returns the expected shortfall of the given input tensor.
- Parameters
input (torch.Tensor) – The input tensor.
p (float) – The quantile level.
dim (int, optional) – The dimension to sort along.
- Returns
torch.Tensor
Examples
>>> from pfhedge.nn.functional import expected_shortfall >>> >>> input = -torch.arange(10.0) >>> input tensor([-0., -1., -2., -3., -4., -5., -6., -7., -8., -9.]) >>> expected_shortfall(input, 0.3) tensor(8.)