For training the neural network, data needs to be appropriately transformed. The problem being solved falls in the supervised learning class, where for each set of parameters describing an example, an output value for this example is also given. Thus, for each example, the neural network compares its assumption with the true value of the output. It minimizes its error function by a technique such as the “Gradient descent” method, adjusting its weights matrix coefficients.
The loaded data contains the entire sequence of days for which there is information about the close price and estimates of the world news, but this data is not in the proper form for machine learning. Each row of data must be matched with a value reflecting what the correct output of the prediction should be. In this case the correct output is the closing price for the next day. After performing transformation on the data, it is in the form as shown below. An example ,representing one day, has values of 7725.43, 7.16717, 5.85146 and 5.00671. The correct output is 7603.99 – close price for the next day.