FUZZY TECHNIQUES FOR TIME SERIES PREDICTION KOTYRBA Martin, (CZ), VOLNA Eva, (CZ), JANOSEK Michal, (CZ), KOCIAN Vaclav, (CZ), HABIBALLA Hashim, (CZ) Abstract. This paper presents a comparison of two methods for time series prediction, LFLC (Linguistic Fuzzy Logic Controller) and FIS (Fuzzy Interface System). It is essential that both are applied to the time series prediction of market development. It is very difficult to predict the market behavior because the overall trend is determined by many factors and unforeseen circumstances. The main experiment of this paper is to compare results of prediction of two different methods of ranking fuzzy theory, the challenge is to create a forecast of the stock market. Key words. Fuzzy theory, prediction, FIS, LFLC, linguistic rules. Mathematics Subject Classification: Primary 93C42, 37M10 ; Secondary 91F20.
1
Stock Market Forecast
Various methods can be used for time series prediction. In addition to traditional methods, such as Box-Jenkins methodology, we can use neural networks, genetic algorithms or fuzzy logic. Algorithmic effort prediction models are limited by their inability to cope with uncertainties. Lots of researchers have been involved in the topic of fuzzy logic prediction [2], [3], [4], [5]. In this paper, we present a software prediction based on an appropriate combination of two fuzzy logic approaches, e.g. LFLC (Linguistic Fuzzy Logic Controller) and FIS (Fuzzy Interface System). Time series analysis and prediction is an important task that can be used in many areas of practice. The task of getting the best prediction to the given series may bring interesting engineering applications in a wide range of areas like economics, biology or industry. Sometimes time series analysis and prediction is performed using chaos theory. Economic systems are complex and may be described by deterministic or stochastic models. The discovery that simple non-linear systems can show complex and chaotic dynamics has attracted some economists to work in this field. It is well known that chaotic time series are not long-term predictable due to their sensitive dependence on initial values. However, it is short-term predictable and prediction of chaotic time series is very important in real-world applications such as cash-flow forecasting. Based on the reconstructed state
585
space, one may introduce various approaches for prediction of chaotic time series. Market systems appear to be chaotic. One of the essential characteristics of a chaotic system is its extreme sensitivity to initial conditions. A tiny change in values at the beginning of the time series produces drastic changes in behavior. However, it is obvious that financial markets do not exhibit such extreme sensitivity to initial conditions. For example [4], stocks are sold or bought based on their prices. The price depends on how much has been bought or sold. The feedback loop has both positive and negative effects. The law of supply and demand implies a negative feedback loop, because the higher the price, the lower the demand, which, in fact, causes a lower price in the future. However, a parallel speculation mechanism implies a positive feedback loop, because an increasing price makes an assumption that the price will increase in the future and thus motivate the traders to buy more stocks. As we do not know the delay the between these two effects we are not able to predict anything well. These nonlinear effects are common in the markets. Nevertheless, it is fair to say that the markets are not purely chaotic. Although a chaotic system is a collection of orderly, simple behaviors, modeling the market has turned out to be more difficult than anticipated. The problem is that chaotic systems can be unusually flexible and rapidly switch between their many different behaviors. One way to isolate these individual behaviors of the market might lie in a presumption that when the market is perturbed in just the right way (e.g. a large drop in price), it would exhibit one of its many regular behaviors for a short time. In the meantime, constructing leading indicators is difficult, that is why a forecast horizon for any market time series is limited. The only possibility we can do with such a system is to adapt its behavior as quickly as possible. 2
Linguistic Fuzzy Logic Controller
This chapter describes a tool that has been created at the Institute for Research and Applications of Fuzzy Modeling (IRAFM) at the University of Ostrava. This is a really a really powerful application giving good results in some cases. The usage of this tool within the frame of time series prediction lies in learning linguistic rules from the series and then application to future predicted members of the series. These leasing algorithms are already prepared within the LFLC (Linguistic Fuzzy Logic Controller) software [5], which is intended to perform logical deduction on linguistic rules. The core of the system also serves for the presented application. LFLC is specialized software (Fig.1), which is based on deep results obtained in formal theory of fuzzy logic. It makes it possible to deduce conclusions on the basis of imprecise description of the given situation using fuzzy IF-THEN rules (1). The rules are interpreted either as fuzzy relations or they can be taken as genuine linguistic expressions such as small, very large, medium etc. The rule interpretation is then done by logical deduction based on the fuzzy set theory and fuzzy logic to enable to deduce conclusions on the basis of imprecise description of the given situation using linguistically formulated fuzzy IF-THEN rules [5]. The theory of linguistic term and variables is a well-known approach in the fuzzy logic community. The fuzzy IF – THEN rules are usually put together to form linguistic descriptions. R 1 := IF X 1 is A11 AND ... AND Xn is A1n THEN Y is B1 ............................................................................................. R m:= IF X 1 is Am1 AND ... AND X n is Amn THEN Y is Bm
586
(1)
Figure 1. LFLC 3
Fuzzy Interface System
This chapter presents Fuzzy Inference System (FIS) that is included into Matlab - Fuzzy Logic Toolbox designed for time series prediction. FIS is based on the concepts of fuzzy set and fuzzy relations, which were defined by Lotfi A. Zadeh in 1965. Fuzzy sets generalize classical sets. Fuzzy Logic Toolbox contains Fuzzy Interface System (FIS) and allows working with fuzzy sets. It discusses the appropriate choice and use of the FIS (Sugeno type) for given time series prediction [1]. Fuzzy sets are sets whose elements have degrees of membership. Fuzzy sets introduce an extension of the classical notion of a set. In the classical set theory, the membership of elements in a set is assessed in binary terms according to a bivalent condition - an element either belongs (full membership in the set) or does not belong to the set (no membership in the set). A fuzzy set is a set which in addition to full or no membership allows partial membership. This means that the element belongs to the set with a certain degree of competence - level of competence. Function that assigns to each element of the universe is called the membership degree of membership functions. Given the classical set theory the degree of membership takes values in the range 0, 1. Function A is the membership functions of the fuzzy set A. Each element x X assigns an element A x 0;1 , which is called degree of membership of element x in fuzzy set A. If
A x 0 then x does not belong to fuzzy set A and if A x 1 then x belongs to fuzzy set A. If
587
0 A x 1 then x partially belongs to the fuzzy set A. Formal registration of a fuzzy set is the following (2): x A A i for xi xi
(2)
There are more types of FIS. To solve our problem, we used FIS type P: u = R (e), where output values depend only on the size of the input values. The shape of the rules distinguishes between the FIS type: Mamdani and Sugeno. Mamdani FIS rules are described exclusively by means of fuzzy sets. To define the FIS we need to determine the following [1]: - Number of the input variables (n) - For each of them to determine the number and shape of the predefined input values that can be considered as model inputs - Number of the output variables (m) - For each of them to determine the predefined output value Input and output values (which are considered in the form of fuzzy sets) are defined in the FIS rules follows (3).
k = IF x 1 is A kj ,1 and x2 is A kj, 2 and … and xn is A kj , n then z k = B kj
(3)
Each rule determines the relationship between the selected input and output values. FIS can be regarded as fuzzy relations. When using FIS, input values are compared with the predefined input values. Based on this comparison and by FIS rules, we get the shape of the FIS output fuzzy sets [1]. Parameters that most affect the quality of the result are input variables, therefore very often used for debugging the matrix (4) that is used to create a language of values, rules, and to debug the FIS.
x1L,1 L x L XY 2,1 ... xL K ,1 4
... x1L,n ... x2L,n ... ... ... xKL ,n
y1L,1 y2L,1 ... y KL ,1
... y1L,m ... y2L,m ... ... ... y KL ,m
(4)
Comparative experiments
Time series stock market development activities of company Ebay Corp. has been used in our prediction experiments. Data was downloaded from [http://www.forexrate.co.uk/historydates]. This is a 100-week data set depending on the volume, (see Fig. 2), and its following 20-week prediction. Results are reported in two different approaches that were compared mutually. It is volume, after price, which is one of the most commonly quoted data points related to the stock market. Reflecting the overall activity in the stock or market, volume is the business of the market itself: buying and selling of shares. As such, volume is an important indicator for traders in analyzing market activity and planning strategy.
588
Figure 2. 100-week progress
We used the Sugeno type FIS for predicting time series volume indicators. FIS has been designed to predict one subsequent value on the basis of previous values. The requirement was to forecast the next 20 values. For 100 values were tuned Fuzzy Inference System as it was carried out using 20 projections. Clustering methods were used for week values in order to find a suitable base of fuzzy rules. There were approximately 20 estimates carried out on the data with using MAPE to select the most appropriate estimate to real values. The results are compared using MAPE (5), which gives a deviation of the predicted course from the real one. K MAPE 1 ( abs( ph - rh ) rh ) K h 1
(5)
Figure 3. Comparison of prediction methods
LFLC predicts the development of series with MAPE = 0.19 and the FIS did not go for anything less and MAPE = 0.21 (Fig 3). 5
Conclusion
Our comparison is based on fuzzy technology and it will provide a very interesting look at the different possibilities of prediction. The aim of the article was to use FIS and LFLC methods based
589
on fuzzy logic to make difficult time series prediction of stock prices. Despite their different approaches, both methods show their ability to predict unusually large stock market development Acknowledgements
The paper was supported by the University of Ostrava grant SGS/PřF/2011. Any opinions, findings and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the sponsors. References
[1] [2] [3] [4] [5]
ŽÁK, L Generalization of Fuzzy Clustering for Vaguely Defined Objects, 9th Zittau Fuzzy Colloquium, Zittau, 2001, pp. 268-277, ISBN 3-9808089-0-4. ŽÁK, L. Fuzzy Inference System and Prediction. In International Conference on Soft Computing, Kunovice, Czech Republic: n, 2004. pp. 31-36. ISBN: 80-7314-025-X. KUO RJ, CHEN CH, HWANK YC:“An intelligent stock trading decision Support system Fuzzy neural network “, Fuzzy Sets and Systems, 118(1): pp. 21-45, 2001. PERFILIEVA, I., NOVÁK, V., PAVLISKA, V., DVOŘÁK, A., ŠTĚPNIČKA, M. Analysis and Prediction of Time Series Using Fuzzy Transform. WCCI 2008 Proceedings. Hong Kong: IEEE Computational Intelligence Society, 2008. pp. 3875-3879. DVOŘÁK, A., HABIBALLA H., NOVÁK, V., PAVLISKA, V. The concept of LFLC 2000. Computers in Industry. 03/2003(51), Elsevier, Amsterdam, 2003, pp.269-280.
Current address Martin Kotyrba, Mgr. University of Ostrava, Faculty of Science, Dept. of Informatics and Computers, 30.dubna 22,70103 Ostrava, Czech Republic, email:
[email protected] Eva Volná, doc. RNDr. PaedDr. PhD. University of Ostrava, Faculty of Science, Dept. of Informatics and Computers, 30.dubna 22,70103 Ostrava, Czech Republic, email:
[email protected] Michal Janošek, Mgr. University of Ostrava, Faculty of Science, Dept. of Informatics and Computers, 30.dubna 22, 70103 Ostrava, Czech Republic, email:
[email protected] Václav Kocian, Mgr. University of Ostrava, Faculty of Science, Dept. of Informatics and Computers, 30.dubna 22, 70103 Ostrava, Czech Republic, email:
[email protected] Hashim Habiballa, RNDr. PaedDr. PhD. Ph.D. University of Ostrava, Faculty of Science, Dept. of Informatics and Computers, 30.dubna 22, 70103 Ostrava, Czech Republic, email:
[email protected]
590