kieranjwood / trading-momentum-transformer

This code accompanies the the paper Trading with the Momentum Transformer: An Intelligent and Interpretable Architecture (https://arxiv.org/pdf/2112.08534.pdf).
https://kieranjwood.github.io/publication/momentum-transformer/
MIT License
432 stars 188 forks source link

the labels v.s. output of predict #10

Closed jqlruc closed 9 months ago

jqlruc commented 9 months ago

Here is the output of the best model's prediction, which is positions: https://github.com/kieranjwood/trading-momentum-transformer/blob/d7df00bba31f5728e1c8bc735da0208892487142/mom_trans/deep_momentum_network.py#L474

But the labels that fit this model are "target_returns": https://github.com/kieranjwood/trading-momentum-transformer/blob/d7df00bba31f5728e1c8bc735da0208892487142/mom_trans/model_inputs.py#L94C20-L94C20

why does the output of the fit have a different meaning from the output of the predicted function?

jqlruc commented 9 months ago

I got it, the output has a tanh activation: https://github.com/kieranjwood/trading-momentum-transformer/blob/d7df00bba31f5728e1c8bc735da0208892487142/mom_trans/deep_momentum_network.py#L532

danbo6 commented 4 months ago

Hi @jqlruc, I also feel this output is very confusing. please see https://github.com/kieranjwood/trading-momentum-transformer/blob/master/mom_trans/deep_momentum_network.py#L484, here the 'returns ' is a volatility scaled returns. Should we use the real daily return?