Time Series Forecasting using Deep Learning: Combining PyTorch, RNN, TCN, and Deep Neural Network Models to Provide Production-Ready Prediction Solutions by Ivan Gridin

Time Series Forecasting using Deep Learning: Combining PyTorch, RNN, TCN, and Deep Neural Network Models to Provide Production-Ready Prediction Solutions by Ivan Gridin

Author:Ivan Gridin [Gridin, Ivan]
Language: eng
Format: epub
Publisher: BPB Publications
Published: 2022-08-15T00:00:00+00:00


Wii, Whi, Wif, Whf, Wig, Whg, Wio, Who – weights

bii, bhi, bif, bhf, big, bhg, bio, bho – bias

Let us examine the PyTorch implementation of the LSTM prediction model ch4/model/lstm.py:

import torch.nn as nn

class LSTM(nn.Module):

def __init__(self,

hidden_size,

in_size = 1,

out_size = 1):

super(LSTM, self).__init__()

self.lstm = nn.LSTM(

input_size = in_size,

hidden_size = hidden_size,

batch_first = True)

self.fc = nn.Linear(hidden_size, out_size)

def forward(self, x, h = None):

out, h = self.lstm(x, h)

last_hidden_states = out[:, -1]

out = self.fc(last_hidden_states)

return out, h



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.