(self, configs)
| 35 | Multi-scale version of Informer |
| 36 | """ |
| 37 | def __init__(self, configs): |
| 38 | super(Model, self).__init__() |
| 39 | self.pred_len = configs.pred_len |
| 40 | self.output_attention = configs.output_attention |
| 41 | |
| 42 | self.prob_forecasting = configs.prob_forecasting |
| 43 | c_out = configs.c_out*2 if self.prob_forecasting else configs.c_out |
| 44 | |
| 45 | # Embedding |
| 46 | # We use our new DataEmbedding which incldues the scale information |
| 47 | self.enc_embedding = DataEmbedding_mine(configs.enc_in, configs.d_model, configs.embed, configs.freq, configs.dropout) |
| 48 | self.dec_embedding = DataEmbedding_mine(configs.dec_in, configs.d_model, configs.embed, configs.freq, configs.dropout, is_decoder=True) |
| 49 | |
| 50 | # Encoder |
| 51 | self.encoder = Encoder( |
| 52 | [ |
| 53 | EncoderLayer( |
| 54 | AttentionLayer( |
| 55 | ProbAttention(False, configs.factor, attention_dropout=configs.dropout, output_attention=configs.output_attention), |
| 56 | configs.d_model, configs.n_heads), |
| 57 | configs.d_model, |
| 58 | configs.d_ff, |
| 59 | dropout=configs.dropout, |
| 60 | activation=configs.activation, |
| 61 | ) for l in range(configs.e_layers) |
| 62 | ], |
| 63 | [ |
| 64 | ConvLayer( |
| 65 | configs.d_model |
| 66 | ) for l in range(configs.e_layers - 1) |
| 67 | ] if configs.distil else None, |
| 68 | norm_layer=torch.nn.LayerNorm(configs.d_model) |
| 69 | ) |
| 70 | # Decoder |
| 71 | self.decoder = Decoder( |
| 72 | [ |
| 73 | DecoderLayer( |
| 74 | AttentionLayer( |
| 75 | ProbAttention(True, configs.factor, attention_dropout=configs.dropout, output_attention=False), |
| 76 | configs.d_model, configs.n_heads), |
| 77 | AttentionLayer( |
| 78 | ProbAttention(False, configs.factor, attention_dropout=configs.dropout, output_attention=False), |
| 79 | configs.d_model, configs.n_heads), |
| 80 | configs.d_model, |
| 81 | configs.d_ff, |
| 82 | dropout=configs.dropout, |
| 83 | activation=configs.activation, |
| 84 | ) |
| 85 | for l in range(configs.d_layers) |
| 86 | ], |
| 87 | norm_layer=torch.nn.LayerNorm(configs.d_model), |
| 88 | projection=nn.Linear(configs.d_model, c_out, bias=True) |
| 89 | ) |
| 90 | """ |
| 91 | following functions will be used to manage scales |
| 92 | """ |
| 93 | self.scale_factor = configs.scale_factor |
| 94 | self.scales = configs.scales |
no test coverage detected