Keywords

1 Introduction

The analysis of the time series consists of a (usually mathematical) description of the movements that compose it, then build models using movements to explain the structure and predict the evolution of a variable over time [1, 2]. The fundamental procedure for the analysis of a time series as described below:

  1. 1.

    Collecting data of the time series, trying to ensure that these data are reliable.

  2. 2.

    Representing the time series qualitatively noting the presence of long-term trends, cyclical variations and seasonal variations.

  3. 3.

    Plot a graph or trend line length and obtain the appropriate trend values using method of least squares.

  4. 4.

    When seasonal variations are present, obtained these and adjust the data rate to these seasonal variations (i.e. data seasonally).

  5. 5.

    Adjust the seasonally adjusted trend.

  6. 6.

    Represent cyclical variations obtained in step 5.

  7. 7.

    Combining the results of steps 1–6 and any other useful information to make a prediction (if desired) and if possible discuss the sources of error and their magnitude.

Therefore the above ideas can assist in the important problem of prediction in the time series. Along with common sense, experience, skill and judgment of the researcher, such mathematical analysis can, however, be of value for predicting the short, medium and long term.

The Mexican Stock Exchange (MSE), the second largest exchange in Latin America and home to some of the world’s leading companies, have unveiled new and innovative trading rules and practices to the international financial community that were created to streamline market access to the Exchange. Senior exchange leadership, including Luis Tellez, President and CEO of MSE Group, hosted an event, “Connect and Trade Mexico,” in New York City to discuss the recent improvements and the benefits for U.S. Institutional investors, including brokers, hedge funds, high frequency traders and other professional market participants [3].

Genetic algorithms are adaptive methods, which may be used to solve search and optimization problems. They are based on the genetic process of living organisms. Over generations, the populations evolve in line with the nature of the principles of natural selection and survival of the fittest, postulated by Darwin, in imitation of this process; genetic algorithms are capable of creating solutions to real world problems. The evolution of these solutions to optimal values of the problem depends largely on the proper coding of them. The basic principles of genetic algorithms were established by Holland [4, 5] and are well described in texts Goldberg and Kalyanmoy [6], Davis [7] and Michalewicz [8]. The evolutionary modeling of fuzzy logic system can be considered as an optimization process where a part or all the fuzzy system parameters constitute a search spaces of model operational (our case), cognitive and structural.

This paper reports the results of the simulations, in which optimization of the interval type-2 fuzzy integrators in ensembles of ANFIS models for the prediction time series (case: Mexican Stock Exchange), where the results for each ANFIS are evaluated by the method of the root mean square error (RMSE). For the integration of the results of each modular in the ensemble of ANFIS we used the following integration methods: interval type-2 fuzzy systems of Mamdani kind used with two and three membership functions.

The selection of the time series for the simulations was based on the fact that these time series are widely quoted in the literature by different researchers [9, 10], which allows to compare results with other approaches such as neural networks and linear regression.

In the next section we describe the background and basic concepts of ANFIS model, Ensemble learning, Interval type-2 fuzzy systems, Genetic Algorithms and MSE time series. Section 3 presents the proposed architecture of genetic optimization of interval type-2 fuzzy integrators in ensembles of ANFIS models for the time series prediction. Section 4 presents the simulations and the results obtained with different methods of integration that are used in this work. Section 5 presents the conclusions.

2 Background and Basic Concepts

This section presents the basic concepts of ANFIS, Ensemble learning, Interval type-2 fuzzy logic, and Genetic Algorithms.

2.1 ANFIS Models

There have been proposed systems that have achieved fully the combination of fuzzy systems with neural networks, one of the most intelligent hybrid systems is the ANFIS (Adaptive Neuro Fuzzy Inference System method) as referred to by Jang [11, 12] (Fig. 1), which is a method for creating the rule base of a fuzzy system, using the algorithm of backpropagation training from the data collection process. Its architecture is functionally equivalent to a fuzzy inference system of Takagi and Sugeno [13, 14].

Fig. 1
figure 1

ANFIS architecture

The basic learning rule of ANFIS is the gradient descent backpropagation, which calculates the error rates (defined as the derivative of the squared error for each output node) recursively from the output to the input nodes.

As a result we have a hybrid learning algorithm, which combines the gradient descent and least-squares estimation. More specifically in, the forward step of the hybrid learning algorithm, functional signals (output nodes) are processed towards layer 4 and the parameters of consequence are identified by least squares. In the backward step the premise parameters are updated by gradient descent.

2.2 Ensemble Learning

The Ensemble consists of a learning paradigm where multiple component learners are trained for a same task, and the predictions of the component learners are combined for dealing with future instances [4, 15, 16]. Since an Ensemble is often more accurate than its component learners, such a paradigm has become a hot topic in recent years and has already been successfully applied [17] to optical character recognition, face recognition, scientific image analysis, medical diagnosis.

2.3 Interval Type-2 Fuzzy Logic

Type-2 fuzzy sets are used to model uncertainty and imprecision; originally they were proposed by Zadeh [18, 19] and they are essentially ‘‘fuzzy–fuzzy’’ sets in which the membership degrees are type-1 fuzzy sets [2022] (Fig. 2).

Fig. 2
figure 2

Basic structure of the interval type-2 fuzzy logic system

The basic structure of a type-2 fuzzy system implements a nonlinear mapping of input to output space. This mapping is achieved through a set of type-2 if-then fuzzy rules, each of which describes the local behavior of the mapping.

The uncertainty is represented by a region called footprint of uncertainty (FOU). When; we have an interval type-2 membership function \( \mu_{{\tilde{A}}} \left( {x,u} \right) = 1,\,\forall u \in l_{x} \subseteq \left[ {0,\,1} \right] \) [20, 2326] (Fig. 3).

Fig. 3
figure 3

Interval type-2 membership function

The uniform shading for the FOU represents the entire interval type-2 fuzzy set and it can be described in terms of an upper membership function \( \mu_{{\tilde{A}}} \left( x \right) \) and a lower membership function \( \mu_{{\tilde{A}}} \left( x \right). \)

A fuzzy logic systems (FLS) described using at least one type-2 fuzzy set is called a type-2 FLS. Type-1 FLSs are unable to directly handle rule uncertainties, because they use type-1 fuzzy sets that are certain [2729]. On the other hand, type-2 FLSs are very useful in circumstances where it is difficult to determine an exact certainty value, and there are measurement uncertainties.

2.4 Genetic Algorithms

Genetic Algorithms (GAs) are adaptive heuristic search algorithms based on the evolutionary ideas of natural selection and the genetic process [3036]. The basic principles of GAs were first proposed by John Holland in 1975, inspired by the mechanism of natural selection, where stronger individuals are likely the winners in a competing environment [24]. GAs assumes that the potential solution of any problems an individual and can represented by a set of parameters [33]. These parameters are added as the genes (individuals) of a chromosome and can be structured by string of values in binary or real form. A positive value, generally known as a fitness value, is used to reflect the degree of “goodness” of the chromosome for the problem which would be highly related with its objective value. The pseudo code of a GAs is as follows:

  1. 1.

    Start with a randomly generated population of n individuals (candidate a solutions to problem).

  2. 2.

    Calculate the fitness of each individual in the problem.

  3. 3.

    Repeat the following steps until n offspring have been created:

    1. a.

      Select a pair of parent individual from the concurrent population, the probability of selection being an increasing function of fitness. Selection is done with replacement, meaning that the same individual can be selected more than once t that the same individuals can be selected more than once to become a parent.

    2. b.

      With the probability (crossover rate), perform crossover to the pair at a randomly chosen point to form two offspring.

    3. c.

      Mutate the two offspring at each locus with probability (mutate rate), and place the resulting individuals in the new population.

  4. 4.

    Replace the current population with the new population.

  5. 5.

    Go to step 2.

The simple procedure just describe above is the basic one for most applications of GAs found in the literature.

2.5 Mexican Stock Exchange Time Series

MSE Group is a fully integrated Exchange Group that operates cash, listed derivatives and OTC markets for multiple asset classes, including equities, fixed income and exchange traded funds, as well as custody, clearing and settlement facilities and data products for the local and international financial community.

MSE is the second largest stock exchange in Latin America with a total market capitalization of over US$360 billion. The Exchange is home to some of the most recognizable and profitable global corporations, including: beverage giant Modelo Group, whose brands include Corona Extra and Pacifico; America Mobil, one of the largest telecommunications companies in the world; CEMEX, the world’s biggest building materials supplier; and Televisa, the largest media company in the Spanish-speaking world, among many others [3]. In addition, MexDer (the Mexican Derivatives Exchange) is also part of MSE Group and is the leading marketplace for trading benchmark Mexican derivatives products. The MSE time series we are using 800 pair data (Fig. 4) that correspond from period of 11/09/2005 to 01/15/09 [37] of the IPC (which stands for “Indice de Precios y Cotizaciones”) is the broadest indicator of the MSE overall performance.

Fig. 4
figure 4

Mexican stock exchange time series

3 General Architecture of the Proposed Method

The proposed method combines the ensemble of ANFIS models and the use of interval type-2 fuzzy systems as response integrators (Fig. 5).

Fig. 5
figure 5

The architecture of the proposed model

This architecture is divided into 4 sections, where the first phase represents the data base to simulate in the Ensemble [4] of ANFIS, which in this case is the historical data of the Mexican Stock Exchange [37] time series. From the MSE time series we used 800 pairs of data points (Fig. 4), similar to [9, 10, 38].

We predict x(t) from three past (delays) values of the time series, that is, x(t − 18), x(t − 12), and x(t − 6). Therefore the format of the training and checking data is:

$$ \left[ {x\left( {{\text{t}} - 1 8} \right),x\left( {t - 12} \right),x\left( {t - 6} \right);x\left( t \right)} \right] $$
(1)

where t = 19–818 and x(t) is the desired prediction of the time series.

In the second phase, training (the first 400 pairs of data are used to train the ANFIS) and validation (the second 400 pairs of data are used to validate the ANFIS models) is performed sequentially in each ANFIS model, where the number of ANFIS to be used can be from 1 to n depending on what the user wants to test, but in this case we are dealing with a set of 3 ANFIS in the Ensemble. Therefore each ANFIS model has three inputs variables (\( x\left( {{{t}} - 1 8} \right),x\left( {t - 12} \right),x\left( {t - 6} \right) \)) and one output variable (\( x\left( {{t}} \right) \)) is the desired prediction.

In the fourth phase we integrate the overall results of each Ensemble of ANFIS (ANFIS 1, ANFIS 2 and ANFIS 3) models, and such integration will be done the interval type-2 fuzzy integrators of Mamdani type, but each fuzzy integrators will optimized (GAs) of the MFs parameters. Finally the forecast output determined by the proposed architecture is obtained and it is compared with desired prediction.

4 Simulations Results

This section presents the results obtained through experiments on the architecture of genetic optimization of type-2 fuzzy integrators in ensembles of ANFIS models for the time series prediction, which show the performance that was obtained from each experiment to simulate the Mexican Stock Exchange time series.

4.1 Design of the Fuzzy Integrators

4.1.1 Interval Type-2 Fuzzy Integrators (Used Two MFs)

The design of the interval type-2 fuzzy inference systemintegrator is of Mamdani type and has 3 inputs (ANFIS1, ANFIS2 and ANFIS3 predictions) and 1 output (forecast) variables, so each input will be assigned two MFs with linguistic labels “Small and Large” and the output will be assigned 3 MFs with linguistic labels “OutANFIS1, OutANFIS2 and OutANFIS3” (Fig. 6) and have 8 rules if-then.

Fig. 6
figure 6

Structure of the interval type-2FIS integrator (used two Gaussian MFs)

In the interval type-2 fuzzy inference system integrator we used different MFs (Gaussian “igaussmftype2”, Generalized “igbelltype2” Bell, and Triangular “itritype2”) to observe the behavior of each of them and determine which one provides better forecast of the time series.

4.1.2 Interval Type-2 Fuzzy Integrators (Used Three MFs)

The design (structure) of the interval type-2 fuzzy inference systemintegrator is of Mamdani type and has 3 inputs (ANFIS1, ANFIS2 and ANFIS3 predictions) and 1 output (forecast), so each input will be assigned three MFs with linguistic labels “Small, Middle and Large” and the output will be assigned three MFs with linguistic labels “OutANFIS1, OutANFIS2 and OutANFIS3” (Fig. 8) and have 15 rules if-then (Fig. 7).

Fig. 7
figure 7

Structure of the interval type-2FIS integrator (used three Gaussian MFs)

In the interval type-2 fuzzy inference systemintegrator we used different MFs (Gaussian “igaussmftype2”, Generalized “igbelltype2” Bell, and Triangular “itritype2”) to observe the behavior of each of them and determine which one provides better forecast of the time series.

4.1.3 Design the Rules of the Fuzzy Integrators

The design rules if-then for the fuzzy inference system depends on the number of membership functions used in each input variable using the system (e.g. our fuzzy inference system uses 3 input variables which each entry contains three membership functions, therefore the total number of possible combinations for the fuzzy-rules is 27 (e.g. 3 × 3 × 3 = 27)), but we used 15 fuzzy-rules for the experiments (see Fig. 8) because the performance is better and minimized the prediction error of the Dow Jones time series.

Fig. 8
figure 8

Rules of interval type-2 FIS

4.2 Design the Representation of the Chromosome of Genetic Algorithms for Optimizer the MFs in the Fuzzy Integrators

The GAs are used to optimize the parameters values of the MFs in each interval type-2 fuzzy integrators. The representation of GAs is of Real-Values and the chromosome size will depend of the MFs that are used in each design of the interval type-2 fuzzy inference system integrators.

The objective function is defined to minimize the prediction error as follows:

$$ f\left( t \right) = \sqrt {\frac{{\sum\nolimits_{t = 1}^{n} {(a_{t} - p_{t} )^{2} } }}{n}} $$
(2)

where a, corresponds to the real data of the time series, p corresponds to the output of each fuzzy integrator, t is de sequence time series, and n is the number of data points of time series.

In Figs. 9 and 10 the general representation of the chromosome that represents the utilized fuzzy membership functions is illustrated. In these figures, the first phase represented each input/output variables of the fuzzy systems, the second phase represents the MFs containing each input (MFs1 “Small”, MFs2 “Middle” and MFs3 “Large”) and output (MFs1 “OutANFIS1”, MFs2 “OutANFIS2” and MFs3 “OutANFIS1”) variables of the fuzzy systems, the third phase represents the MFs parameter “PL = Lower Parameter” where PL 1 PL N (0.02…3.15) are the size parameter of the MFs, the fourth phase represent the MFs parameter “PU = Upper Parameter” PU 1 … PU N (0.4…3.55) are the size parameter of the MFs that corresponds to each input and output. The number of parameters varies according to the kind of MFs of the interval type-2 fuzzy system (e.g. three parameter are needed to represent a Gaussian “igaussmtype2” MF’s are “sigma, mean1 and mean2”) illustrated in Figs. 9 and 10.

Fig. 9
figure 9

Representation of the chromosome for the optimization of the interval type-2 fuzzy integrators (used two Gaussian MFs)

Fig. 10
figure 10

Representation of the chromosome for the optimization of the interval type-2 fuzzy integrators (used three Gaussian MFs)

Therefore the number of parameters that each fuzzy inference system integrator depends of the MFs type assigned to each input and output variables.

The GAs used the following parameters for the experiments: 100 individuals or genes, 100 generations and 31 iterations (running the GAs), the selection method are the stochastic universal sampling, the percentage of crossover or recombine is 0.8 and the mutation is 0.1. Those are fundamentals parameters for test the performances of the GAs.

4.3 Result Obtained for the Genetic Optimization of Interval Type-2 Fuzzy Integration (Using Two Gaussian MFs)

In the design of the interval type-2 fuzzy integrator we have three input variables and one output variable, so each variable input will have two MFs and the variable output will have three MFs. Therefore the number of parameters that one used in the representation of the chromosome is 27, because iguassmtype2 MFs used three parameters (Variance, Mean1 and Mean2) to their representation in the interval type-2 fuzzy systems. The results obtained for the optimization of the iguassmtype2 MFs with GAs are the following: the parameters obtained with the GAs for the type-2 fuzzy MFs “iguassmtype2” (Fig. 11). The forecast data (Fig. 12) is generated by optimization of the interval type-2 fuzzy integrators. Therefore the comparison of evolution error (RMSE) between best and average (Fig. 13) obtained with the GAs for this integration are 0.10245 and 0.10264.

Fig. 11
figure 11

Plot of the optimization of the memberships functions (input and output) parameters with the GAs

Fig. 12
figure 12

Plot of the forecast generated by the genetic optimization of type-2 fuzzy integrators

Fig. 13
figure 13

Plot of the evolution error generated by GAs

4.4 Result Obtained for the Genetic Optimization of Interval Type-2 Fuzzy Integration (Using Three Triangular MFs)

In the design of the interval type-2 fuzzy integrator we have three input variables and one output variable, so each inputs and output variables will have three MFs. Therefore the number of parameters of the MFs that are used in the representation of the chromosome is 72, because “igbelltype2” MFs used six’s parameters (a1, b1, c1, a2, b2 and c2) to their representation in the interval type-2 fuzzy systems. The results obtained for the optimization of the “itritype2” MFs with GAs are the following: the parameters obtained with the GAs for the type-2 fuzzy MFs “itritype2” (Fig. 14). The forecast data (Fig. 15) is generated by optimization of the interval type-2 fuzzy integrators. Therefore the comparison of evolution error (RMSE) between best and average (Fig. 16) obtained with the GAs for this integration are 0.1004 and 0.10071.

Fig. 14
figure 14

Optimization of the memberships functions (input and output) parameters with the GAs

Fig. 15
figure 15

Forecast generated by the genetic optimization of the type-2 fuzzy integrators

Fig. 16
figure 16

Plot of the evolution error generated by GAs

4.5 Results and Comparison

Table 1 shows the results of 30 experiments that were made with the genetic optimization of interval type-2 fuzzy integrators in ensembles of ANFIS models for the time series prediction. This Table shows the comparison result (best, mean and standard deviation “STD”) of the prediction error for the optimization of the interval type-2 fuzzy integrators (used two and three MFs for each integrator). The best, averages and standard deviation prediction errors for the interval Type-2 fuzzy integrator (used two MFs) are using Generalized Bell “igbelltype2” MFs, which obtained a prediction error are 0.099952 (best), 0.100466 (mean) and 0.000596 (STD). The best, averages and standard deviation prediction errors for the interval Type-2 fuzzy integrator (used three MFs) are using Generalized Bell “igbelltype2” MFs, which obtained a prediction error are 0.097165 (best), 0.097347 (mean) and 0.000392 (STD). Therefore when we used interval type-2 fuzzy integrator (using three MFs) is better than interval type-2 fuzzy integrator (using two MFs) in because the best prediction error is 0.097165.

Table 1 Results obtained for the optimization of the interval type-2 fuzzy integrators for the prediction error of Mexican stock exchange

Table 2 shows the results of 30 experiments that were made with the genetic optimization of interval type-2 and type-1 fuzzy integrators in ensembles of ANFIS models for the time series prediction. This table shows the comparison result (best, mean and standard deviation “STD”) results of the prediction error of the optimization of the interval type-2 and type-1 fuzzy integrators (used two MFs for each integrator). The best, averages and standard deviation prediction errors for the Type-1 fuzzy integrator are using Generalized Bell MFs, which obtained a prediction error are 0.101809 (best), 0.102272 (mean) and 0.000752 (STD). The best, averages and standard deviation prediction errors for the interval Type-2 fuzzy integrator are using Generalized Bell “igbelltype2” MFs, which obtained a prediction error are 0.099952 (best), 0.100466 (mean) and 0.000596 (STD). Therefore when we used interval type-2 fuzzy integrator is better than type-1 fuzzy integrator because the best prediction error is 0.099952.

Table 2 Results obtained for the optimization of the interval type-2 and type 1 fuzzy integrators for the prediction error of Mexican stock exchange

5 Conclusion

We have presented simulation results of the Mexican Stock Exchange time series (forecasting) with different hybrid intelligent approaches. The best result with the optimization of the interval type-2 fuzzy integrator (using three MFs) is better than interval type-2 fuzzy integrators (using two MFs), because the prediction error is 0.097165 (as shown Table 1), in most of the experiments that were performed with the proposed architecture of ensembles of ANFIS.

In the comparison of results between of the interval type-2 and type-1 fuzzy integrators (both using two MFs) the better prediction error is obtained when we used interval type-2 fuzzy integrator because the prediction error is 0.099952 (as shown Table 2).

We conclude that the results obtained with the optimization of the interval type-2 fuzzy integrators in ensembles of ANFIS models for the time series prediction (case Mexican Stock Exchange) is good, since we achieved 98 % of accuracy with the Mexican Stock Exchange time series.

Therefore the proposal offers efficient results in the prediction of such time series, which can help us, make decisions and avoid unexpected events in the future.