EntropicLoss¶
- class pfhedge.nn.EntropicLoss(a=1.0)[source]¶
Creates a criterion that measures the expected exponential utility.
The loss of the profit-loss \(\text{PL}\) is given by:
\[\text{loss}(\text{PL}) = -\mathbf{E}[u(\text{PL})] \,, \quad u(x) = -\exp(-a x) \,.\]See also
pfhedge.nn.functional.exp_utility()
: The corresponding utility function.
- Parameters
a (float > 0, default=1.0) – Risk aversion coefficient of the exponential utility.
- Shape:
- input: \((N, *)\) where
\(*\) means any number of additional dimensions.
target: \((N, *)\)
output: \((*)\)
Examples
>>> from pfhedge.nn import EntropicLoss ... >>> loss = EntropicLoss() >>> input = -torch.arange(4.0) >>> loss(input) tensor(7.7982) >>> loss.cash(input) tensor(-2.0539)