Performance analysis of deep learning and statistical models on enhancing stock market portfolio

: Time series data is considered very useful in the domains of business, finance and economics. Stock market data specifically is generated at high volumes and excessively used for forecasting purposes for gaining wealth. The problem is challenging due to the dynamic nature of stock market fluctuations. Conventional techniques for prediction of next lag of time series data have been successful to an extent with statistical algorithms such as Exponential Smoothing and Autoregressive Integrated Moving Average (ARIMA). With the advent of deep learning architectures and advanced computational processors, we analyze the performance of such techniques for stock market forecasting. The paper presents performance comparison of Exponential Smoothing, ARIMA, Vanilla LSTMs and Stacked LSTM models. The empirical analysis concludes the superior performance of deep learning techniques with RMSE score as low as 3.208 on daily closing price stock data for a period of ten years. Furthermore, we also propose a portfolio optimization method to calculate returns and maintain profits while trading in stock market. The development process should go through relevant data selection, data preprocessing to eliminate noise and missing values to create the prediction model. Study of the right algorithm, accompanied by model assessment. The study presented in this paper uses the LSTM to forecast the stock market exchange activity. The findings indicate that advanced versions of LSTM appear to provide more detailed results than standard algorithms. It can be shown that this paradigm is efficient for both private traders and corporate investors. They will obtain the potential actions of the movement of consumer rates and take the correct decision to make a profit. Different characteristics and facets of the industry should be addressed in future work to make forecasts more reliable. We also plan to use consumer feedback on the product to forecast the market shift.

The dimensions of technical investigation were clustered into sentiment, flow-of-funds, raw data, trend, momentum, volume, period, and instability [2]. The actions of different market players are reflected by sentiment. Flow-of-funds is a form of metric used to analyze the financial condition of different buyers to pre-evaluate their intensity of purchasing and selling securities, so suitable tactics, such as short squeeze, may be implemented. Pattern and movement are instances of market-based metrics, pattern is used to chart stock market volatility, while movement is used to measure the pace of price action and decide if a stock price trend turnaround is about to take place. Volume is a metric that represents both buyers and sellers' appetite for investment, and it is also a foundation for forecasting trends in stock prices. The process is grounded on the idea that in the context of a long phase of more than 10 years comprising brief periods of a few days or weeks, inventory values differ regularly. Lastly, instability is also used to analyze the magnitude of stock market variations and to measure vulnerability and to define the amount of provision and confrontation. Opinions could trigger short-term market volatility that in turn create disconnections amongst the valuation and actual value of the shares of a firm, but over long stretches of time, the measuring system kicks in when the dynamics of a company inevitably cause its shares to agree on the value and market price. A notable example arises from Nobel Laureate Robert Shiller, who found that stock markets are highly unpredictable over the short term, but their price-to-earnings over long stretches are somewhat stable [3]. In analyzing the economic situation, Diamond [4] clarified what returns to imagine from capital markets and indicated that returns might be considerably smaller in the future. Shiller et al. [5] also indicated that markets were overvalued, and at some moment the bubble would break.
Statistical methods, often assuming linearity, stationarity, and normality, offered a way to estimate and forecast stocks before the introduction of machine learning techniques. A systematic array of figures like daily revenue amounts and stock values is the time series of financial sector research [6]. The Auto-Regressive Moving Average (ARMA), the Auto-Regressive Integrated Moving Average (ARIMA), the Generalized Autoregressive Conditional Heteroskedastic (GARCH) volatility, and the Smooth Transition Autoregressive (ARIMA) are among category of quantitative methods that fell into the classification of univariate research owing to the usage of time series as input variables, according to [7].
The ARIMA model is a commonly used stock price valuation methodology [8]. ARMA integrates Auto-Regressive (AR) frameworks that aim to understand the movement and mean reversion patterns commonly found in markets and Moving Average (MA) methods that seek to catch the time series disturbances. The ARMA model's major drawback is that volatility clustering, a key scientific phenomenon in several time series analysis, is not considered. ARIMA is a logical addition of the ARMA deterministic model, and a non-stationary series can be reduced to a stationary series. In order to predict future stages, the ARIMA [9] is adapted to time series results. Furthermore, Zhong and Enke define another category of statistical methods, including Linear ISSN: 2349-7300
In forecasting capital markets, deep learning has been widely analyzed for its promise [10]. Tasks for deep learning are commonly divided into supervised and unsupervised learning. A collection of annotated input data for training the program and obtained output data are required in supervised learning. However, only the unlabeled or detected performance data is usable in unsupervised learning. The objective of supervised learning is to create a training model to transform data automatically to the output data given. The computer must have trained to see an input data point as conditioned and to estimate the predicted performance. The goal of unsupervised learning is to train an algorithm to find in the given dataset a pattern, association, or cluster. It may also serve as a precursor for supervised activities in learning [11]. In stock price path estimation, several algorithms have been used.
Effective algorithms such as Random Forest, logistic regression, and neural networks have substituted simpler methods such as the single decision tree, discriminant analysis, and Naïve Bayes [12]. Multivariate analysis by the use of Artificial Neural Networks (ANNs) has become a powerful and common analysis method in financial sector analysis with nonlinear, data-driven, and easy-togeneralize features. In time series prediction, deep nonlinear neural network topologies have recently begun to draw interest [13].
Another method which has recently been used for stock market analysis is sentiment analysis [14]. Via automated processing of text corpuses such as news feeds or tweets related to financial markets and public corporations, it is the method of forecasting stock patterns. The techniques of emotion classification are primarily divided into a data mining technique and a lexicon-based methodology, additionally separated through dictionary or corpus-based techniques. The ability of using sentiment indicators from an unstructured text to increase the efficacy of models for forecasting volatility patterns in the stock market was shown by [15].
In this paper, we target and categorize the performance of two domains of research as mention above i.e. statistical techniques and deep learning techniques which have rose to prominence drastically in the last decade. We take into account multiple stocks with variable dataset characteristics to check the error in each technique over a generalized set of trends.

Related Work:
Latest developments in market analysis and forecasting fall into four categories: statistical, pattern recognition, deep learning (ML), and analysis of sentiments. Most of these categories fall into the wider technical analysis framework, although there are several artificial learning methods that often merge broader technical analysis concepts with quantitative evaluation techniques to stock market forecasting. A taxonomy of common stock prediction techniques is shown in Fig. 1. These methods have gained traction and have in the recent past demonstrated positive results in the field of stock analysis.
In much of the stock analysis literature, Devi et al. [16] attempted to resolve certain problems not actually discussed, like the dimensionality and expectation of an immature trader. The authors effectively use the past data for the training of the ARIMA model of four Indian midcap firms. To estimate the accuracy of the model, the Akaike Information Criterion Bayesian Information Criterion (AICBIC) test was introduced.

Fig. 1. Stock market prediction techniques
Checking the formula on growth stocks and the Nifty 50 Index revealed how, due to low failure and variability, the Nifty Index is the path to go for novice traders. The detailed method of constructing ARIMA models is discussed by Ariyo et al. [17]. The authors chose parameters such as the standard regression error, modified R-square, and Bayesian knowledge criteria to define the optimal model from all the ARIMA models produced. Based on the above parameters, the best ARIMA model did a competent job of forecasting Nokia and Zenith Bank's stock prices. In addition, he made a good argument not to compromise ARIMA models' forces in terms of stock assessment as it can perform relatively well for short-term prediction against the new forecasting methods available currently. In order to forecast the stock price of Tata Consulting Services stock based on five characteristics, i.e. free, large, low, near price and value, Bhuriya et al. [18] introduced regression model variants. The article describes the efficiency of the regression ISSN: 2349-7300 IJIRMPS2006003 Website : www.ijirmps.org Email : editor@ijirmps.org 22 models of the linear, polynomial, and radial basis function (RBF) based on the confidence values of the outcomes expected. Furthermore, he also stated that the model of linear regression surpassed the other strategies and obtained a 0.97 confidence score.
For stock price prediction, several deep learning strategies have been explored. Two commonly used machine learning algorithms are ANN and Support Vector Regression (SVR) to forecast stock value and stock market index values [19]. In order to forecast long-term stock price trend, the authors used five times double cross-validation and Area Under the Curve (AUC) as an output metric and reported Random Forest as the top algorithm. Milosevic [20] suggested a long-term stock market price forecast strategy through a classification task where a stock is 'good' if the stock price rises by 10 percent in a year, otherwise it is 'bad'. In addition, he conducted a manual selection of functions, picked 11 appropriate fundamental ratios, and applied multiple algorithms for machine learning to market prediction. It follows that the best F-Score of 0.751 towards techniques such as SVM and Naïve Bayes was obtained by Random Forest. The eXtreme Gradient Boosting is another method that has drawn the interest of data scientists (XGBoost). The trajectory of stocks based on the XGBoost algorithm was forecast by Dey et al. [21] using technical indicators as characteristics. The findings reveal that XGBoost beats the other efficiency approaches for long-term estimation of Apple and Yahoo inventories, reaching a precision of 87-99 percent.
A sentiment analysis model based on Twitter data was introduced by Pagolu et al. [22]. To evaluate the polarity of opinions behind the tweets, the authors used N-gram and Word2vec (2-layer NN). They reached a precision of around 70 percent and noted that 71.82 percent was the association between price and opinion. The researchers indicated that the model's accuracy would improve with more details. The research by Xu and Cohen [23] introducing StockNet, a neural network architecture for forecasting stock market movement from tweets and historical stock prices, involves other methods using natural language and social media data. The model reveals a state-of-the-art efficiency and adds repeated, continuing latent variables for improved stochasticity management.

Methodology:
The Exponential smoothing is a digital forecasting model that exponentially weighted historical data in order to have larger scales in the moving average of the most current data. In too many prediction cases, the exponential smoothing approach has been used as a very useful method for many years. Methods of prediction are a mathematical method to evaluate what is likely to happen in the future, relying on applicable historical evidence. In order to provide a structured, pragmatic way of thought, workmanship and strategies to provide more trust, this technique is very helpful in carrying out an empirical approach to the actions or trends of past results. Holt Winter Additive is the forecasting mechanism used in this prediction. The method of Holt Winters forecasting is a mixture of the method of Holt and the method of Winters, used for forecasting if the data has a seasonal and pattern portion. Three smoothing equations, namely the overall smoothing equation, the refinement of patterns and the seasonal smoothing equations, are the basis of the Holt Winters process. We implemented the additive method with the help of following equations: Smoothing Trend: Smoothing Seasonal: Forecast: II.

ARIMA Model
The conventional ARIMA method becomes unfeasible, and when periodic modification order is high or its diagnostics fail to specify that time sequences are static after seasonal amendment, it is in many examples difficult to conclude a model. In such cases, the static parameters of the classical ARIMA model are measured to be the main constraint of high seasonal variable demand forecasting. Another constraint of the classical ARIMA approach is that the best fit model for a data series requires a large number of observations to be determined. An ARIMA model is labelled as an ARIMA model (p, d, q), in which the number of autoregressive terms is p, the number of differences is d and the number of moving averages is q.

Autoregressive process:
Autoregressive models assume that is a linear function of the preceding values and is given by equation: Each observation consists of a random component (random shock, ) and a linear combination of the previous observations. 1 in this equation is the self-regression coefficient.

Integrated process:
The behavior of the time series may be affected by the cumulative effect of some processes.
where the random perturbation is a white noise.

Moving average process:
The current value of a moving averaging process is a linear grouping of the current disruption with one or more previous perturbations. The moving average order indicates the number of previous periods embedded in the current value. Thus, a moving average is defined by equation: III. Long short-term memory Recurring neural networks, which have a disappearing gradient problem, are an improvement over the general recurrent neural networks. As stated by Hochreiter et al. [24], by incorporating gating functions into their state dynamics, LSTM RNNs address the vanishing gradient issue commonly found in ordinary recurrent neural networks. An LSTM maintains a hidden vector h and a memory vector m for controlling state updates and outputs at each time stage. More concretely, Graves et al. [25] define the computation at time step t as follows: where is the logistic sigmoid function, ⊙ represents elementwise multiplication, , , , are recurrent weight matrices and , , , are projection matrices. Although LSTMs have the ability to learn sequence temporal dependencies, in long sequences the have difficulty with long term dependencies.

IV. Stacked LSTMs
With the growing advancement of computer processors and a range of deep neural networks being implemented, learning algorithms have demonstrated their strong self-learning capabilities. For a deep LSTM-based neural network, stacking many LSTM layers is indeed important. The key principle of the deep neural network is that several nonlinear levels of mapping among endpoints are used for learning features numerically. The performance of the hidden layer is not only generated forward over time, as seen in Figure 2, but also used as one of the inputs of the next hidden layer of LSTM.

IJIRMPS2006003
Website : www.ijirmps.org Email : editor@ijirmps.org 24 The advantages of stacked LSTM over vanilla LSTM architecture are due to: (1) Stacking LSTM layers helps the data to predict raw temporal signal characteristics from various aspects at each point of time (2) Model parameters are spread through expanding memory capacity over the entire space of the model, allowing the model to en hance convergence and optimise dynamical raw data processes.
(3) The LSTM neural network has a time stage structure to recall memories. As for 1-D data analysis, a restricted signal can be converted into a matrix of input-dimensional rows and time-stage columns. It is apparent that LSTM emulates the memory process as humans do which ensures that it can instantly memorize a signal item by item and collect substantial raw temporal signal inherent in it. A deep neural LSTM network can thus help improve the entire mechanism.
V. Performance metrics: To evaluate the performance of the proposed nonlinear combination model, mean absolute error (MAE), root mean square error (RMSE) and mean absolute percentage error (MAPE) are used defined as follows:

Results:
The results computed from the models mentioned above are observed in this section and the performance is analyzed with the help of common evaluation metrics. The data for the period of December 2007 to Jan 2018 for the aforementioned stocks can be seen in Fig. 3.  The ARIMA model gives significantly improved results as compared to the exponential smoothing. The stock data are initially checked for stationarity using the Augmented Dickey Fuller test which present null hypothesis for all four stocks. This leads to using first difference on the data for applying ARIMA model. The values for p, d and q are generated using Auto ARIMA to compute multiple combinations leading to best AIC and BIC scores for implementation. As show in Fig. 5  As it is difficult to analyze the performance of ARIMA and Stacked LSTM architecture, we look into the RMSE, MAE and MAPE scores as shown in Table. I for all the techniques which helps in inferring the success of each forecasting model. As shown below, although ARIMA provides excellent forecasting results, the stacked LSTM model gives a lesser RMSE score. Further taking into consideration, the interdependence of stock market data on past data points, LSTM architectures provide an edge over the statistical techniques.

Discussion & Conclusion:
When the nature of the economy based on rising and declining asset values has been foreseen and recognized by an investor. In the trading plan, the next issue is how much of its share it should allocate for various stocks in its portfolio [27]. A very important factor to consider is the adjustment of the ratio of capital in stock market to achieve benefit. The optimization of Markowitz's portfolio [28] is solely based on a statistical basis and provides a very satisfying outcome in the distribution of one's market share [29]. As shown in equation 17, return can be calculated as: The variance of return, the covariance matrix of return, weights and sum should be 1. We then adjust the weight to gain profit and select the portfolio which has max Sharpe ratio and in volatility given by equation [18][19][20]. By performing Markowitz Portfolio Optimization technique, we can understand how much we must invest our money in a market. The development process should go through relevant data selection, data preprocessing to eliminate noise and missing values to create the prediction model. Study of the right algorithm, accompanied by model assessment. The study presented in this paper uses the LSTM to forecast the stock market exchange activity. The findings indicate that advanced versions of LSTM appear to provide more detailed results than standard algorithms. It can be shown that this paradigm is efficient for both private traders and corporate investors. They will obtain the potential actions of the movement of consumer rates and take the correct decision to make a profit. Different characteristics and facets of the industry should be addressed in future work to make forecasts more reliable. We also plan to use consumer feedback on the product to forecast the market shift.