C++ Neural Networks and Fuzzy Logic C++ Neural Networks and Fuzzy Logic
by Valluru B. Rao
M&T Books, IDG Books Worldwide, Inc.
ISBN: 1558515526   Pub Date: 06/01/95
  

Previous Table of Contents Next


Now let’s review the steps:

1.  Split your data. First, divide you data set into three pieces, a training set, a test set and a blind test set. Use about 80% of your data records for your training set, 10% for your test set and 10% for your blind test set.
2.  Train and test. Next, start with a network topology and train your network on your training set data. When you have reached a satisfactory minimum error, save your weights and apply your trained network to the test data and note the error. Now restart the process with the same network topology for a different set of initial weights and see if you can achieve a better error on training and test sets. Reasoning: you may have found a local minimum on your first attempt and randomizing the initial weights will start you off to a different, maybe better solution.
3.  Eliminate correlated inputs. You may optionally try at this point to see if you can eliminate correlated inputs, as mentioned before, by iteratively removing each input and noting the best error you can achieve on the training and test sets for each of these cases. Choose the case that leads to the best error and eliminate the input (if any) that achieved it. You can repeat this whole process again to try to eliminate another input variable.
4.  Iteratively train and test. Now you can try other network parameters and repeat the train and test process to achieve a better result.
5.  Deploy your network. You now can use the blind test data set to see how your optimized network performs. If the error is not satisfactory, then you need to re-enter the design phase or the train and test phase.
6.  Revisit your network design when conditions change. You need to retrain your network when you have reason to think that you have new information relevant to the problem you are modeling. If you have a neural network that tries to predict the weekly change in the S&P 500, then you likely will need to retrain your network at least once a month, if not once a week. If you find that the network no longer generalizes well with the new information, you need to re-enter the design phase.

If this sounds like a lot of work, it is! Now, let’s try our luck at forecasting by going through a subset of the steps outlined:

Forecasting the S&P 500

The S&P 500 index is a widely followed stock average, like the Dow Jones Industrial Average (DJIA). It has a broader representation of the stock market since this average is based on 500 stocks, whereas the DJIA is based on only 30. The problem to be approached in this chapter is to predict the S&P 500 index, given a variety of indicators and data for prior weeks.

Choosing the Right Outputs and Objective

Our objective is to forecast the S&P 500 ten weeks from now. Whereas the objective may be to predict the level of the S&P 500, it is important to simplify the job of the network by asking for a change in the level rather than for the absolute level of the index. What you want to do is give the network the ability to fit the problem at hand conveniently in the output space of the output layer. Practically speaking, you know that the output from the network cannot be outside of the 0 to 1 range, since we have used a sigmoid activation function. You could take the S&P 500 index and scale this absolute price level to this range, for example. However, you will likely end up with very small numbers that have a small range of variability. The difference from week to week, on the other hand, has a much smaller overall range, and when these differences are scaled to the 0 to 1 range, you have much more variability.

The output we choose is the change in the S&P 500 from the current week to 10 weeks from now as a percentage of the current week’s value.

Choosing the Right Inputs

The inputs to the network need to be weekly changes of indicators that have some relevance to the S&P 500 index. This is a complex forecasting problem, and we can only guess at some of the relationships. This is one of the inherent strengths of using neural nets for forecasting; if a relationship is weak, the network will learn to ignore it automatically. Be cognizant that you do want to minimize the DOF as mentioned before though. In this example, we choose a data set that represents the state of the financial markets and the economy. The inputs chosen are listed as:

  Previous price action in the S&P 500 index, including the close or final value of the index
  Breadth indicators for the stock market, including the number of advancing issues and declining issues for the stocks in the New York Stock Exchange (NYSE)
  Other technical indicators, including the number of new highs and new lows achieved in the week for the NYSE market. This gives some indication about the strength of an uptrend or downtrend.
  Interest rates, including short-term interest rates in the Three-Month Treasury Bill Yield, and long-term rates in the 30-Year Treasury Bond Yield.

Other possible inputs could have been government statistics like the Consumer Price Index, Housing starts, and the Unemployment Rate. These were not chosen because long- and short-term interest rates tend to encompass this data already.

You are encouraged to experiment with other inputs and ideas. All of the data mentioned can be obtained in the public domain, such as from financial publications (Barron’s, Investor’s Business Daily, Wall Street Journal) and from ftp sites on the Internet for the Department of Commerce and the Federal Reserve, as well as from commercial vendors (see the Resource Guide at the end of the chapter). There are new sources cropping up on the Internet all the time. A sampling of World Wide Web addresses for commercial and noncommercial sources include:

  FINWeb, http://riskweb.bus.utexas.edu/finweb.html
  Chicago Mercantile Exchange, http://www.cme.com/cme
  SEC Edgar Database, http://town.hall.org/edgar/edgar.html
  CTSNET Business & Finance Center, http://www.cts.com/cts/biz/
  QuoteCom, http://www.quote.com
  Philadelphia Fed, http://compstat.wharton.upenn.edu:8001/~siler/ fedpage.html
  Ohio state Financial Data Finder, http://cob.ohio-state.edu/dept/fin/ osudata.html


Previous Table of Contents Next

Copyright © IDG Books Worldwide, Inc.