By Devang Singh

**Introduction**

Machine learning has proved to improve efficiencies significantly, and there are many jobs which have been replaced by smarter and faster machines using artificial intelligence or machine learning. The stock markets are no exceptions to this. Today, there are several Machine Learning algorithms running in the live markets. These algorithms often provide greater returns than other alternate algorithms or sometimes even higher than experienced traders. In this article, I will talk about the concepts involved in a Neural Network and how it can be applied to predict stock prices in the live markets. Let us start by understanding what a neuron is.

Working Of Neural Networks For Stock Price Prediction Click To Tweet

**Neuron**

This is the neuron that you must be familiar with, well if you aren’t you should now be grateful that you can understand this because there are billions of neurons in your brain. There are three components to a neuron, the dendrites, the axon and the main body of the neuron. The dendrites are the receivers of the signal and the axon is the transmitter. Alone, a neuron is not of much use, but when it is connected to other neurons, it does several complicated computations and helps operate the most complicated machine on our planet, the human body.

A computer neuron is built in a similar manner, as shown in the diagram. There are inputs to the neuron marked with yellow circles, and the neuron emits an output signal after some computation. The input layer resembles the dendrites of the neuron and the output signal is the axiom. Each input signal is assigned a weight, w_{i}. This weight is multiplied by the input value and the neuron stores the weighted sum of all the input variables. These weights are computed in the training phase of the neural network through concepts called gradient descent and back propagation, we will cover these topics as we move ahead in the course. An activation function is then applied to the weighted sum, which results in the output signal of the neuron. The input signals are generated by other neurons, i.e, the output of other neurons, and the network is built to make predictions/computations in this manner. This is the basic idea of a neural network. We will look at each of these concepts in more detail in this article.

**Working **of** Neural Networks**

We will look at an example to understand the working of neural networks. The input layer consists of the parameters that will help us arrive at an output value or make a prediction. Our brains essentially have five basic input parameters, which are our senses to touch, hear, see, smell and taste. The neurons in our brain create more complicated parameters such as emotions and feelings, from these basic input parameters. And our emotions and feelings, make us act or take decisions which is basically the output of the neural network of our brains. Therefore, there are two layers of computations in this case before making a decision. The first layer takes in the five senses as inputs and results in emotions and feelings, which are the inputs to the next layer of computations, where the output is a decision or an action. Hence, in this extremely simplistic model of the working of the human brain, we have one input layer, two hidden layers, and one output layer. Of course from our experiences, we all know that the brain is much more complicated than this, but essentially this is how the computations are done in our brain.

To understand the working of a neural network, let us consider a simple stock price prediction example, where the OHLCV (Open-High-Low-Close-Volume) values are the input parameters, there is one hidden layer and the output consists of the prediction of the stock price.

There are five input parameters as shown in the diagram, the hidden layer consists of 3 neurons and the resultant in the output layer is the prediction for the stock price. The 3 neurons in the hidden layer will have different weights for each of the five input parameters and might have different activation functions, which will activate the input parameters according to various combinations of the inputs. For example, the first neuron might be looking at the volume and the difference between the Close and the Open price and might be ignoring the High and Low prices. In this case, the weights for High and Low prices will be zero. Based on the weights that the model has trained itself to attain, an activation function will be applied to the weighted sum in the neuron, this will result in an output value for that particular neuron. Similarly, the other two neurons will result in an output value based on their individual activation functions and weights. Finally, the output value or the predicted value of the stock price will be the sum of the three output values of each neuron. This is how the neural network will work to predict stock prices.

**Conclusion**

Now that you understand the working of a neural network, you are ready to learn how the Artificial Neural Network will train itself to predict the movement of a stock price. In the next article on neural networks, we will delve deeper into the working of a neural network, by understanding how the weights of the neural network are learned through the process of training.

Click here in case you are interested in implementing machine learning related trading strategies in Python.

The post Working Of Neural Networks For Stock Price Prediction appeared first on .

*This post first appeared on Best Algo Trading Platforms Used In Indian Market, please read the originial post: here*