1 Introduction
In nature, we find situations and processes for which there is no immediate explanation. A particular case of this is swarming, in which many simple individuals act in such a way that intelligent behavior emerges.
Swarm intelligence is the branch of artificial intelligence that seeks to study and simulate the complex behaviors found in these swarms, such as flocks of birds or ant colonies. In this case, an algorithm based on the behavior of birds was implemented, applying it to complex time series prediction.
A time series can represent anything from the prices of an item, unemployment rates, the maximum daily temperature, and wind speed, to the efforts and temperatures at various points of an instrumented civil work, etc., since it is a sequence of data arranged chronologically and are used to study the causal relationship between various variables that change over time.
In this work, we use recurrent neural networks (RNNs) since these are one of the most used models. For example, in voice recognition systems or video analysis, or in natural language processing, and these models are these models capable of processing different types of sequences (such as videos, conversations, text) and, unlike neural or convolutional networks, this type of neural network are capable of generating new sequences, likes time series.
RNNs use the concept of recurrence: to generate the output, which we will call activation from now on. The network uses not only the current input, but also the activation generated in the previous iteration. In a nutshell, RNNs use a certain type of “memory” to generate the desired output [17].
Some models based on RNNs can be found in finance [4], electronic commerce [5, 6], capital markets [7, 8], macroeconomy [9, 10], health [11, 12], signal processing, meteorology [13, 14], voice recognition [15] and traffic control [16].
When birds are fed with flocks of birds, we can have more information and a good foraging effectiveness and survival benefits.
If one bird finds food, others may feed from it [19] While foraging, birds often unite due to the Predation threat [20]. They constantly scan their surroundings and raise their heads.
These behaviors, interpreted as vigilance behavior [21], may be conducive to detecting Predators [22]. Studies showed that birds would randomly choose between foraging and keeping vigilance [23]. Birds often give alarm calls when they detect a Predator [24]. Thus, the whole group would fly off together. Birds in the border of a group have higher probability of being attacked by Predators than those in the center.
Studies suggest that animals foraging in the flock center may move to their neighbors to protect themselves from being attacked [25]. The birds move towards the center of the flock as they perceive them. This motion, however, may be affected by the interference induced by competing bird swarms [26].
For this reason, the birds move toward the center of the swarm. This work outlines the formation of the ensemble recurrent neural network (ERNN). This model is applied to time series prediction [27, 32].
The architecture is optimized with the bird swarm algorithm, (BSA) [29-32], and Particle Swarm Optimization (PSO). The responses of the ERNN modules are integrated with type-1 and type-2 fuzzy systems (IT2FS), [32-38]. The optimization of the RNN consists finding the best the number of hidden layer (NL), number of neurons (NN) and the number of modules (NM).
We integrate responses in the ERNN, with type-1 and Fuzzy System Type-2 (IT2FS) and in this way we achieve Prediction. The Mamdani fuzzy inference system (FIS) has five inputs (Pr1, Pr2, Pr3, Pr4, and Pr5) and one output that is called Prediction.
The number of inputs of the fuzzy system (FS) is according to the outputs of ERNN and Mamdani fuzzy FIS is created. This FIS five inputs, which are Pr1, Pr2, Pr3, Pr4, and Pr5, have a from the range from 0 to 1.4.
The output is called Prediction, the range goes from 0 to 1.4 and is granulated into two membership functions (MFs) “Low”, “High” [50-53]. The main contribution of this work is the optimization of recurrent neural networks with the BSA algorithm, and PSO applied to time series, which represents a different way to optimize this kind of neural networks.
This paper is consisting of 4 parts: In section 2, the problem to be solved and the solution with the proposed method are mentioned, section 3 describes in the results obtained with the model and section 5 offers the conclusions.
2 Proposed Method
In this section, a recurrent neural network optimization model with the Bird Swarm algorithm (BSA) is offered. We have historical data that enters the ENN modules, and then responses from the ENN are integrated with type-1 and IT2FS for the Prediction of the time series.
In this case: Euro/Mexican pesos and Euro/Dollar time series. Figure 1 shows a general scheme of each of the steps of the method postulated in this paper which is explained in more detail below:
2.1 Parameters for BSA Applied to the RNN
Table 1 summarizes the parameters used for the optimization of ERNN with the BSA, where Dime is the number of dimensions used for optimization, M1 is the iteration number, pop is the bird population, FQ1 (FL) is the bird behavior frequency, a1 and a2 are values related to the vigilance behavior of the birds these effects are
indirect and direct. co1 cognitive is the coefficient and co2 is the accelerated social coefficient. Table 2 illustrated the parameters used for the optimization of ERNN with the PSO, where P is the number of particles, I is the iteration number, the cognitive component is C1, the Social Component is C2, Constriction coefficient of linear increase is Cand Inertia weight with linear decrease is (W).
2.2 Parameters for PSO Applied to and RNN
The following equation is used to minimize the prediction error, the objective function we employed with the bird swarm algorithm and PSO:
where PE is Prediction Error,
2.3 Data Base
Fig. 2 presents the plot of the data Euro/Mexican pesos [18], where we use 800 data that belong to the time of 12/08/2017 to 31/12/2020. We apply 30% to test the RNN and 70% for the training of the RNN. Fig. 3 exhibits the plot of the data Euro/Dollar [18], where we use 800 data that belong to the time 12/08/2017 to 31/12/2020. We apply 30% to test the RNN and 70% for the training of the RNN.
2.4 Description of the Architecture of Type-1 and IT2FS
The following equation shows how the Fuzzy System is calculated:
where
2.5 Type-2 Memberships Functions
Below are equations of type-2 fuzzy system membership functions:
where “igaussstype2” stands for the Gaussian generalized type-2 membership function with uncertain mean:
where
where
The rules were obtained based on previous work used in the fuzzy system [36]. The Figure 4 represents the rules employed in the fuzzy system. The rules were formulated based on previous work used in the fuzzy system where 32 rules were used and they are all possible rules since we have 5 inputs and one output, and each input has two MFs and the consequents are determined by trial and error [36].
3 Results
In this section, the results of the experiments of the presented model are outlined. In this case, the bird algorithm and particle swarm optimization were used for the optimization of the ERNN, and the type-1 and IT2FS integration and 10 experiments were carried out and the time series of the Euro/Mexican pesos and Euro/Dollar pesos were considered. Table 4 represents the Euro/Mexican pesos time series results of the Optimization of ERNN for 10 experiments, where 100 generations and 100 population is used.
No. | NM | NL | Time | PE |
1 | 2 | 16, 16 18, 17 |
01:38:47 | 0.01806 |
2 | 2 | 10 15 |
01:40:41 | 0.01842 |
3 | 2 | 24, 22 16, 23 |
01:35:11 | 0.019807 |
4 | 2 | 25, 16 1, 6 |
01:40:41 | 0.01802 |
5 | 2 | 25, 17 15, 16 |
01:15:42 | 0.01827 |
6 | 2 | 6, 9 28, 4 |
01:45:35 | 0.019806 |
7 | 2 | 6, 9 28, 4 |
01:35:35 | 0.01827 |
8 | 1 | 17 | 01:42:17 | 0.01822 |
9 | 2 | 25 15 |
01:15:42 | 0.01835 |
10 | 2 | 6.9, 22 26, 2, 26 |
01:26:15 | 0.01807 |
Table 5 shows the Euro/Mexican pesos time series results of 10 type-1 fuzzy system experiments. Table 6 represents the Euro/Mexican pesos time series results of the IT2FLS for 10 experiments with different levels of uncertainty.
No. | Type-1 Fuzzy Integrator |
1 | 0.3026 |
2 | 0.1408 |
3 | 0.1384 |
4 | 0.1122 |
5 | 0.3175 |
6 | 0.3022 |
7 | 0.1408 |
8 | 0.1383 |
9 | 0.1383 |
10 | 0.3021 |
No. | PE 0.3 | PE 0.4 | PE 0.5 |
1 | 0.2219 | 0.2210 | 0.2286 |
2 | 0.2263 | 0.2268 | 0.2274 |
3 | 0.2215 | 0.2236 | 0.2339 |
4 | 0.2212 | 0.2222 | 0.2228 |
5 | 0.2229 | 0.2339 | 0.2348 |
6 | 0.2222 | 0.2225 | 0.2231 |
7 | 0.2221 | 0.2229 | 0.2235 |
8 | 0.2261 | 0.2268 | 0.2371 |
9 | 0.2256 | 0.2268 | 0.2387 |
10 | 0.2268 | 0.2274 | 0.2389 |
Table 7 represents Euro/Dollar time series results of the Optimization of ERNN for 10 experiments, where 100 generations and 100 population is used. Table 8 shows the Euro/Dollar time series results of 10 type-1 fuzzy system experiments. Table 9 represents the Euro/Mexican pesos time series results of the PSO of ERNN 10 experiments, where 100 particles and 100 iterations is used. Table 10 represents the Euro/Dollar time series results of 10 IT2FS experiments with different uncertainty levels.
No. | NM | NL | Time | PE |
1 | 3 | 18 15 17 |
01:05:22 | 0.00042061 |
2 | 3 | 5, 18 15, 13 17, 18 |
01:19:33 | 0.00055028 |
3 | 4 | 17, 5, 7 12, 25, 13 20, 27, 22 |
01:28:04 | 0.00042102 |
4 | 2 | 10, 11 11, 12 15, 17 18, 16 |
01:45:20 | 0.0005802 |
5 | 3 | 18, 19, 17 13, 13.18 |
01:10:15 | 0.00050568 |
6 | 3 | 22, 19, 14 27, 17, 12 16, 17, 19 |
01:11:03 | 0.00051168 |
7 | 3 | 8, 22, 21 11, 23, 21 16, 6, 23 |
01:33:18 | 0.00052428 |
8 | 3 | 18, 19, 25 15, 22, 19 16, 11, 23 |
01:22:20 | 0.00528091 |
9 | 4 | 7, 7, 12 21, 2, 19 21, 13, 12 |
01:51:21 | 0.00505413 |
10 | 4 | 5, 27, 28 20, 20, 6 13, 12, 12 12, 26, 6 |
01:51:22 | 0.00042107 |
No. | Type-1 fuzzy integrator |
1 | 0.1225 |
2 | 0.1228 |
3 | 0.1432 |
4 | 0.2223 |
5 | 0.225 |
6 | 0.2822 |
7 | 0.1736 |
8 | 0.3220 |
9 | 0.2217 |
10 | 0.2325 |
No | Modules | Layers | Time | P |
1 | 3 | 16,18 20,22 15,17 |
01:07:17 | 0.01922 |
2 | 2 | 22,23 24.25 |
01:02:23 | 0.02202 |
3 | 3 | 24,24 23,21 19.20 |
01:05:11 | 0.01988 |
4 | 2 | 27,21 24,23 |
01:07:22 | 0.02107 |
5 | 4 | 27,15 20,21 25,24 23,22 |
01:07:25 | 0.01977 |
6 | 2 | 26,29 28,27 |
01:07:32 | 0.02106 |
7 | 3 | 6,9 28,4 |
01:35:35 | 0.01827 |
8 | 2 | 20,23 21,22 |
01:07:17 | 0.01738 |
9 | 2 | 25,23 21,22 |
01:07:12 | 0.01732 |
10 | 3 | 6,9,22 26,2,26 22,21,10 |
01:06:13 |
No. | PE 0.3 | PE 0.4 | PE 0.5 |
1 | 0.3827 | 0.3849 | 0.3864 |
2 | 0.4162 | 0.4165 | 0.4168 |
3 | 0.4168 | 0.4236 | 0.4238 |
4 | 0.4229 | 0.4239 | 0.4249 |
5 | 0.4422 | 0.4436 | 0.4443 |
6 | 0.4987 | 0.4222 | 0.4229 |
7 | 0.4668 | 0.4544 | 0.4277 |
8 | 0.4492 | 0.4898 | 0.4899 |
9 | 0.4449 | 0.4453 | 0.4456 |
10 | 0.4966 | 0.4988 | 0.4994 |
Table 11 shows the Euro/Mexican pesos time series results for 10 type-1 fuzzy system experiments for PSO. Table 12 represents the Euro/Mexican pesos time series results of the IT2FLS 10 experiment for PSO with different levels of uncertainty.
No. | Type-1 fuzzy integrator |
1 | 0.3228 |
2 | 0.3417 |
3 | 0.3263 |
4 | 0.3123 |
5 | 0.3442 |
6 | 0.3227 |
7 | 0.3409 |
8 | 0.3386 |
9 | 0.3323 |
10 | 0.3122 |
No. | PE 0.3 | PE 0.4 | PE 0.5 |
1 | 0.2330 | 0.2332 | 0.2377 |
2 | 0.2383 | 0.2385 | 0.2366 |
3 | 0.2318 | 0.2338 | 0.2380 |
4 | 0.2333 | 0.2346 | 0.2348 |
5 | 0.2388 | 0.2389 | 0.2391 |
6 | 0.2382 | 0.2385 | 0.2381 |
7 | 0.2371 | 0.2373 | 0.2376 |
8 | 0.2381 | 0.2384 | 0.2387 |
9 | 0.2390 | 0.2392 | 0.2396 |
10 | 0.2377 | 0.2379 | 0.2381 |
Table 13 shows the Euro/Dollar time series results of 10 type-1 fuzzy system experiments for PSO. Table 14 represents the Euro/Dollar time series results of 10 IT2FS experiments for PSO with different levels of uncertainty.
No. | Mod. | Layers | Time | P |
1 | 2 | 15,17 15,16 |
01:08:35 | 0.00052058 |
2 | 2 | 17,15 15,15 |
01:08:33 | 0.00051022 |
3 | 3 | 16,15,15 13,15,16 15,17,12 |
01:08:31 | 0.00052323 |
4 | 3 | 21,20,19 22,18,20 21,20,18 20,22,22 |
01:08:27 | 0.00062023 |
5 | 2 | 15,18,19 16,15,17 |
01:08:26 | 0.00056032 |
6 | 4 | 21,20,19 22,18,20 21,20,18 20,22,22 |
01:09:03 | 0.00051168 |
7 | 3 | 21,22, 15,16 16,17 |
01:08:55 | 0.00053328 |
8 | 4 | 20,19 21,22 |
01:08:28 | 0.00628082 |
9 | 2 | 21,20 22,18 21,20 20,22 |
01:09:01 | 0.00605332 |
10 | 3 | 2,27 20,21 17,20 |
01:09:09 | 0.00661133 |
No. | PE 0.3 | PE 0.4 | PE 0.5 |
1 | 0.4327 | 0.4449 | 0.4451 |
2 | 0.4522 | 0.4523 | 0.4528 |
3 | 0.4238 | 0.4242 | 0.4244 |
4 | 0.4266 | 0.4268 | 0.4270 |
5 | 0.4292 | 0.4298 | 0.4301 |
6 | 0.4287 | 0.4289 | 0.4290 |
7 | 0.4266 | 0.4268 | 0.4270 |
8 | 0.4292 | 0.4294 | 0.4296 |
9 | 0.4275 | 0.4277 | 0.4279 |
10 | 0.4223 | 0.4226 | 0.4229 |
To compare the two optimization algorithms, Bird Sarm Algorithm and Particle Swarm, for Euro/Mexican pesos time series, the t statistical test was used and we can conclude that there is significant evidence between the optimization of the NN with the BSA and PSO. In other words, it can be said that the BSA algorithm is better.
Algorithm | N | Mean | Standard Deviation | Mean Error |
BSA | 29 | 0.018518 | 0.00635 | 0.00012 |
PSO | 29 | 0.01955 | 0.00154 | 0.00029 |
Algorithm | N | Mean | Standard Deviation | Mean Error |
BSA | 29 | 0.00355 | 0.00927 | 0.0017 |
PSO | 29 | 0.00261 | 0.00261 | 0.00049 |
The number of samples was 29, and a 95% confidence interval was used. and produce a P value of 0.002 and T value of -3.34 and Critical Value of 0.0668. To compare the two optimization algorithms of BSA and PSO for Euro/Dollar Peso time series, t-statistic test was used and we can conclude that there is no significant evidence between the optimization of with the BSA and PSO algorithm. In other words, it can be said that the BSA algorithm and the PSO are equal since the results are almost the same, the samples used were 29 and a 95% confidence interval was used.
4 Conclusions
Recurrent neural networks are an excellent model for time series data. In this paper we, so we conclude that this type of network produces good results, as well as the optimization of the structure of this network, and then the fuzzy integration of the network responses to test this method was used Euro/Dollar and Euro/Mexican pesos time series. When performing statistical tests, we had the goal finding out it both algorithms are good at solving time series problems.
In the Euro/Mexican time series the BSA algorithm was better and for the Euro/Dollar time series, both were goodComparisons were made with the two optimization algorithms Bird Swarm Algorithm and Particle Swarm, for Euro/Mexican pesos time series, the statistical t test was used and we can conclude that there is significant evidence between the optimization with the BSA and PSO.
In other words, it can be said that the BSA algorithm is better, and for Euro/Dollar Peso time series, the t-statistic test was also used and we can conclude that there is no significant evidence between the optimization with the BSA algorithm and PSO. In other words, it can be said that the BSA algorithm and the PSO are the same. As future work, we plan to consider other similar metaheuristics (instead of BSA and PSO), like in [53-57], and also undertake other application areas [58-61].