def trainModelPipe(self, loss_type):
        encoder = EncoderRNN(input_size=self.n_features,
                             hidden_size=self.hidden_size,
                             num_grulstm_layers=self.num_grulstm_layers,
                             batch_size=self.batch_size).to(self.device)
        decoder = DecoderRNN(input_size=1,
                             hidden_size=self.hidden_size,
                             num_grulstm_layers=self.num_grulstm_layers,
                             fc_units=16,
                             output_size=1).to(self.device)

        net_gru = Net_GRU(encoder, decoder, self.N_output,
                          self.device).to(self.device)

        self.train_model(net_gru,
                         batch_size=self.batch_size,
                         loss_type=loss_type,
                         learning_rate=0.001,
                         epochs=500,
                         gamma=self.gamma,
                         print_every=50,
                         eval_every=50,
                         verbose=1,
                         alpha=self.alpha)

        return net_gru
Example #2
0
          np.array(losses_tdi).mean())


print(f"batch_size: {batch_size}")

## TODO run with dtw implementation
encoder = EncoderRNN(input_size=3,
                     hidden_size=128,
                     num_grulstm_layers=2,
                     batch_size=batch_size).to(device)
decoder = DecoderRNN(input_size=1,
                     hidden_size=128,
                     num_grulstm_layers=2,
                     fc_units=16,
                     output_size=1).to(device)
net_gru_dtw = Net_GRU(encoder, decoder, N_output, device).to(device)

train_model(net_gru_dtw,
            batch_size=batch_size,
            loss_type='dtw',
            learning_rate=0.001,
            epochs=500,
            gamma=gamma,
            print_every=50,
            eval_every=50,
            verbose=1,
            alpha=alpha,
            target_mean=target_log_mean,
            target_std=target_log_std)

encoder = EncoderRNN(input_size=3,
    print(' Eval mse= ',
          np.array(losses_mse).mean(), ' dtw= ',
          np.array(losses_dtw).mean(), ' tdi= ',
          np.array(losses_tdi).mean())


encoder = EncoderRNN(input_size=1,
                     hidden_size=128,
                     num_grulstm_layers=1,
                     batch_size=batch_size).to(device)
decoder = DecoderRNN(input_size=1,
                     hidden_size=128,
                     num_grulstm_layers=1,
                     fc_units=16,
                     output_size=1).to(device)
net_gru_dilate = Net_GRU(encoder, decoder, N_output, device).to(device)
train_model(net_gru_dilate,
            loss_type='dilate',
            learning_rate=0.001,
            epochs=500,
            gamma=gamma,
            print_every=50,
            eval_every=50,
            verbose=1)

encoder = EncoderRNN(input_size=1,
                     hidden_size=128,
                     num_grulstm_layers=1,
                     batch_size=batch_size).to(device)
decoder = DecoderRNN(input_size=1,
                     hidden_size=128,