IsoelasticLoss

class pfhedge.nn.IsoelasticLoss(a)[source]

Creates a criterion that measures the expected isoelastic utility.

The loss of the profit-loss \(\text{PL}\) is given by:

\[\begin{split}\text{loss}(\text{PL}) = -\mathbf{E}[u(\text{PL})] \,, \quad u(x) = \begin{cases} x^{1 - a} & a \neq 1 \\ \log{x} & a = 1 \end{cases} \,.\end{split}\]

See also

Parameters

a (float) – Relative risk aversion coefficient of the isoelastic utility. This parameter should satisfy \(0 < a \leq 1\).

Shape:
  • input: \((N, *)\) where

    \(*\) means any number of additional dimensions.

  • target: \((N, *)\)

  • output: \((*)\)

Examples

>>> from pfhedge.nn import IsoelasticLoss
...
>>> loss = IsoelasticLoss(0.5)
>>> input = torch.arange(1.0, 5.0)
>>> loss(input)
tensor(-1.5366)
>>> loss.cash(input)
tensor(2.3610)
>>> loss = IsoelasticLoss(1.0)
>>> pl = torch.arange(1.0, 5.0)
>>> loss(input)
tensor(-0.7945)
>>> loss.cash(input)
tensor(2.2134)