How it works...
As this is the third recipe on training neural networks using PyTorch, many of the concepts are already familiar. That is why we focus on the new ones and refer to the previous two recipes for more details.
After loading the libraries, we defined a number of parameters for the data and training of the RNN. In Step 3, we downloaded stock prices of Intel from the years 2010-2019. We resampled to the weekly frequency by taking each week's last adjusted close price. For the validation set, we use the second half of 2019. We used index slicing with the selected dates to calculate the size of the validation set (27 weeks).
In Step 4, we used MinMaxScaler of scikit-learn to scale the data to fit the range of [0,1]. We fitted the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access