macrosynergy.learning.forecasting.torch.losses#
- 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.
- class MultiOutputMCR(skip_validation=True, unbiased=True)[source]#
Bases:
ModuleNegative mean-concentration risk ratio loss for multi-output regression problems.
Notes
By mean-concentration risk ratio, we refer to the ratio of the mean return within a time period, to the standard deviation of returns within that time period. This differs from a Sharpe ratio in that the Sharpe is a temporal quantity, whereas this statistic is cross-sectional. Maximisation of such a statistic would encourage positive returns at each time period whilst penalising diversity in the cross-sectional return distribution. The goal is to encourage prevent the model from concentrating returns in a small subset of the outputs.
This statistic can be calculated for each sample in a batch, and then averaged over the batch. Neural networks are most naturally formulated as minimization problems, so the negative mean-concentration risk ratio is used as a loss function.