key: cord-0044129-904t1wy8 authors: Serrano, Will title: The Random Neural Network in Price Predictions date: 2020-05-06 journal: Artificial Intelligence Applications and Innovations DOI: 10.1007/978-3-030-49161-1_26 sha: eccf32f12a4820ff01aa17476d392e12db040899 doc_id: 44129 cord_uid: 904t1wy8 Everybody likes to make a good prediction, in particular, when some sort of personal investment is involved in terms of finance, energy or time. The difficulty is to make a prediction that optimises the reward obtained from the original contribution; this is even more important when investments are the core service offered by a business or pension fund generated by monthly contributions. The complexity of finance is that the human predictor may have other interests or bias than the human investor, the trust between predictor and investor will never be completely established as the investor will never know if the predictor has generated, intentionally or unintentionally, the optimum possible reward. This paper presents the Random Neural Network in recurrent configuration that makes predictions on time series data, specifically, prices. The biological model inspired by the brain structure and neural interconnections makes predictions entirely on previous data from the time series rather than predictions based on several uncorrelated inputs. The model is validated against the property, stock and Fintech market: 1) UK property prices, 2) stock markets indice prices, 3) cryptocurrency prices. Experimental results show that the proposed method makes accurate predictions on different investment portfolios. Everybody likes to make a good prediction, this skill is not only a sign of superior wisdom but also exceptional common sense, both acquired from an extensive experience in a mature life through plenty of decisions, rewards and punishments. The traditional prediction model has always been that the older a person is, the larger experience the predictor should have acquired therefore the best prediction would be made by the greater wisdom or common sense. Accurate predictions are more relevant when some sort of personal investment is involved in terms of finance, energy or time. The challenge is to make a prediction that optimises the reward from the original contribution; the reason is simple. This traditional prediction model has three flaws: 1) the predictor may have a different economic interest or bias than the investor therefore not providing intentionally the optimum reward. At the end, the reason the investor uses the predictor is due to its limited knowledge or time to make the prediction itself. 2) Artificial Intelligence and Machine Learning increase the learning experience as they are capable to memorise and store larger and more data feeds for longer time than a human could do during its life spam. Artificial Intelligence therefore makes faster predictions than humans and also removes the predictor bias and service fees. In addition, Machine Learning accepts and learns from its own mistakes. 3) Finally, the traditional model does not efficiently work when there are only a few predictors for all the investors as the reward form investments can be standardised or the market can be manipulated. In order to reduce prediction risks, the predictor approach has always been the "investment portfolio diversification" concept that splits the initial investment into numerous smaller portions and invest them into all possible options therefore averaging the returns. As the predictor charges a fee for its services, then the investor may as well diversify its investments itself or use Artificial Intelligence to automate the process. Artificial Neural Networks are the biological model of the human brain that emulate neurons and their connections developed in numerous configurations such a Deep Learning [1] and Reservoir Computing [2] with a large number of different learning algorithms such as Gradient Descent and Reinforcement Learning. The key concept is that Artificial Neural Networks must achieve stability in their firing patterns during the learning process, similar to humans, Artificial Intelligence requires time to learn from experiences. This paper presents the Random Neural Network in feedforward configuration that makes predictions on time series data, in particular, prices. The biological model makes predictions entirely on previous data from the same variable series rather than predictions based on several uncorrelated parameters. This proposed model could also be applied to make predictions based on predictions rather than real and factual data as the inputs could also be predicted. The Random Neural Network model is validated against the prices of three key markets: -Property market: General, House and Flat Prices; -Stock market: FTSE100, NASDAQ, NIKKEI225 and SZSE; -Fintech market: Bitcoin, Ethereum and Ripple. The metric used is the Root Mean Square Error (RMSE) as it penalises large errors. This research is based on java software in an Eclipse platform due its data integration with third party APIs. This paper explores and analyses the number of learning iterations and the optimum memory to make the best prediction that balances memory with recency. Section 2 on this paper presents the related work for this research based on neural networks for price predictions. Section 3 presents the mathematical model of the Random Neural Network for price predictions including the its learning algorithm based on a sling window. Section 4 provides the validation and experimental results. Finally, conclusions are shared on Sect. 5. Artificial Intelligence and Neural Networks have already been applied as predictions models. The novelty and innovation presented on this paper is the use of the Random Neural Network as a price prediction algorithm. An Artificial Intelligence decision support system guides investors to buy and sell stocks based on financial data listed on the BSE/NSE markets [3] . The mathematical model uses a three multilayer perceptron to predict stock price based on the fundamental value and intrinsic stock value such as investment valuation, cash flow indicator, liquidity measurement, profitability indicator and debt. Five neural network models based on back propagation neural network, radial basis function neural network, general regression neural network, support vector machine regression and least squares support vector machine regression make price prediction on three individual stocks: Bank of China, Vanke A and Kweichou Moutai [4] . The back propagation neural network outperforms in terms of mean square error and average absolute percentage error criteria for different activation functions (linear, polynomial, sigmoid and radial basis). A two-layer feed forward neural network with sigmoid hidden neurons and linear output neurons predicts next day closing in Dow Jones stock market [5] . Three algorithms Levenberg-Marquardt algorithm, bayesian regularization and the scaled conjugate gradient algorithm are trained using several stock parameters such as open, high, low, close price and volume. The bayesian regularization has the best performance whereas the Levenberg-Marquardt algorithm requires less iterations to train. Any time series function can be modelled based on four systematic components: base level, trend, seasonality and noise. A Long Short-Term Memory (LSTM) network predict the price of Bitcoin based on a regression model [6] with an Adam optimization and the tanh activation function. The LSTM uses 35 days of previous data in case of monthly prediction and 65 days for the two month prediction. A model that forecasts daily closing price series of Bitcoin uses data on prices and volumes of prior days [7] . The model compares single linear regression for univariate series forecast based on only closing prices, multi linear regression model for multivariate series based on both price and volume data, a multilayer perceptron and a LSTM Network against data from Intel, National Bank and Microsoft daily NASDAQ closing prices. A pricing predict model for options in bitcoins and cryptocurrencies is based on a backpropagation neural network where classical pricing models (trinomial tree, Monte Carlo simulation and explicit finite difference method) are used as input layers [8] . The neural network outperforms in terms of prediction accuracy for financial data based on the 15-days historical volatility for the Bitcoin index and the 2-months Libor interest rate due to its adaptation to the complexity and non-linearity of the option and cryptocurrency market. The relationship between the next day binary change in the price of Bitcoin and its features such as transaction volume, cost per transaction is analysed by a neural Network with a Genetic Algorithm [9] . The network is formed of five multi-layered perceptrons trained with Levenberg-Marquardt supervised learning algorithm and hyperbolic tangent activation function that predicts the next day direction given a set of approximately 200 features. Deep neural networks combine the advantages of deep learning and neural networks to predict and analyse data within the nonlinear and time-dependent financial model. A deep learning method based on Convolutional Neural Network predicts the stock price movement of Chinese stock market based on the opening price, high price, low price, closing price and volume of the stock [10] . Financial data is considered as one-dimensional time series generated by the projection of a chaotic system composed of multiple factors into the time dimension following a phase-space reconstruction method [11] whereas the deep neural network model is based on a LSTM network with three hidden layers, each of which contains 32 memory cells. The model is validated against several prediction models such as the conventional Autoregressive Integrated Moving Average linear analytical method, the conventional Support Vector Regression machine learning method, a deep Multi Layer Perceptron model and deep LSTM model data for six stock indices for various market environments: the S&P 500, the Dow Jones industrial average, the Nikkei 225, the Hang Seng index, the China Securities index 300 and the ChiNext index. A study of three neural networks with deep learning algorithms: convolutional neural networks, LSTM networks and a combination of both that uses 1D convolutional layers as preprocessing step to extract and reduce the key features are analysed for a stock price prediction application [12] . The deep learning models are based on 40 and 32 memory cells respectively with a RELU activation function and trained with the last five days of stock price data which includes Open, High, Low, and Close price values. A deep recurrent neural network model with multiple inputs and multiple outputs based on LSTM network [13] . The deep learning structure simultaneously predicts the opening price, the lowest price and the highest price of the Shanghai composite index, PetroChina and ZTE with an Adam optimization algorithm. Deep learning models based on multi-layer perceptron, dynamic artificial neural network and the hybrid neural networks which use generalized autoregressive conditional heteroscedasticity are analysed in the NASDAQ Stock Exchange [14] . An adversarial training that improves the generalisation of a neural network prediction model by adding intentional perturbations to simulate the stochasticity of the price variable [15] is validated on 88 high trade volume stocks in NASDAQ and NYSE markets. The neural network is an attentive LSTM with four components: feature mapping, LSTM, temporal attention and prediction. A three-stage hybrid forecasting stock market index model is composed of a self-organizing map that reduces the size of the original data, a Genetic Algorithm that selects relevant features and a backpropagation neural network that predicts future stock price based on features of the previous day [16] . The model uses ten technical indicators as inputs where the model is applied to three indices (S&P 500, IBM and NASDAQ) and validated against support vector regression and random forest algorithms. A discrete wavelet transform that removes noise within the data based on frequency components of financial time series versus the Fourier transform is combined with a recurrent neural network trained via the Back Propagation Through Time (BPTT) and the Adam optimisation method to predict Saudi stock market [17] . The Random Neural Network was introduced in [18] and many of its properties have been developed in [19] . It is a spiking stochastic model which can be used as either a feedforward or recurrent network (Fig. 1) . The Random Neural Network consists on n-neurons. The state of the n neuron network at time t is represented by the vector of non-negative integers Neurons interact with each other by interchanging signals in the form of spikes of unit amplitude: -A positive spike is interpreted as an excitation signal because it increases by one unit the potential of the receiving neuron m, K m (t + ) = K m (t) + 1; -A negative spike is interpreted as inhibition signal decreasing by one unit the potential of the receiving neuron m, K m (t + ) = K m (t) − 1, or has no effect if the potential is already zero, K m (t) = 0. Each neuron accumulates signals and it will fire if its potential is positive. Firing will occur at random and spikes will be sent out at rate r(i) with independent, identically and exponentially distributed inter-spike intervals. The Random Neural Network excitatory and inhibitory weight parameters w + (j, i) and w − (j, i), respectively are directly related to the r(i) and the p + (i, j), p − (i, j), and are expressed as: Thus information in this model is transmitted by the rate or frequency at which spikes travel. Each neuron i, if it is excited, behaves as a frequency modulator emitting spikes at rate w(i, j) = w + (i, j) + w − (i, j) to neuron j (Fig. 2) . This network model has a product form solution; the network's stationary probability distribution is the product of the marginal probabilities of the state of each neuron [20] . Let's define q i as the probability neuron i is excited: where the λ + (i), λ − (i) for i = 1, . . . , n satisfy the system of nonlinear simultaneous equations: The Random Neural Network learning algorithm [21] is based on gradient descent of a quadratic error function. The backpropagation model requires the solution of n linear and n nonlinear equations each time the n neuron network learns a new input and output pair. Gradient Descent learning algorithm optimizes the network weight parameters w in order to learn a set of k input-output pairs (i,y) where successive inputs are denoted i = i 1 , ..., i k and the successive desired outputs are represented y = y 1 , ..., y k . The desired output vectors are approximated by minimizing the cost function E k : where y i represents the desired output. Each of the n neurons of the network is considered as an output neuron. The input i k extracts the S window values of the time series x(t − 1 − s) at time t for s = 1, . . . , S. The output y k corresponds to x(t). The network learns i k and y k . As time increases, t = t + 1 the model includes the newest value, removes its oldest value, learns the new input and finally predicts the next value at t + 2. This method iterates for the entire time series data (Fig. 3 ): 1. time t, the Random Neural Network learns i k and y k based on x(t − 1 − s) and x(t) respectively. 2. time t, the model window slides one unit to include (x(t) and predict x(t + 1) 3. time t + 1, the model learns x(t + 1) 4. time t + n, the model window slides n-1 units to include x(t + n) and predict x(t + n + 1) 5. time t + n + 1, the model learns x(t + n + 1). The Random Neural Network in price predictions model is validated against three uncorrelated markets where real market values are shown on Fig. 4 : -Property market: General, House and Flat Prices; -Stock market: FTSE100, NASDAQ, NIKKEI225 and SZSE; -Fintech market: Bitcoin, Ethereum and Ripple. The validation exercise covers value of S for the optimum Window that makes the best prediction and balance between memory with recency. The error between the predicted value and the current value is calculated following the Root Mean Square Error (RMSE) for a window of five, ten and twenty input neurons that represent low, medium and high memory respectively. The property market validation covers general house prices, detached houses and flats based on the datasets obtained from Land Registry where key parameters, including statistical information, are shown on Table. 1. The period of the data points is monthly rather than daily therefore the standard deviation is reasonable high for the general price values. The validation results presented on Table 2 show that additional memory does not reduce the error. The RMSE assessment covers two current values: the real and the normalised value [min 0.0, max 1.0]. The experimental results show RMSE figures differ significantly from real to normalised values. The stock market validation covers British FSTE 100, American NASDAQ, Chinese SZSE and Japanese Nikkei 225 based on the datasets obtained from www. uk.investing.com where key parameters are shown on Table 3 . The standard deviation for this market is lower than the previous validation. The validation results shown on Table 4 represent similar trend as the previous validation; additional memory does not reduce the error and RMSE figures differ significantly from real to normalised values. The real error of the stock market validation is lesser than the Property market validation due to its reduced standard deviation. The Fintech market validation covers Bitcoin, Ethereum and Ripple cryptocurrency prices based on the datasets from www.uk.investing.com where key parameters are shown on Table 5 . The standard deviation for the Fintech market is quite high as the Bitcoin values have a large range whereas Ethereum and Ripple data points are reduced. Validation results are shown on Table 6 . The Fintech market validation also confirms the trends of the previous validations. The real error is dependent of the maximum and minimum data point range Ripple predictions have the lowest error as the real values have very limited range. This paper has presented the Random Neural Network in back propagation configuration that makes predictions on time series data, in particular, prices. The biological model inspired by the brain structure and neural interconnections makes predictions entirely on previous data from the same variable rather than predictions based on several uncorrelated parameters. The proposed model has been validated against the property, stock and Fintech market: 1) UK property prices, 2) Stock markets indice prices, 3) Cryptocurrency prices. Experimental results show that the proposed method makes accurate predictions on different investment portfolios and the effect of the memory, or input neurons, does not have a major impact on the quality of the prediction. Future work will expand this research in two aspects: the addition of uncorrelated variables into input layer and the increment of the number of output neurons. The effect from these variations to the model will be analysed based on the enhancement of the quality prediction. Genetic and deep learning clusters based on neural networks for management decision structures An overview of reservoir computing: theory, applications, and implementations Design of a financial decision support system based on artificial neural networks for stock price prediction Neural networks for stock price prediction Neural networks to predict stock market price Bitcoin price prediction with neural networks Forecasting Bitcoin closing price series using linear regression and neural networks models Neural network models for bitcoin option pricing front Bitcoin price prediction using ensembles of neural networks Stock prediction using convolutional neural network Stock price prediction based on deep neural networks Stock price prediction on daily stock data using deep neural networks Study on the prediction of stock price based on the associated network model of LSTM Using artificial neural network models in stock market index prediction Enhancing stock movement prediction with adversarial training Stock market price prediction system using neural networks and genetic algorithm A recurrent neural network and a discrete wavelet transform to predict the saudi stock price trends Random neural networks with negative and positive signals and product form solution G-networks with triggered customer movement Stability of the random neural network model Learning in the recurrent random neural network