Now, we will deal with a regression problem under RNN. The cyclic neural network provides memory to the neural network. For the serial data, the cyclic neural network can achieve better results. We will use RNN here in this example to predict time series data.
The following code is for the logistic regression:
%matplotlib inlineimport torchfrom torch import nnimport numpy as npimport matplotlib.pyplot as plt# torch.manual_seed(1) # reproducible# Hyper ParametersTIME_STEP = 10 # rnn time stepINPUT_SIZE = 1 # rnn input sizeLR = 0.02 # learning rate# show datasteps = np.linspace(0, ...