Open Access Open Access  Restricted Access Subscription or Fee Access

Data Mining the Financial Time Series with K-Nearest Neighbours Predictive Model

S. Thirupparkadal Nambi, Dr. M.V. Subha


As we live in knowledge era, most of the organisations have rightly come to the realisation that the most important Critical Success Factor (CSF) is the knowledge the company has acquired. But the key question is how to acquire process and manage the knowledge. This necessitates the development of new disciplines such as Artificial Intelligence, Knowledge Management, Data mining etc. Data mining is the new discipline aimed at mining the data to discover knowledge for the organization. Forecasting is the fundamental problem of an organization. There has always been a growing interest in trying to predict the stock prices and to identify the future trend of the stock market. There is plethora of traditional and modern tools that have been used to test whether the stock prices are predictable with acceptable level of accuracy. This paper attempts to mine the time series data for forecasting the stock prices/index values. The primary objective of the study is to mine the time series data by building a model using KNN algorithm to predict the stock and index values. The secondary aim of the study is to validate the model by comparing its prediction results with that of the traditional prediction tool of regression technique. As an example for the time series, closing stock prices of two actively traded companies (Infosys Technologies & Associated Cement Company) and two major stock market indices (BSE SENSEX & NSE Nifty) for the period from 1st Jan 2010 to 12th April 2010 has been taken as a sample for study. Data mining is done by the K-Nearest Neighbour (KNN) model to predict the future values. Here the data set has been divided into training data set and test data set. The model leans from the training data set and makes prediction for the test data set. The difference between the actual values of the time series and the predicted values from the test data set is used for evaluating the performance of the predictive model. Then the model is validated by comparing the outcome of the predictive model with the predictions from the traditional Regression model for the same test data. It is found that the results are encouraging as the KNN predictive model outperforms the regression mode in all the four cases. Nevertheless it needs to be studied deeper.


Data Mining, K-Nearest Neighbour, Time Series Forecasting, Predictive Model.

Full Text:



Aiken, M.A and M.Bsat. (1999), “Forecasting Market Trends with Neural Networks.” Information Systems Management 16($), 42-48.

Alex Berson, Stephan Smith, Kurt Thearling (2000) “Building data Mining Applications for CRM” Tata McGraw Hill, New Delhi.

Anderson R. David, Sweeney J Dennis, Williams A. Thomas, (2003) “An Introduction to Management Science – Quantitative approaches to Decision making”, Tenth Edition, Thomson South-Western Publication.

Cao, L. and F.E.H. Tay. (2001)”Financial forecasting Using support Vector Machines,” Neural Computing and Applications (2001) 10:184-192.

Chiang, W.C, T.C.Urban & G.W.Balridge. (1996) “A Neural Network Approach to Mutual Fund Net Asset Value Forecasting.” Omega, International Journal of Management Science 24(2), 205-215.

Edelman, D., P.Davy and Y.L.Chung. (1999) “Using Neural Network Prediction to achieve excess retu4rns in the Australian All-Ordinaries Index.” In Queensland Financial Conference, September 30th & October 1st, Queensland University of Technology.

Goldfeld S.M., Quandt R.E., (1973) “A Markov Model for Switching Regressions”, Journal of Econometrics, 1, pp. 3-11.

Hamilton, J.D. (1989), “ A New Approach to the Economic Analysis of Non stationary Time Series and the Business Cycle”, Econometrica, 57, pp. 357-384.

Jarrett, J. and Kyper E. (2006), „„Capital market efficiency and the predictability of daily returns‟‟, Applied Economics, Vol. 38, pp. 631-6.

Jiawei Han, Micheline Kamber “Data Mining Concepts & Techniques” Second Edition (2000), Morgan Kaufmann Publishers, San Francisco.

John E. Hanke, Dean W. Wichern “Business Forecasting”, Eighth Edition, 2005, Prentice Hall, New Delhi.

Mender&all and Beaver, Introduction to Probability and Statistics, Ninth Edition, International Thomson Publishing, 1994.

Kato, K. (1990a), „„Weekly patterns in Japanese stock returns‟‟, Management Science, Vol. 36,

Kato, K. (1990b), „„Being a winner in the Tokyo stock market‟‟, Journal of Portfolio Management Vol.16, pp. 52-6.

Kim, K-J and I.Han.(2000) “Genetic algorithms approach to feature discretization in Artificial Neural Networks for the prediction of stock price index,” Published by Elsevier Science, Limited, Expert Systems with Applications, 19, 125-132.

Kim, S.H. and S.H.Chun. (1998) “Graded forecasting using an array of bipolar predictions: application of probabilistic neural networks to a stock market index.” International Journal of Forecasting, 14, 323-337.

Kuo, R.J, L.C.Lee & C.F.Lee. (1996) “Integration of Artificial Neural Networks & Fuzzy Delphi for Stock Market Forecasting.” IEEE, June, 1073-1078.

Manish Kumar, Thenmozhi M, (2005) “Forecasting Stock Index Movement: A Comparison of Support Vector Machines and Random Forest”, Proceedings of the Ninth Capital Markets Conference, Volume 1.

Moorkejee, R. and Yu, Q. (1999), „„Seasonality in returns on the Chinese stock markets: the case of Shanghai Shenzhen‟‟, Global Finance Journal, Vol. 10, pp. 93-105.

Ray, B., Chen, S. and Jarrett, J.E. (1997), „„Identifying permanent and temporary components in Japanese stock prices‟‟, Financial Engineering and the Japanese Markets, Vol. 4, pp. 233-56.

Samanta G P, Sanjib Bordoloi, (March 2005) “Predicting Stock Market – An application of Artificial Neural Network Technique through Genetic Algorithm”, Finance India, Vol.XIX, No.1, pp.173-188.

Thammano, A. (1999) “Neuro-Fuzzy Model for Stock Market Prediction,” in Dagli, C.H., A.L.Buczak, J.Ghosh, M.J.Embrechts, and O. Ersoy(Eds), Smart Engineering System Design: neural networks, fuzzy logic, evolutionary programming, data mining and complex systems, Proceedings of the Artificial Neural Networks in Engineering Conference (ANNIE‟ 99), New York: ASME Press, pp.587-591.

Van E Robert J. The application of neural networks in the forecasting of share prices. Haymarket, VA, USA: Finance and Technology Publishing, 1997.

White, H. (1988), “Economic Prediction using Neural Networks: The Case of IBM Daily Stock Returns” in Proceedings of the Second Annual IEEE Conference on Neural Network, II: 451-458.


  • There are currently no refbacks.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.