09.10.2023 Views

Advanced Data Analytics Using Python_ With Machine Learning, Deep Learning and NLP Examples ( 2023)

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 5

Deep Learning and Neural Networks

Recurrent Neural Network

A recurrent neural network is an extremely popular kind of network

where the output of the previous step goes to the feedback or is input

to the hidden layer. It is an extremely useful solution for a problem like

a sequence leveling algorithm or time-series prediction. One of the

more popular applications of the sequence leveling algorithm is in an

autocomplete feature of a search engine.

As an example, say one algorithmic trader wants to predict the price

of a stock for trading. But his strategy requires the following criteria for

prediction:

a) The predicted tick is higher than the current tick and

the next tick. Win.

b) The predicted tick is lower than the current tick and

the next tick. Win.

c) The predicted tick is higher than the current tick but

lower than the next tick. Loss.

d) The predicted tick is lower than the current tick but

higher than the next tick. Loss.

To satisfy his criteria, the developer takes the following strategy.

For generating predictions for 100 records, he is considering preceding

1,000 records as input 1, prediction errors in the last 1,000 records as input

2, and differences between two consecutive records as input 3. Using these

inputs, an RNN-based engine predicts results, errors, and inter-record

differences for the next 100 records.

Then he takes the following strategy:

If predicted diff > 1 and predicted err < 1, then

prediction += pred_err + 1.

If predicted diff < 1 and predicted err > 1, then

prediction -= pred_err -1.

113

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!