-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transformer使用target作为模型的输入预测target? #37
Comments
在训练的时候,Teacher Forcing这种做法应该是没问题的,我没记错的话,《Attention is All You Need》也是这么做的。但是严格来说,在推理的时候,使用Teacher Forcing就不太合理了。在我写的模型里面,应该已经避免了这些问题。。回头我再检查下 |
感谢您的回答。我还没有完全看懂您的transformer的实现逻辑。我是用过在predict.py进行test时,这行代码outputs = model.forward(data, label, int(args.predict_days))处,把label替换成随机数进行验证的,结果预测值也变成了随机游走。所以我推测label影响了预测值。 |
label不能替换为随机值,你可以看看Stock_Data类,data和label都是从这里面出来的 |
我看了一遍逻辑,找到了问题哈。transformer中的tgt输入,应该是进行右移一位的处理,第一位用其他向量补齐。如果不右移的话,那么就相当于,用T+1天的数据去预测T+1天的数据,就不是预测了。对于predict_days>0的情况,也应该使用掩码mask掉,否则就会出现未来参数。相当于用T+1、T+2、T+3去预测T+1天的数据了。 |
我没有右移吗?淦,我去查一下 |
作者您好,我发现代码中transformer使用的是target作为输入预测target。
这个是不是有些不合理?还是我使用方面不太对哈?
The text was updated successfully, but these errors were encountered: