16-07-2014, 03:07 PM
Web-based Fuzzy Neural Networks for Stock Prediction
Web-based Fuzzy.doc (Size: 170 KB / Downloads: 54)
Abstract
A web-based stock prediction system is developed based on a fuzzy neural network by using the past stock data to discover fuzzy rules and make future predictions. The learning algorithm is implemented. Input data to each network are the moving averages of the weekly stock data, which are obtained from http://moneycentral.msn.com. The output simulation data are also the average values of the weekly stock data. After the input data are collected from the website for the specific term using web search techniques, the system is trained and then is able to make future predictions. To implement this stock prediction System, JSP (Java Server Page), JDK1.3, JSP server and IE server 5.0 are used.
. INTRODUCTION
The financial market different from a lot of physical systems like we know the weather is that the financial market is a sort of complex feedback mechanism. What people expect prices to be affects the prices they observe and then the prices they observe then affects how they are going to form their expectations about what the prices will be in the next period. The market is basically an uncertain beast or an uncertain institution, it’s an institution where people trade risk, swap risk, and that’s why it’s there. And so if it were possible to predict it there would be no risk. In individuals, I think there cannot be any publicly available system to predict a financial market. On the other hand, neural networks have been found useful in stock price prediction [1-2]. Both feedforward and recurrent neural networks have been investigated and good results have been obtained. That means the prediction software would be very useful to assist individuals in reaching a final decision. In this paper, assuming that it is possible to predict markets, a prediction system is developed using fuzzy neural networks with a learning algorithm to predict the future stock values. The system consists of several neural networks modules. These models are all used to learn the relationships between different technical and economical indices and the decision to buy or sell stocks. The inputs to the networks are technical and economic indices. The output of the system is the decision to buy and sell. There are several neural network methods for stock prediction, such as Time Series method, Recurrent neural network and Feed-forward neural network method, etc. [2]. When compared to these techniques, Fuzzy neural network is a very useful and effective method to process, which is explained in the later sections.
The learning algorithm is used to train the networks. Before learning starts, tolerances are defined for the output units. During learning, the weights are updated only when the output errors exceed the tolerances. The learning data for which the output errors do not exceed the tolerances are eliminated from the training data sets. The input data to each network are the moving averages of the weekly averaged data which are obtained directly by using a Java program from the website. The output simulation data is also the average values of the weekly stock data
MODEL ANALYSIS
Time series forecasting analyzes past data and projects estimates of future data values. Basically, this method attempts to model a nonlinear function by a recurrence relation derived from past values. The recurrence relation can then be used to predict new values in the time series, which hopefully will be good approximations of the actual values. There are two basic types of time series forecasting: univariate and multivariate. Univariate models, like Box-Jenkins, contain only one variable in the recurrence equation. The equations used in the model contain past values of moving averages and prices. Box-Jenkins is good for short-term forecasting but requires a lot of data, and it is a complicated process to determine the appropriate model equations and parameters. Multivariate models are univariate models expanded to "discover casual factors that affect the behavior of the data." [3-4]. As the name suggests, these models contain more than one variable in their equations. Regression analysis is a multivariate model, which has been frequently compared with neural networks. Overall, time series forecasting provides reasonable accuracy over short periods of time, but the accuracy of time series forecasting diminishes sharply as the length of prediction increases. Many other computer-based techniques have been employed to forecast the stock market. They range from charting programs to sophisticated expert systems. Fuzzy logic has also been used. Expert systems process knowledge sequentially and formulate it into rules. They can be used to formulate trading rules based on technical indicators. In this capacity, expert systems can be used in conjunction with neural networks to predict the market. In such a combined system, the neural network can perform its prediction, while the expert system could validate the prediction based on its well-known trading rules. The advantage of expert systems is that they can explain how they derive their results. With neural networks, it is difficult to analyze the importance of input data and how the network derived its results. However, neural networks are faster because they execute in parallel and are more fault tolerant.
The major problem with applying expert systems to the stock market is the difficultly in formulating knowledge of the markets because we ourselves do not completely understand them. Neural fuzzy networks have an advantage over expert systems because they can extract rules without having them explicitly formalized. In a highly chaotic and only partially understood environment, such as the stock market, this is an important factor. It is hard to extract information from experts and formalize it in a way usable by expert systems. Expert systems are only good within their domain of knowledge and do not work well when there is missing or incomplete information. Neural networks handle dynamic data better and can generalize and make "educated guesses." Thus, neural networks are more suited to the stock market environment than expert systems. In the wide variety of different models presented so far, each model has its own benefits and shortcomings. The best way is that these methods work best when employed together. The major benefit of using a fuzzy neural network then is for the network to learn how to use these methods in combination effectively, and hopefully learn how the market behaves as a factor of our collective consciousness
. SYSTEM IMPLEMENTATION
4.1 Input Data & Software Parameters
The system can predict future for any stock or market index. For example to predict Microsoft stock values for some days ahead, historical data is required. Data for neural networks is probably the most important aspect for training. Without user intervention a particular stock data is obtained from the Internet directly as user’s requirement, in this process, user can determine which stock and how long of price information he wants to get. Preprocessing operation is needed as preparatory step for next stage. As an example of preprocessing, the downloadable data is daily price, it is need to be grouped by week, and the average of each week are calculated for the next step. A HTML parser that coded in java is used to retrieve data. This program parses the whole file line by line to get the needed information and insert them into the database. All of training data are arranged for 2-input-1-output system as this format: (d1, d2 --- d3), (d2, d3 ---d4), where, for the first vector, d1 and d2 are inputs and d3 is an output, and in the second vector, d2 and d3 are inputs and d4 is an output.
There are some parameters, which we have to use during the training period. They are error, threshold, tolerance, etc. The accurate results depend on these parameters. To achieve our target rapidly, some parameters are preprocessed. For example, in the fuzzy member function 1 and 2, there are two important parameters: center and width of the fuzzy set. Their initial values have critical impact on the performance of system. The random value generated by machine is not optimal. In this system, we propose a simple way to optimize the initial value: sort all of data obtained from internet, and then divide data into five groups, get the average value of each group, these values are used in member function as the initial value of fuzzy set center.
The prediction algorithm takes all these parameters as input. This algorithm is called when we click predict future from the system after entering the stock symbol. This algorithm makes the neural network learn. The algorithm returns the future values as output witch are eventually stored in results table for each stock. We will keep track of these results until we click on the average error for all simulations for this particular stock. Java program displays all the results of predictions for any particular stock at a time on the web page and clears the contents of the table.
. CONCLUSION
After completing several simulations for predicting several stocks based on the past historical data using fuzzy neural network with the Back-Propagation learning algorithm, it is conclusive that the average error for simulations using lots of data is smaller than that using less amount of data. That is, the more data for training the neural network, the better prediction it gives. If the training error is low, predicted stock values are close to the real stock values.
One possibility for future work is to update the system, so that it can read the past stock data automatically from the web. In this way the system will become Internet ready for predicting any stock market and is ready at any time. Another possibility for future work is to update the system, which can allow to trade the stock, which means users can manage to buy and sell the stock after seeing the prediction values from this system. In this way the system can eventually become Internet ready to be used anywhere in the world at any time. It is also possible to make the fuzzy neural Web-based stock prediction system as a commercial application by updating such that it gives more user-friendly functionality and by giving more valuable information to the users on palm machine.