Skip to content
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

Why my rmse is more than 40 #7

Open
jinjingwen11 opened this issue Dec 8, 2021 · 13 comments
Open

Why my rmse is more than 40 #7

jinjingwen11 opened this issue Dec 8, 2021 · 13 comments

Comments

@jinjingwen11
Copy link

Hello, this is the first time I have asked a question on github. If you offend you, please forgive me.Why my rmse is more than 40 .I hope you have time to answer this question, thank you

@jiaxiang-cheng
Copy link
Owner

Hello, this is the first time I have asked a question on github. If you offend you, please forgive me.Why my rmse is more than 40 .I hope you have time to answer this question, thank you

Hi Jinjing or Jingwen, thanks for raising the issue. I didn't claim that how much this implementation can achieve on RMSE. But I mentioned in the other issue, with some innovative improvements, which I cannot make public, the best I can achieve is around 22. You can take this repo as your base to further reproduce the original work. Or you may fork this one and contribute together if you are interested. And the performance can be varied for so many reasons. This is not a question with a simple answer, especially as you even didn't mention any of the hyper-parameters you used as well.

@jinjingwen11
Copy link
Author

Thank you for your answers. My hyperparameters are what you originally set. I can use other methods to make rmse around 20. Because I am just getting started, it is difficult for me to surpass you if your technology can make rmse reach around 22. Does it mean that this method is not suitable for rul prediction? Thanks again for your answers.

@jiaxiang-cheng
Copy link
Owner

Thank you for your answers. My hyperparameters are what you originally set. I can use other methods to make rmse around 20. Because I am just getting started, it is difficult for me to surpass you if your technology can make rmse reach around 22. Does it mean that this method is not suitable for rul prediction? Thanks again for your answers.

The hyper-parameters originally set can't guarantee you the best performance, you have to tune by yourself. I can't say this method is not suitable for rul prediction for sure as I'm not the author and this is definitely not the best implementation. But if you can achieve better results with other models, maybe then we should say they are more suitable for you to do rul prediction.

@GuoHaoren
Copy link

您好,我用你的code复现了一下这篇文章,有2个问题我觉得导致了rmse比较低。虽然时隔2年了,但觉得还是可以给您说一下。

  1. 您的gcu那里的cnn_layer应该使用1d,in_chans=14, out_chans=14, kernel=3, stride = 1, padding=1. 因为他这一步是想要得到local feature,所以要在time domain做1d卷积,然后为了让输入输出的shape一样,加了1的padding。
  2. 在上一步的更正下,输入不应该只有3个timestep,因为在gcu之后去transformer是为了得到long sequence feature,输入是3的话,这个transformer用处就不大了。我在原文没看到说他们用的多长的sequence,我自己用的30的,效果还可以,基本上用128的embed dim,2个transformer layer, 4个head就有差不多文中的结果了 (11点多)。所以其实input去gcu的时候,就应该是一个sequence 是30 or 比较长的序列(假设是30,input dim就应该是batch_size x 30 x 14),在gcu之后,是batch_size x 30 x 128,再过transformer,输出是一个batch_size x 1的矩阵,只会predict这个序列最后一个time step的rul。

别的地方都很不错,您的code也确实给我了挺多启发,非常感谢您的分享。

@jiaxiang-cheng
Copy link
Owner

您好,我用你的code复现了一下这篇文章,有2个问题我觉得导致了rmse比较低。虽然时隔2年了,但觉得还是可以给您说一下。

  1. 您的gcu那里的cnn_layer应该使用1d,in_chans=14, out_chans=14, kernel=3, stride = 1, padding=1. 因为他这一步是想要得到local feature,所以要在time domain做1d卷积,然后为了让输入输出的shape一样,加了1的padding。
  2. 在上一步的更正下,输入不应该只有3个timestep,因为在gcu之后去transformer是为了得到long sequence feature,输入是3的话,这个transformer用处就不大了。我在原文没看到说他们用的多长的sequence,我自己用的30的,效果还可以,基本上用128的embed dim,2个transformer layer, 4个head就有差不多文中的结果了 (11点多)。所以其实input去gcu的时候,就应该是一个sequence 是30 or 比较长的序列(假设是30,input dim就应该是batch_size x 30 x 14),在gcu之后,是batch_size x 30 x 128,再过transformer,输出是一个batch_size x 1的矩阵,只会predict这个序列最后一个time step的rul。

别的地方都很不错,您的code也确实给我了挺多启发,非常感谢您的分享。

您好~非常感谢您的反馈和建议!这对我还有大家非常有帮助, 也给了我很大的启发!

@GuoHaoren
Copy link

GuoHaoren commented Mar 30, 2023 via email

@xiyueyun
Copy link

非常感谢 讲解的很清楚 谢谢您!

@Delta0406
Copy link

您好,我用你的code复现了一下这篇文章,有2个问题我觉得导致了rmse比较低。虽然时隔2年了,但觉得还是可以给您说一下。

  1. 您的gcu那里的cnn_layer应该使用1d,in_chans=14, out_chans=14, kernel=3, stride = 1, padding=1. 因为他这一步是想要得到local feature,所以要在time domain做1d卷积,然后为了让输入输出的shape一样,加了1的padding。
  2. 在上一步的更正下,输入不应该只有3个timestep,因为在gcu之后去transformer是为了得到long sequence feature,输入是3的话,这个transformer用处就不大了。我在原文没看到说他们用的多长的sequence,我自己用的30的,效果还可以,基本上用128的embed dim,2个transformer layer, 4个head就有差不多文中的结果了 (11点多)。所以其实input去gcu的时候,就应该是一个sequence 是30 or 比较长的序列(假设是30,input dim就应该是batch_size x 30 x 14),在gcu之后,是batch_size x 30 x 128,再过transformer,输出是一个batch_size x 1的矩阵,只会predict这个序列最后一个time step的rul。

别的地方都很不错,您的code也确实给我了挺多启发,非常感谢您的分享。

Haoren,你好,我尝试了一下你描述的方法,但因为代码能力不足,以及个人理解能力不足,无法实现你所描述的效果,方便的话可以在你的仓库上传你的代码或者通过邮件的方式请教吗?万分感谢

@GuoHaoren
Copy link

GuoHaoren commented Apr 12, 2023 via email

@Delta0406
Copy link

您好, 我这里的意思是已经过完最后的linear层的输出y_hat了,对不起在上一个帖子解释得没有很清楚。 你过了transformer encoder之后是30x30x128 (batch_size x sequence length x embed dim), 然后 再过linear 层嘛,这个你可以自己设计,可以reshape成30 x 3840,再过几个linear 层输出,都可以。最后output出去是30 x 1 也就是batch size x 1 了。更清楚一点就是,假设你batch size是1,你每个batch就是一个sample,这个sample的shape是sequence length x feature dim (30 x14), 在过完这个gcu-transformer后,output 是由这个连续的30个timestamps预测出来的最后那个timestamp的rul y_hat, 它的dimension就是1. 你再计算它和这个timestamp的true rul的loss。 不知道有没有解答你的疑问。

________________________________ 发件人: xiyueyun @.> 发送时间: 2023年3月30日 16:15 收件人: jiaxiang-cheng/PyTorch-Transformer-for-RUL-Prediction @.> 抄送: Guo Haoren @.>; Comment @.> 主题: Re: [jiaxiang-cheng/PyTorch-Transformer-for-RUL-Prediction] Why my rmse is more than 40 (Issue #7) - External Email - 您好 我按照您说的实现了一下 但是不太明白为什么batch_size x 30 x 128,再过transformer,输出是一个batch_size x 1的矩阵?我这边经过transformer之后是30 x 30 x 128 ― Reply to this email directly, view it on GitHub<#7 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKDI2AH57HTDGBNVY64WMADW6U6JPANCNFSM5JTCITZA. You are receiving this because you commented.Message ID: @.>
你好,我比较疑惑的点在于这里的30
30
128,第一个30应该不是batch_size?因为输入是1个batch的数据,1
3014,从gcu出来是130128,过了transformer是3030*128

@Delta0406
Copy link

@., 你可以把你的问题详细的描述一下,比如你的dataloader的部分,jiaxiang的这个代码整体还是写的很清楚的,我和他不一样的是dataloader的部分我有自己改,然后就是那个gcu,因为我后面还加了很多东西,代码很乱,最近应该是不会上传github,但我可以帮你debug一下。

________________________________ 发件人: Delta @.
> 发送时间: 2023年4月12日 20:31 收件人: jiaxiang-cheng/PyTorch-Transformer-for-RUL-Prediction @.> 抄送: Guo Haoren @.>; Comment @.> 主题: Re: [jiaxiang-cheng/PyTorch-Transformer-for-RUL-Prediction] Why my rmse is more than 40 (Issue #7) - External Email - 您好,我用你的code复现了一下这篇文章,有2个问题我觉得导致了rmse比较低。虽然时隔2年了,但觉得还是可以给您说一下。 1. 您的gcu那里的cnn_layer应该使用1d,in_chans=14, out_chans=14, kernel=3, stride = 1, padding=1. 因为他这一步是想要得到local feature,所以要在time domain做1d卷积,然后为了让输入输出的shape一样,加了1的padding。 2. 在上一步的更正下,输入不应该只有3个timestep,因为在gcu之后去transformer是为了得到long sequence feature,输入是3的话,这个transformer用处就不大了。我在原文没看到说他们用的多长的sequence,我自己用的30的,效果还可以,基本上用128的embed dim,2个transformer layer, 4个head就有差不多文中的结果了 (11点多)。所以其实input去gcu的时候,就应该是一个sequence 是30 or 比较长的序列(假设是30,input dim就应该是batch_size x 30 x 14),在gcu之后,是batch_size x 30 x 128,再过transformer,输出是一个batch_size x 1的矩阵,只会predict这个序列最后一个time step的rul。 别的地方都很不错,您的code也确实给我了挺多启发,非常感谢您的分享。 Haoren,你好,我尝试了一下你描述的方法,但因为代码能力不足,以及个人理解能力不足,无法实现你所描述的效果,方便的话可以在你的仓库上传你的代码或者通过邮件的方式请教吗?万分感谢 ― Reply to this email directly, view it on GitHub<#7 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKDI2ABSIQ47SF2HAEJO5Q3XA2OCTANCNFSM5JTCITZA. You are receiving this because you commented.Message ID: @.>

您好,我发邮件到您的邮箱了,除了邮件里提到的问题,还有一个就是改完之后测试集的损失不变了……我也不知道怎么回事,如果大佬有时间帮忙看一下的话,万分感激~

@xiyueyun
Copy link

@., 你可以把你的问题详细的描述一下,比如你的dataloader的部分,jiaxiang的这个代码整体还是写的很清楚的,我和他不一样的是dataloader的部分我有自己改,然后就是那个gcu,因为我后面还加了很多东西,代码很乱,最近应该是不会上传github,但我可以帮你debug一下。

________________________________ 发件人: Delta _
@**
._> 发送时间: 2023年4月12日 20:31 收件人: jiaxiang-cheng/PyTorch-Transformer-for-RUL-Prediction _@.> 抄送: Guo Haoren @._>; Comment _@.> 主题: Re: [jiaxiang-cheng/PyTorch-Transformer-for-RUL-Prediction] Why my rmse is more than 40 (Issue #7) - External Email - 您好,我用你的code复现了一下这篇文章,有2个问题我觉得导致了rmse比较低。虽然时隔2年了,但觉得还是可以给您说一下。 1. 您的gcu那里的cnn_layer应该使用1d,in_chans=14, out_chans=14, kernel=3, stride = 1, padding=1. 因为他这一步是想要得到local feature,所以要在time domain做1d卷积,然后为了让输入输出的shape一样,加了1的padding。 2. 在上一步的更正下,输入不应该只有3个timestep,因为在gcu之后去transformer是为了得到long sequence feature,输入是3的话,这个transformer用处就不大了。我在原文没看到说他们用的多长的sequence,我自己用的30的,效果还可以,基本上用128的embed dim,2个transformer layer, 4个head就有差不多文中的结果了 (11点多)。所以其实input去gcu的时候,就应该是一个sequence 是30 or 比较长的序列(假设是30,input dim就应该是batch_size x 30 x 14),在gcu之后,是batch_size x 30 x 128,再过transformer,输出是一个batch_size x 1的矩阵,只会predict这个序列最后一个time step的rul。 别的地方都很不错,您的code也确实给我了挺多启发,非常感谢您的分享。 Haoren,你好,我尝试了一下你描述的方法,但因为代码能力不足,以及个人理解能力不足,无法实现你所描述的效果,方便的话可以在你的仓库上传你的代码或者通过邮件的方式请教吗?万分感谢 ― Reply to this email directly, view it on GitHub<#7 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKDI2ABSIQ47SF2HAEJO5Q3XA2OCTANCNFSM5JTCITZA. You are receiving this because you commented.Message ID: @.**_>

您好,我发邮件到您的邮箱了,除了邮件里提到的问题,还有一个就是改完之后测试集的损失不变了……我也不知道怎么回事,如果大佬有时间帮忙看一下的话,万分感激~

您好 我在改代码的过程的遇到了跟他相同的问题 改完代码后 损失不变 不知道是什么原因 谢谢您!

@zzj0123
Copy link

zzj0123 commented Jul 14, 2023

前辈您好,请问您的model.py中的代码EncoderLayer部分的forward里面,模型结构是不是搭错了呀?论文里面是先Attention然后再norm,而代码里面是现执行norm,如果是我理解错了,您能不能解答一下?谢谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants