# A New Time-Invariant Fuzzy Time Series Forecasting Method Based on Genetic Algorithm

Authors: Erol Eğrioğlu
Journal: Advances in Fuzzy Systems
 (2012)

---

## Abstract

In recent years, many fuzzy time series methods have been proposed in the literature. Some of these methods use the classical fuzzy set theory, which needs complex matricial operations in fuzzy time series methods. Because of this problem, many studies in the literature use fuzzy group relationship tables. Since the fuzzy relationship tables use order of fuzzy sets, the membership functions of fuzzy sets have not been taken into consideration. In this study, a new method that employs membership functions of fuzzy sets is proposed. The new method determines elements of fuzzy relation matrix based on genetic algorithms. The proposed method uses first-order fuzzy time series forecasting model, and it is applied to the several data sets. As a result of implementation, it is obtained that the proposed method outperforms some methods in the literature.


---

## Body

## 1. Introduction

The fuzzy time series were firstly defined in Song and Chissom [1]. Many time series in the real life have uncertainty observations. This kind of the time series is called fuzzy time series. For example, some of these time series are stock index data, air pollution data, enrollment data, and temperature data. The observations of these time series are convertible to fuzzy sets. The fuzzy time series separate two classes which are time-variant and time-invariant. The time-invariant fuzzy time series have time-invariant relationship of lagged fuzzy time series variables. This relationship is proved from an “R” matrix, which is invariant in the time space. The first method for forecasting time-invariant time series is proposed in Song and Chissom [2], in which the membership of observations is determined, subjectively. Chen [3] proposed fuzzy time series method which does not need complex matricial operations, and it uses fuzzy group relationship tables. Since these use order of fuzzy sets, the membership functions of fuzzy sets are not taken into consideration. Sullivan and Woodall [4] proposed fuzzy time series method based on Markov Chains. All of these methods forecast fuzzy time series based on first-order fuzzy time series forecasting model.In the literature, many fuzzy time series forecasting method are based on high-order fuzzy time series model, bivariate fuzzy time series model, and multivariate fuzzy time series model. Some of these methods are due to Chen [5], Aladag et al. [6], and Egrioglu et al. [7]. Generally, fuzzy time series methods are based on three stages. These are fuzzification, determination of fuzzy relation, and defuzzification. In the literature, the fuzzy time series methods are improved by employing various artificial intelligence techniques in these three stages. The genetic algorithms, particle swarm optimization, and fuzzy c-means methods are used in the fuzzification stage. Feed forward neural networks are used determining fuzzy relation and defuzzification stage.Many proposed methods in the literature neglected membership values of fuzzy sets. In this study, we proposed new fuzzy time series forecasting method for first order fuzzy time series forecasting model. The proposed method takes into account of membership values. Moreover, the proposed method does not need complex matricial operations and outperforms the well-known methods in the literature.In Section2 are given some important definitions. In Section 3, the fuzzy c-means method is summarized. In Section 4, genetic algorithm is briefly explained. In Section 5, we present details of our proposed methods. In Section 6, the proposed method is applied to some data sets, and we present results of implementation.


## 2. The Some Definitions Related to Fuzzy Time Series

The fuzzy time series were firstly defined in Song and Chissom [1]. The time-variant and time-invariant fuzzy time series definitions are given below.Definition 1.
LetY(t)  (t=…,0,1,2,…), a subset of real numbers, be the universe of discourse on which fuzzy sets fj(t) are defined. If F(t) is a collection of f1(t),  f2(t),…, then F(t) is called a fuzzy time series defined on Y(t).Definition 2.
SupposeF(t) is implied by F(t-1) only, that is, F(t-1)→F(t). Then this relation can be expressed as F(t)=F(t-1)∘R(t,t-1), where R(t,t-1) is the fuzzy relationship between F(t-1) and F(t), and F(t)=F(t-1)∘R(t,t-1) is called the first order model of F(t).Definition 3.
SupposeR(t,t-1) is a first-order model of F(t). If for any t, R(t,t-1) is independent of t, that is, for any t, R(t,t-1)=R(t-1,t-2), then F(t) is called a time-invariant fuzzy time series, otherwise it is called a time-variant fuzzy time series.
The symbol “∘” stands for max-min composition of fuzzy sets. Song and Chissom [2] firstly introduced an algorithm based on the first order model for forecasting time invariant F(t). In Song and Chissom [2], the fuzzy relationship matrix R(t,t-1)=R is obtained by many matricial operations. The fuzzy forecasts are obtained based on max-min composition as follows:
(1)F(t)=F(t-1)∘R.
The dimension of R is depending on number of fuzzy sets which are partition number of universe and discourse. If we use more fuzzy sets, we need more matricial operations for obtaining R. In this situation, Song and Chissom’s [2] method is getting more complex.


## 3. The Fuzzy C-Means Clustering Method: An Overview

Song and Chissom [1] method uses decomposition of the universe discourse in the stage of fuzzification. There are two problems: the number of intervals of arbitrary length and the arbitrary choice of membership degrees. In order to overcome these problems, Cheng et al. [8] and Li et al. [9] fuzzy c-means (FCM) clustering method was used. FCM clustering method was firstly introduced by Bezdek [10]. Let uij be the membership, vi the center of cluster, n the number of variables, and c the number of clusters. Then the objective function, which is minimized in FCM, is
(2)Jβ(X,V,U)=∑i=1c∑j=1nuijβd2(xj,vi),
where β is a constant greater than 1 and d(xj,vi) is a distance between the observation and the center of the cluster. Jβ is minimized with subject the constraints:
(3)0≤uij≤1,∀i,j,0<∑j=1nuij≤n,∀i,∑i=1cuij=1,∀j.
In this method, the minimization is done by an iterative algorithm. In each repetition, the values of uij and vi are updated by the formulas given in (4):
(4)vi=∑j=1nuijβxj∑j=1nuijβ,uij=1∑k=1c(d(xj,vi)/d(xj,vk))2/(β-1).


## 4.   Genetic Algorithm: An Overview

Chen and Chung [11], Lee et al. [12] used genetic algorithm in fuzzification stage. The genetic algorithms were first proposed by Holland [13]. The genetic algorithms have population size, evaluation function, cross-over rate, mutation rate and maximum generation number. The genetic algorithm researches an optimal solution with many chromosomes. In a chromosome, there are many genes. Generally, the genetic algorithm starts with random population whose size is determined by user according to the problem under study. For example, Chen and Chung [11] used 50 as population size and the new generation is produced by various techniques in the iterations. Some of these techniques are crossover, mutation, and natural selection, summarized as follows.Crossover
The system randomly selects two chromosomes from a population and randomly selects a crossover point from the two selected chromosomes to exchange genes after the crossover point. The crossover operation is depending on crossover rate. The random number generates uniform distribution, then the crossover operation is applied if random number is bigger than crossover rate.Mutation
The user must determine a mutation rate. Then a chromosome is randomly selected. If the system randomly generates a real value between zero and one, which is smaller than or equal to the mutation rate, then the system performs the mutation operation with a randomly selected gene from the chromosomes.Natural Selection
Each chromosome of any generation is evaluated according to evaluation function. All chromosomes are ordered according to evaluation function value. The best chromosomes are transferred to the next generation. Some worst chromosomes are discarded from generations, and the new chromosomes are admitted to the new generation.


## 5. The Proposed Method for Forecasting First Order Fuzzy Time Series Method

Here, we study forecasting time-invariant fuzzy time series. The FCM is used for fuzzification of time series, and genetic algorithm is used for finding the fuzzy relation. The proposed method has the following important advantages:(i)
the membership values of the fuzzy sets are taken into consideration;(ii)
there is no necessity of complicated matricial operations;(iii)
FCM no needs subjective decisions by using partition of the universe of discourse.The algorithm is given below in step by step as follows.Step 1 (Time series are fuzzified by FCM).
Letc be the number of fuzzy sets such that 2≤c≤n. FCM initially assigns crisp values to the fuzzy sets. After this application, the center of each cluster Lr is determined and denoted by vr,r=1,2,…,c.Step 2 (Determination of the parameters of genetic algorithm).
The evaluation function is the RMSE  as follows:(5)RMSE=∑i=1n(xt-x^t)2n,
being xt the crisp time series, x^t the defuzzified forecast, and n is the number of forecasts. The other parameters are selected as follows:population size: 30;crossover rate: 1;mutation rate: 0.01;maximum generation: 300;number of discarded chromosomes in the natural selection: 10.Step 3 (Initialization).
The genes are the elements of the crisp relation (Figure1):
(6)R=[rij],i=1,2,…,c,j=1,2,…,c.Figure 1
The structure of one chromosome.Step 4 (Crossover operation).
The crossover operation is applied if the random number is bigger than the crossover rate. The system randomly selects two chromosomes from a population and randomly selects a crossover point from the two selected chromosomes to exchange genes after the crossover point. The crossover operation is shown in Figure2.Figure 2
An example of crossover operation.Step 5.
If the system randomly generates a real value between zero and one which is smaller than or equal to the mutation rate, then the system performs the mutation operation with a randomly selected gene from the chromosomes. The mutation operation is demonstrated in Figure3. xnew is randomly generated from [x11,x13] interval.Figure 3
An example of mutation operation.Step 6.
The method for calculating RMSE for any chromosome is given in Substeps6.1–6.4.Substep 6.1.
c-gens constitute in the rows of R.Substep 6.2.
Fuzzy forecasts are obtained using (1). After R is estimated, fuzzy forecasts can be obtained by using FCM algorithm. For example, for any t, the (t-1)th fuzzy observation is given as follows:
(7)F(t-1)=[10.50.300],R=[10.5000001000000.500000010000].
The fuzzy forecast for t time is computed by (1) as follows:
(8)F^(t)=F(t-1)∘R=[10.50.300]∘[10.5000001000000.500000010000]=[10.50.50.30].Substep 6.3.
If the membership values of a fuzzy forecast have only one maximum, then select the center of this cluster as the defuzzified forecasted value. If the membership values of an fuzzy forecast has two or more maximum, then select the arithmetic mean of centers of the corresponding clusters as the defuzzified forecasted value. For example, ifF^(t)=[0.70.50.30.20.4], then the maximum is 0.7 and then the fuzzified forecast is (v1), center of L1. If F^(t)=[0.70.50.70.20.4], then the maximum is 0.7 and then fuzzified forecast is arithmetic mean of v1 center of L1 cluster and v3, center of L3.Substep 6.4.
RMSE is computed by (5).Step 7 (Natural selection operation).
All chromosomes are ordered according to the RMSE value. The best 20 chromosomes are transferred to the next generation. 10 chromosomes are discarded from the generation. The new 10 randomly generated chromosomes are replaced in the new generation.Step 8.
Steps4 and 7 are repeated 300 times.


## 6. Implementation

The proposed method is firstly applied to Alabama University Enrollment data (1971–1992) which is well known in the literature. The Enrollment data are given Table1.Table 1
Enrollment data.
Years
Actual
Years
Actual
1971
13055
1982
15433
1972
13563
1983
15497
1973
13867
1984
15145
1974
14696
1985
15163
1975
15460
1986
15984
1976
15311
1987
16859
1977
15603
1988
18150
1978
15861
1989
18970
1979
16807
1990
19328
1980
16919
1991
19337
1981
16388
1992
18876The proposed method is programmed in Matlab 7.9 version. In the application, we use seven fuzzy sets (c=7) in Step 1. The centers of clusters and the membership values from FCM algorithm are given Tables 2 and 3, respectively. The fuzzy and defuzzified forecasts are given in Table 4.Table 2
centers of clusters are obtained from FCM algorithm in  Step1.
Centers of clusters
v
1
v
2
v
3
v
4
v
5
v
6
v
7
13480,6299
15003,98
15455,4
15965,12
16837,86
18161,53
19144,4Table 3
The memberships of the observations to clusters are obtained from FCM algorithm in  Step1.
Years
Cluster 1
Cluster 2
Cluster 3
Cluster 4
Cluster 5
Cluster 6
Cluster 7
1971
0,8889
0,0424
0,0279
0,0190
0,0113
0,0062
0,0043
1972
0,9925
0,0032
0,0019
0,0012
0,0006
0,0003
0,0002
1973
0,8072
0,0932
0,0478
0,0274
0,0137
0,0065
0,0043
1974
0,0486
0,7570
0,1245
0,0446
0,0157
0,0060
0,0036
1975
0,0000
0,0001
0,9998
0,0001
0,0000
0,0000
0,0000
1976
0,0048
0,1716
0,7757
0,0378
0,0069
0,0020
0,0011
1977
0,0039
0,0485
0,7993
0,1328
0,0114
0,0027
0,0014
1978
0,0017
0,0135
0,0601
0,9116
0,0104
0,0019
0,0009
1979
0,0001
0,0003
0,0005
0,0013
0,9971
0,0005
0,0002
1980
0,0005
0,0018
0,0030
0,0071
0,9821
0,0042
0,0013
1981
0,0093
0,0409
0,0900
0,4378
0,3869
0,0249
0,0103
1982
0,0001
0,0027
0,9950
0,0018
0,0003
0,0001
0,0000
1983
0,0004
0,0070
0,9835
0,0078
0,0009
0,0002
0,0001
1984
0,0057
0,7977
0,1647
0,0236
0,0055
0,0017
0,0010
1985
0,0066
0,7367
0,2179
0,0290
0,0066
0,0021
0,0012
1986
0,0001
0,0004
0,0013
0,9977
0,0005
0,0001
0,0000
1987
0,0000
0,0001
0,0002
0,0006
0,9987
0,0003
0,0001
1988
0,0000
0,0000
0,0000
0,0000
0,0001
0,9997
0,0001
1989
0,0010
0,0018
0,0023
0,0032
0,0063
0,0438
0,9416
1990
0,0009
0,0017
0,0022
0,0029
0,0052
0,0239
0,9632
1991
0,0010
0,0019
0,0024
0,0031
0,0057
0,0258
0,9601
1992
0,0021
0,0041
0,0052
0,0072
0,0147
0,1196
0,8472Table 4
The forecasts of the proposed method.
Years
Fuzzy forecasts
Defuzzified forecasts
1972
0,8694
0,8279
0,7866
0,3820
0,2837
0,1199
0,0430
13480,63
1973
0,8694
0,8279
0,7866
0,3820
0,2837
0,1199
0,0430
13480,63
1974
0,8072
0,8072
0,7866
0,3820
0,2837
0,1199
0,0478
14242,00
1975
0,3643
0,5920
0,7570
0,7570
0,6596
0,4888
0,1245
15710,00
1976
0,5000
0,9998
0,3584
0,9998
0,8535
0,3184
0,2807
15484,55
1977
0,5000
0,7757
0,3584
0,7757
0,7757
0,3184
0,2807
15935,65
1978
0,5000
0,7993
0,3584
0,7993
0,7993
0,3184
0,2807
15935,65
1979
0,4219
0,7284
0,2815
0,7736
0,9116
0,0601
0,9043
16837,86
1980
0,0022
0,9009
0,0558
0,3246
0,9971
0,9971
0,5000
17499,69
1981
0,0071
0,9009
0,0558
0,3246
0,9821
0,9821
0,5000
17499,69
1982
0,4219
0,4378
0,2815
0,4378
0,4378
0,3869
0,4378
16737,00
1983
0,5000
0,9950
0,3584
0,9950
0,8535
0,3184
0,2807
15484,55
1984
0,5000
0,9835
0,3584
0,9835
0,8535
0,3184
0,2807
15484,55
1985
0,3643
0,5920
0,7977
0,7977
0,6596
0,4888
0,1647
15710,00
1986
0,3643
0,5920
0,7367
0,7367
0,6596
0,4888
0,2179
15710,00
1987
0,4219
0,7284
0,2815
0,7736
0,9977
0,0496
0,9043
16837,86
1988
0,0022
0,9009
0,0558
0,3246
0,9987
0,9987
0,5000
17499,69
1989
0,0001
0,0001
0,5000
0,5000
0,5000
0,5000
0,9997
19144,40
1990
0,0032
0,0063
0,0438
0,0438
0,0438
0,5000
0,5621
19144,40
1991
0,0029
0,0052
0,0239
0,0239
0,0239
0,5000
0,5621
19144,40
1992
0,0031
0,0057
0,0258
0,0258
0,0258
0,5000
0,5621
19144,40Consider(9)R=[0,86940,82790,78660,38200,28370,11990,04300,36430,59201,00001,00000,65960,48880,00000,50001,00000,35841,00000,85350,31840,28070,42190,72840,28150,77361,00000,04960,90430,00220,90090,05580,32461,00001,00000,50000,00000,00000,50000,50000,50000,50001,00000,00000,00000,00000,00000,00000,50000,5621].
The RMSE of well-known methods [2–4] is given in Table 5.Table 5
The RMSE values of the some first order methods and proposed method.
Methods
RMSE
Song and Chissom [2]
642,26
Sullivan and Woodall [4]
621,33
Chen [3]
638,36
Proposed method
484,61The proposed method is successively applied to daily Istanbul stock market time series data between 28/12/2010 and 29/02/2012 dates (IMKB 100). The graph of the time series is given in Figure4. The data between 28/12/2010 and 10/10/2011 dates are used as training data, the data between 11/10/2011 and 29/02/2012 dates are used as test data.Figure 4
The IMKB 100 data between 28/12/2010 and 29/02/2012.The number of fuzzy clusters is changed from 7 to 15. The obtained results from three methods are given in Table6.Table 6
The results of the methods for IMKB 100 data.
Method
Number of fuzzy sets
Min
Mean
7
8
9
10
11
12
13
14
15
Chen [3]
RMSE (training)
1420
1178
1340
1164
1281
1233
1152
1205
1090
1090
1252
RMSE (test)
1238
1132
1340
1191
1155
1131
1218
1125
1186
1125
1210
Song and Chissom [1, 2]
RMSE (training)
1462
1178
1340
1164
1281
1233
1140
1209
1105
1105
1257
RMSE (test)
1571
1132
1340
1191
1155
1131
1249
1121
1132
1121
1240
Proposed Method
RMSE (training)
1379
1271
1391
1360
1176
1176
1152
1089
1107
1089
1234
RMSE (test)
1565
1317
1291
1154
1118
1126
1039
1036
1022
1022
1185The RMSE values of the proposed method are smaller than Chen’s [3] and Song and Chissom’s [1, 2] methods.



---

*Source: 785709-2012-07-16.xml*