# Stock Market Crisis Forecasting Using Neural Networks with Input Factor Selection
## 4 Model Building with Neural Networks
### Input Factor Selection Process
#### 4.2.1 Ranking of the Input Factors  
There are two possible ways to design such a ranking procedure: either by starting with a model which includes all input factors and by successively pruning variables which contribute the least to the predictive power, or by starting with an empty model and adding the most promising input factors successively. The method of reducing the model with all input factors requires us to fit a very large model to start with. Given the limited horizon of the time series, such a model might suffer from overfitting. Therefore, we proceed by successively adding variables to a model, which is empty in the beginning. In addition, this approach provides the possibility of starting with a set of predetermined input factors, which is then extended. We use this property for an additional model build-up, in which we start with the set of input factors from [15] and extend this set further. To create the ranking of the input factors, we proceed in the following way: The set of the time series of the input factors is given by \(\{(X_{1,t})_{t=1,\ldots,T},\ldots,(X_{N,t})_{t=1,\ldots,T}\}\). For simplicity, we identify the \(N\) input factors with the set of their indices \(\{1,\ldots,N\}\) and denote the set of input factors which is already chosen for the model by \(S\subset\{1,\ldots,N\}\). In the beginning, we set \(S=\emptyset\) for the approach which starts with an empty model. If we have predefined input factors, which shall definitely be part of the final model, we set \(S\) to be the corresponding subset of \(\{1,\ldots,N\}\). The ranking is then done in the following way:  
1. For each \(i\in\{1,\ldots,N\}\backslash S\), we fit a neural network with input factors \(S\cup\{i\}\).
2. The input factor which leads to the model with the lowest value of the loss function in the previous step is added to \(S\).  
These steps are repeated until \(S=\{1,\ldots,N\}\), i.e., until all input factors are added to the model. The ranking of the input factors is then determined as the order in which the factors were added.  
While our approach avoids over-fitting due to too many input factors, it does not completely solve the problem of running into local minima when training the neural networks. Therefore, we propose to improve the credibility and stability of the model by combining it with an ensemble method. This aggregation method often delivers improved accuracy over an individual model and provides better insight into the dataset and the problem (see, e.g., [26; 27; 28]). While ensemble methods were originally designed to aggregate the output of separately trained models to form one unified prediction (see, e.g., [29]), we adapt the concept to the task of variable selection. We include this idea by conducting the selection process for several random seeds. The total ranking of an input factor is then the average of its rankings across all seeds. We denote the total ranking of input factor \(X_{n}\) by \(\Phi_{n}\). Then, we sort and re-index the input factors in ascending order, such that:  
\[\Phi_{1^{*}}\leq\Phi_{2^{*}}\leq\ldots\leq\Phi_{N^{*}}. \tag{12}\]  
Using this process, we have determined an order in which the input factors should be added to the model, where the input factor with the lowest total ranking number is the one to be added first. However, in the end, we want to obtain a model which does not include all input factors. We deal with this aspect in the following section.