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

关于Fedformer模型输出结果的output size问题 #80

Open
FAFUuser opened this issue Feb 2, 2024 · 3 comments
Open

关于Fedformer模型输出结果的output size问题 #80

FAFUuser opened this issue Feb 2, 2024 · 3 comments

Comments

@FAFUuser
Copy link

FAFUuser commented Feb 2, 2024

尊敬的MAZiqing老师:
您好,我是一名在读研究生,我在 GitHub 上发现了您所提出的FEDformer模型,并对其非常感兴趣。在尝试使用该模型时,我遇到了一个问题,希望能够向您请教。

    问题描述:
    在使用FEDformer模型时,最初我使用S(单变量预测单变量),所预测的结果还不错,但还没有达到我想要的精度,因此想通过添加一些其他的特征来提高模型的精度,因此想使用MS(多变量预测单变量),但是在使用的过程中,模型所输出的结果并不是单变量,而是多变量。通过研究代码我发现在Decoder的forward部分,仅仅对x(seasonal_part)进行了projection,而未对trend(trend_part)进行projection,因此在计算dec_out = trend_part + seasonal_part时,导致dec_out最终的结果仍然为多变量。因此我想请教一下:我可以在Decoder forward部分也对trend(trend_part)进行projection,从而实现单变量结果的输出吗?
    
   同时,关于这个问题的出发点:通过添加其他特征来提高模型预测目标变量的精度的想法是否正确,FEDformer模型可以挖掘到特征与目标变量之间的关系吗?

    我非常感谢您在项目中的贡献,也非常感谢您对我的帮助和支持。如果您能够指导我解决这些问题,我将不胜感激。
    谢谢您的时间和耐心!
@FAFUuser
Copy link
Author

FAFUuser commented Feb 2, 2024

尊敬的MAZiqing老师: 您好,我是一名在读研究生,我在 GitHub 上发现了您所提出的FEDformer模型,并对其非常感兴趣。在尝试使用该模型时,我遇到了一个问题,希望能够向您请教。

    问题描述:
    在使用FEDformer模型时,最初我使用S(单变量预测单变量),所预测的结果还不错,但还没有达到我想要的精度,因此想通过添加一些其他的特征来提高模型的精度,因此想使用MS(多变量预测单变量),但是在使用的过程中,模型所输出的结果并不是单变量,而是多变量。通过研究代码我发现在Decoder的forward部分,仅仅对x(seasonal_part)进行了projection,而未对trend(trend_part)进行projection,因此在计算dec_out = trend_part + seasonal_part时,导致dec_out最终的结果仍然为多变量。因此我想请教一下:我可以在Decoder forward部分也对trend(trend_part)进行projection,从而实现单变量结果的输出吗?
    
   同时,关于这个问题的出发点:通过添加其他特征来提高模型预测目标变量的精度的想法是否正确,FEDformer模型可以挖掘到特征与目标变量之间的关系吗?

    我非常感谢您在项目中的贡献,也非常感谢您对我的帮助和支持。如果您能够指导我解决这些问题,我将不胜感激。
    谢谢您的时间和耐心!

附代码:
class Decoder(nn.Module):
"""
Autoformer encoder
"""
def init(self, layers, norm_layer=None, projection=None):
super(Decoder, self).init()
self.layers = nn.ModuleList(layers)
self.norm = norm_layer
self.projection = projection

def forward(self, x, cross, x_mask=None, cross_mask=None, trend=None):
    for layer in self.layers:
        x, residual_trend = layer(x, cross, x_mask=x_mask, cross_mask=cross_mask)
        trend = trend + residual_trend

    if self.norm is not None:
        x = self.norm(x)

    if self.projection is not None:
        x = self.projection(x)

    return x, trend

@FAFUuser
Copy link
Author

FAFUuser commented Feb 3, 2024

尊敬的MAZiqing老师: 您好,我是一名在读研究生,我在 GitHub 上发现了您所提出的FEDformer模型,并对其非常感兴趣。在尝试使用该模型时,我遇到了一个问题,希望能够向您请教。

    问题描述:
    在使用FEDformer模型时,最初我使用S(单变量预测单变量),所预测的结果还不错,但还没有达到我想要的精度,因此想通过添加一些其他的特征来提高模型的精度,因此想使用MS(多变量预测单变量),但是在使用的过程中,模型所输出的结果并不是单变量,而是多变量。通过研究代码我发现在Decoder的forward部分,仅仅对x(seasonal_part)进行了projection,而未对trend(trend_part)进行projection,因此在计算dec_out = trend_part + seasonal_part时,导致dec_out最终的结果仍然为多变量。因此我想请教一下:我可以在Decoder forward部分也对trend(trend_part)进行projection,从而实现单变量结果的输出吗?
    
   同时,关于这个问题的出发点:通过添加其他特征来提高模型预测目标变量的精度的想法是否正确,FEDformer模型可以挖掘到特征与目标变量之间的关系吗?

    我非常感谢您在项目中的贡献,也非常感谢您对我的帮助和支持。如果您能够指导我解决这些问题,我将不胜感激。
    谢谢您的时间和耐心!

附代码: class Decoder(nn.Module): """ Autoformer encoder """ def init(self, layers, norm_layer=None, projection=None): super(Decoder, self).init() self.layers = nn.ModuleList(layers) self.norm = norm_layer self.projection = projection

def forward(self, x, cross, x_mask=None, cross_mask=None, trend=None):
    for layer in self.layers:
        x, residual_trend = layer(x, cross, x_mask=x_mask, cross_mask=cross_mask)
        trend = trend + residual_trend

    if self.norm is not None:
        x = self.norm(x)

    if self.projection is not None:
        x = self.projection(x)

    return x, trend

好吧,我尝试修改了一下,这样行不通。那在实现feature为MS的需求时,请教一下,应该如何修改代码呢?

@efg001
Copy link

efg001 commented Jul 6, 2024

trend is the output of "layer"(Decoderlayer)

x, residual_trend = layer(x, cross, x_mask=x_mask, cross_mask=cross_mask)

and within decoder layer, trend is fed through a convolution layer(projection) here

residual_trend = self.projection(residual_trend.permute(0, 2, 1)).transpose(1, 2)

(i.e trend is already 'projected')

Also I dont think whether if the trend or seasonal information is fed through a convolution layer changes the output size of the model(maybe I am wrong lmk if I am missing something here)

On your request:
(#73 (comment))

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

2 participants