## 5 Experimental Part  
### Methodology  
Different hybrid models using TA, FA, and ANN were compared with a purely ANN-based approach, as well as to find the best solution for short-term CLOSE value prediction. For this purpose, specialized software was designed using Java and an Encg library, which allows both for stock data collection and pre-processing and also for training and testing automatically a large number of different hybrid model structures. In our previous study [22], the choice of ANN input variables was made on the basis of expert knowledge. A small number of input variables were selected in order to design sufficiently accurate yet compact models. In the present work, new algorithms were implemented to create different hybrid models with ANNs of two-layer MLP type (see Figure 2). A large number of  
Figure 2: Example of multilayer perceptron (MLP) network featuring 4 inputs, 7 neurons in the hidden layer and a single output. RSI = Relative strength index, AD = Accumulation/distribution, MACD = Moving average convergence/divergence.  
market indicators in different configurations were considered. The ANN input variables were selected randomly and the most accurate model structures were identified in an experimental way, based on the results of machine learning. The main machine learning algorithm is based on the following rules:  
1. A set of ANN input data vectors (i.e., not repeated combinations of market indicators with or without CLOSE past samples for a selected company) is generated randomly.
2. For each combination of input data, a set of MLP structures is generated and for \(n\) inputs, the number of neurons in the hidden layer is changed as follows: \(n+1,1.5n\), \(2n-1,2n+1,3n\), where \(n=4\), \(5\), \(6\), \(7\), \(8\), \(9\),...
3. For each input vector and each MLP structure: 1. All input data are normalized to <0.1; 0.9> range using the following formula: \[\text{Normalized\_Value}=0.8\ (\text{Value}/\text{Value}_{\text{max}})+0.1;\] (21) 2. The training data for each company are divided into a learning data set and a testing data set, where the testing set is about 30%; 3. The ANNs are trained using the resilient propagation algorithm with a momentum factor; 4. Eight different ANNs are trained and the ANN with the smallest MSE for the testing data is chosen as the best.
4. From the whole set of trained ANNs, a small subset of the best ANNs is identified, for which the MSE for the testing data is smaller than the defined error limit.  
The proposed stock exchange data forecasting methodology was tested on historical stock data for five chosen companies (ZYWIEC SA, ASSECO POLAND SA, BANK BPH SA, BUDIMEX SA, and VISTULA SA). The tested companies represent different market sectors, so the results can be generalized. They have been listed on the Warsaw Stock Exchange (WSE) since at least 1999. The WSE has been running since 12 April 1991. All the ANNs were trained on data covering the period from the start of the company's listing on the WSE to the end of 2008, and then tested on data from 1 January 2009 to 1 January 2015 (6 years).  
The best hybrid model structures were selected in an experimental way according to the following scheme:  
1. First, 12,628 various input data vectors were generated randomly for one company. Then, 208,518 different MLPs were trained. Each network was trained according to the rules defined above.
2. In the second step, 29,149 MLPs with the smallest MSE were selected and their structures used to train ANNs for three randomly chosen companies.
3. Next, 5545 ANN structures with an MSE smaller than the defined error limit were used to train ANNs for all five companies.
4. Finally, 300 ANNs with the lowest MSE for the testing data for all five companies were selected and used to predict close values for the next day.