macrosynergy.learning.forecasting.torch.losses.sharpe_loss#
- class MultiOutputSharpe(skip_validation=True, unbiased=True)[source]#
Bases:
ModuleNegative Sharpe ratio loss for multi-output regression problems.
Notes
When a neural network is designed so that the output can be interpreted as signals or portfolio weights for each output, a stylized Sharpe ratio can be calculated by multiplying the true returns by the respective signals or weights, before downsampling to portfolio returns. The Sharpe ratio, excluding trading frictions such as transaction costs, can be calculated over the batch.
Neural networks are most naturally formulated as minimization problems, so the negative Sharpe ratio is used as a loss function.