# Stock market prediction using aritificial neural

Valentin Steinhauer Short description Time series prediction plays a big role in economics. In this article, we will look at how the model trains itself to make predictions. Once you have understood the training process, you will be ready to code your own Neural Network.

Training the Neural Network There are two ways to code a program for performing a specific task.

## The artificial neuron

One is to define all the rules required by the program to compute the result given some input to the program. The other way is to develop the framework upon which the code will learn to perform the specific task by training itself on a dataset through adjusting the result it computes to be as close to the actual results which have been observed.

This process is called training the model, we will now look at how our neural network will train itself to predict stock prices. The neural network will be given the dataset, which consists of the OHLCV data as the input and as the output, we would also give the model the Close price of the next day, this is the value that we want our model to learn to predict.

The training of the model involves adjusting the weights of the variables Stock market prediction using aritificial neural all the different neurons present in the neural network. The cost function, as the name suggests is the cost of making a prediction using the neural network. There are many cost functions that are used in practice, the most popular one is computed as half of the sum of squared differences of the actual and predicted values for the training dataset.

The way the neural network trains itself is by first computing the cost function for the train dataset for a given set of weights for the neurons. Then it goes back and adjusts the weights, followed by computing the cost function for the train dataset based on the new weights. The process of sending the errors back to the network for adjusting the weights is called backpropagation.

This is repeated several times till the cost function has been minimized. We will look at how the weights are adjusted and the cost function is minimized in more detail next. Gradient Descent The weights are adjusted to minimize the cost function. One way to do this is through brute force.

Suppose we take values for the weights, and evaluate the cost function for these values. When we plot the graph of the cost function, we will arrive at a graph as shown below.

The best value for weights would be the cost function corresponding to the minima of this graph. This approach could be successful for a neural network involving a single weight which needs to be optimized. However, as the number of weights to be adjusted and the number of hidden layers increases, the number of computations required will increase drastically.

For this reason, it is essential to develop a better, faster methodology for computing the weights of the neural network. This process is called Gradient Descent.

## Stock market prediction using Neuroph neural networks | technobium

Gradient descent involves analyzing the slope of the curve of the cost function. Based on the slope we adjust the weights, to minimize the cost function in steps rather than computing the values for all possible combinations.

The visualization of Gradient descent is shown in the diagrams below. The first plot is a single value of weights and hence is two dimensional. It can be seen that the red ball moves in a zig-zag pattern to arrive at the minimum of the cost function.

In the second diagram, we have to adjust two weights in order to minimize the cost function. Therefore, we can visualize it as a contour, as shown in the graph, where we are moving in the direction of the steepest slope, in order to reach the minima in the shortest duration.

With this approach, we do not have to do many computations and as a result, the computations do not take very long, making the training of the model a feasible task. Gradient descent can be done in three possible ways, batch gradient descent, stochastic gradient descent and mini-batch gradient descent.

In batch gradient descent, the cost function is computed by summing all the individual cost functions in the training dataset and then computing the slope and adjusting the weights. In stochastic gradient descent, the slope of the cost function and the adjustments of weights are done after each data entry in the train dataset.

This is extremely useful to avoid getting stuck at a local minima if the curve of the cost function is not strictly convex. Each time you run the stochastic gradient descent, the process to arrive at the global minima will be different.

Batch gradient descent may result in getting stuck with a suboptimal result if it stops at local minima. The third type is the mini-batch gradient descent, which is a combination of the batch and stochastic methods.

## Associated Data

Here, we create different batches by clubbing together multiple data entries in one batch. This essentially results in implementing the stochastic gradient descent on bigger batches of data entries in the train dataset.Understanding Stock Market Prediction Using Artificial Neural Networks and Their Adaptations.

Tali Soroker is a Financial Analyst at I Know rutadeltambor.com graduated from Northeastern University with a Bachelor degree in Mathematics. Forecasting Of Indian Stock Market Index Using Artificial Neural Network. Page 2 of 8 ABSTRACT The objective of the study is to present the use of artificial neural .

Using artificial neural network models in stock market index prediction. G. KayakutluForecasting stock exchange movements using artificial neural network models and hybrid models.

Zhongzhi Shi, E.

## Stock Market Predicition with Feed-Forward Neural Networks

Mercier-Laurent, W. LenanStock market prediction of S& P via combination of improved BCO approach and BP neural network. May 19,  · The main contribution of this study is the ability to predict the direction of the next day’s price of the Japanese stock market index by using an optimized artificial neural network (ANN) model.

To improve the prediction accuracy of the trend of the stock market index in the future, we optimize the ANN model using genetic algorithms (GA). 14 Stock Market Prediction using Artificial Neural Networks. Case Study of TAL1T, Nasdaq OMX Baltic Stock Stock Market Prediction using Artificial Neural Networks.

Stock market prediction is just one of the usages of artificial neural networks. This interesting machine learning technique which is inspired by the human brain was succesfully used in fields like: medical diagnosis, industrial process control, sales forecasting, credit ranking, employee selection and hiring, employee retention or game.

Stock market index prediction using artificial neural network - ScienceDirect