Next-Day Stock Trend Prediction Using the Self

0 downloads 0 Views 69KB Size Report
Self-organizing Associative Memory (SAM) System ... As more and more non-redundant data are stored, the SAM becomes “adapted” .... domain. Since the market trend prediction may be either “up” or “down,” the profit generated since day 1.
Next-Day Stock Trend Prediction Using the Self-organizing Associative Memory (SAM) System Wei Kang Tsai and Wei-min Chiu Dept. of Electrical and Computer Engineering University of California, Irvine Irvine, CA 92717 [email protected]

Abstract: A data approach at system identification that is relatively design free and requires only one pass of the training data is implemented to simulate next-day stock market trends on real NYSE prices over 15 years (3,081 days). The SAM system may be used to enhance predictions of relevant technical indicators. 1. Motivation The highly nonlinear task of stock market trend prediction has increasingly been done using adaptive and soft-computing methods such as modern control theory, neural networks and fuzzy expert systems. Neural networks, particularly the multi-layer perceptron (MLP), shown by Kolmogorov to be an universal approximator given the right network design [3], has gained its due popularity in this application. The MLP uses the parameter approach, which necessitates a definition of a set of system parameters and the optimization of those parameters to produce a “learned” or “adaptive” system. For that, the MLP is very design-intensive: we need to design the initial weights, activation function, weighting function, bias, learning step size, and the training rule [2]. Too many or too few neurons or layers may affect the MLP’s ability to learn or emulate the stock system. There are variations to the MLP in [1], [4], [5], etc., all of whom still depend on the optimization of a fixed set of parameters. The design-intensiveness of the parameter approach motivates the data approach. Instead of a system represented by a stored function generalized from the training data, the data approach would represent the system by deriving local functions from a stored set of relevant training data. The Self-organizing Associative Memory system is a data-based alternative which is virtually design-free and requires only one pass of the training data. 2. Self-organizing Associative Memory (SAM) System SAM’s procedure is simple: present the system with a new input point; the new input evokes an association of the closest neighboring points; should the association yield an output of the new point reasonably well then the new point is familiar and deemed redundant; if the association of the stored neighboring points proves inaccurate for the new point then the new point is novel and it is memorized. As more and more non-redundant data are stored, the SAM becomes “adapted”

to the system. Since the SAM recognizes and stores each and every novel data, the training only requires one pass of the data.

0.6

0.6

0.4

0.4

0.2

0.2

0

0

-0.2

-0.2 2

4

6

8

1 0

1 2

0.6

0.6

0.4

0.4

0.2

0.2

0

0

-0.2

-0.2 2

4

6

8

1 0

1 2

2

4

6

8

1 0

1 2

2

4

6

8

1 0

1 2

Figure 1: Adaptation of SAM to a Function Given More and More Data Given an input, SAM will search in the input-space of the stored data for the closest neighbors, and generalize these neighboring data into a neighborhood or local function. Should the percentage error between the desired output y and the predicted output y’ of the given input exceed some error threshold ε1, the given input and its corresponding desired output are stored.

ε = y − y'

2

(

min y 2 , y '

2

)

(1)

Many nonlinear approximation methods such as weighted linear combinations and weighted pseudoinverse were attempted, but the safest approximation relating a set of points in ddimensional input space may be a (d+1)-dimensional hyperplane. Given that the input is in ddimensions, the linear SAM gathers d+1 closest stored neighbors in the input-space xiT and their corresponding outputs yi into a matrix augmented by a ‘1’ as reference for the hyperplane:  1 x1T   y     w0   1     T  =    , or Aw = f , w     1    1 x dT+1   y d +1 

(2)

w = A + f = ( A T A ) −1 A T f

(3)

the hyperplane being the weight vector w in (d+1)-space. Given that sometimes the matrix A may be singular or near-singular and to allow the freedom for over-determined systems, we use the least squares solution pseudoinverse [6] with singular-value decomposition for singular cases in equation (3). Figure 2 below illustrates the general procedure of SAM in this context.

{A, f} x

y’

ε < ε1 ?

Figure 2: General Procedure of SAM 3. Next-Day Prediction of Stock Market Trends SAM is employed in the generally difficult task of predicting the next-day stock trends, predicting whether the stock prices tomorrow would go up or down relative to today’s prices. A way to do so would be to first predict the percentage change of the price between today and tomorrow, and use the sign of the predicted percentage change to determine the next-day market trend. The desired output may be formulated in equation (4), where p(n) is the price on day n, and %p(n+1) is the percentage change in the price between day n+1 and n: p(n + 1) − p(n) p (n ) [ pclose (n) − plow (n)] − [ phigh (n) − pclose (n)]

% p(n + 1) = X ( n) =

phigh (n) − plow (n)

(4) (5)

Among a wide array of combinations of stock market technical indicators to use as inputs for this prediction, a relevant one is the “X-indicator” in equation (5), a component in general Accumulation-Distribution and Money Factor indicators that indicates the position of the close price relative to the high and low prices of the day. An experiment is set up to simulate next-day market trend predictions of the New York Stock Exchange closing average price over 3,081 days (April 1980 through June 1995). A SAM system is set up to begin learning the real NYSE data from day 1 and predict the next-day trend each day until day 3,081. To regulate the randomness, the desired output training set is quantized into 5 levels in the domain (-1,+1) of X(n), and for input we input four versions of the X-indicator at different levels of quantization (3, 5, 7, levels and no quantization, respectively) over the same domain. Since the market trend prediction may be either “up” or “down,” the profit generated since day 1 may be calculated by having the investor buy on “up” predictions and sell on “down” predictions. The results of the SAM is compared with that of using the day-before X-indicator and Buy and Hold (B&H), in which case the investor buys everyday (see Figure 3).

profit 7 6 5

X-ind

4 SAM 3 B&H 2 1 0

0

500

1000

1500 days

2000

2500

3000

Figure 3: Plot of profits over 3,081 days starting at $1.00 on day 1 Prediction method Correct predictions “Up” prediction percentage Buy and Hold 54.30% 100% SAM training on the X-indicator 52.65% 56.52% X-indicator 52.00% 56.06% Table: Next-day market trend prediction 4. Discussion and Conclusion While the simplistic Buy and Hold method has the highest percentage correct predictions, the SAM and the X-indicator runs have almost double the accumulated profit over the 3,081 days. The use of the SAM has improved upon the X-indicator prediction in terms of percentages and profits. The difference in the criteria of the correct prediction percentage and profit indicates that the X-indicator and the SAM trained on the X-indicator are more apt at making the correct predictions in times of large price changes. In all, the data approach makes SAM a design-free and a fast one-pass alternative to the parameter approach of most neural networks. In the prediction of next-day stock trend prediction, the SAM may improve upon the performance of relevant technical indicators.

References [1] Jang, J. R. "Self-Learning Fuzzy Controllers Based on Temporal Back Propagation IEEE Trans. Neural Networks Vol. 3 No. 5 (Sep. 1992) 714-723. [2] Kosko, B. Neural Networks and Fuzzy Systems. Englewood Cliffs, NJ: Prentice, 1992. [3] Lippmann, R. P. "An Introduction to Computing with Neural Nets". ASSP Magazine Vol. 4. No. 2 (Apr. 1987) 4-18. [4] Pedrycz, W. Fuzzy Control and Fuzzy Systems: 2nd Ed. New York: Wiley, 1993. [5] Ruck, D. W., S. K. Rogers, M. Kabrisky, P. S. Maybeck, and M. E. Oxley. “Comparative Analysis of Backpropagation and the Extended Kalman Filter for Training Multilayer Perceptrons.” IEEE Trans. on Pattern Analysis and Machine Intelligence Vol. 14 No. 6 (June 1992) 686-691. [6] Santina, M., A. R. Stubberud, G. H. Hostetter. Digital Control System 2nd ed. Fort Worth: Saunders, 1994.