Docsity

Advances in Similarity-Based Retrieval of Time Series Data, Notas de estudo de Matemática Computacional

Pré-visualização parcial do texto

Baixe Advances in Similarity-Based Retrieval of Time Series Data e outras Notas de estudo em PDF para Matemática Computacional, somente na Docsity!

DATA MINING IN

TIME SERIES DATABASES

Series in Machine Perception and Artificial Intelligence - Vol, 57

DATA MINING IN

TIME SERIES DATABASES

Editors

Mark Last

Ben-Gurion LIniversity of the Negeu, Israel

Abraham Kandel

Zl-Auiv University, Israel University of South Florida, Tampa, LISA

Horst Bunke

University of Bern, Switzerland

vp World Scientific

N E W J E R S E Y * L O N D O N * S I N G A P O R E B E l J l N G S H A N G H A I H O N G K O N G T A I P E I C H E N N A I

British Library Cataloguing-in-Publication Data A catalogue record for this book is available from the British Library.

For photocopying of material in this volume, please pay a copying fee through the Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, USA. In this case permission to photocopy is not required from the publisher.

ISBN 981-238-290-

Typeset by Stallion Press Email: [email protected]

All rights reserved. This book, or parts thereof, may not be reproduced in any form or by any means, electronic or mechanical, including photocopying, recording or any information storage and retrieval system now known or to be invented, without written permission from the Publisher.

Copyright © 2004 by World Scientific Publishing Co. Pte. Ltd.

Published by

World Scientific Publishing Co. Pte. Ltd. 5 Toh Tuck Link, Singapore 596224 USA office: 27 Warren Street, Suite 401-402, Hackensack, NJ 07601 UK office: 57 Shelton Street, Covent Garden, London WC2H 9HE

Printed in Singapore by World Scientific Printers (S) Pte Ltd

DATA MINING IN TIME SERIES DATABASES Series in Machine Perception and Artificial Intelligence (Vol. 57)

This page intentionally left blank

Preface

Traditional data mining methods are designed to deal with “static” databases, i.e. databases where the ordering of records (or other database objects) has nothing to do with the patterns of interest. Though the assump- tion of order irrelevance may be sufficiently accurate in some applications, there are certainly many other cases, where sequential information, such as a time-stamp associated with every record, can significantly enhance our knowledge about the mined data. One example is a series of stock values: a specific closing price recorded yesterday has a completely different mean- ing than the same value a year ago. Since most today’s databases already include temporal data in the form of “date created”, “date modified”, and other time-related fields, the only problem is how to exploit this valuable information to our benefit. In other words, the question we are currently facing is: How to mine time series data? The purpose of this volume is to present some recent advances in pre- processing, mining, and interpretation of temporal data that is stored by modern information systems. Adding the time dimension to a database produces a Time Series Database (TSDB) and introduces new aspects and challenges to the tasks of data mining and knowledge discovery. These new challenges include: finding the most efficient representation of time series data, measuring similarity of time series, detecting change points in time series, and time series classification and clustering. Some of these problems have been treated in the past by experts in time series analysis. However, statistical methods of time series analysis are focused on sequences of values representing a single numeric variable (e.g., price of a specific stock). In a real-world database, a time-stamped record may include several numerical and nominal attributes, which may depend not only on the time dimension but also on each other. To make the data mining task even more com- plicated, the objects in a time series may represent some complex graph structures rather than vectors of feature-values.

vii

Preface ix

“objects” may be particularly beneficial for the areas of process con- trol, intrusion detection, and character recognition. In Chapter 7, Carlos J. Alonso Gonz´alez and Juan J. Rodr´ıguez Diez present a new method for early classification of multivariate time series. Their method is capable of learning from series of variable length and able of providing a classification when only part of the series is presented to the classifier. A novel concept of representing time series by median strings (see Chapter 8, by Xiaoyi Jiang, Horst Bunke, and Janos Csirik) opens new opportunities for applying clas- sification and clustering methods of data mining to sequential data. As indicated above, the area of mining time series databases still includes many unexplored and insufficiently explored issues. Specific sug- gestions for future research can be found in individual chapters. In general, we believe that interesting and useful results can be obtained by applying the methods described in this book to real-world sets of sequential data.

Acknowledgments

The preparation of this volume was partially supported by the National Institute for Systems Test and Productivity at the University of South Florida under U.S. Space and Naval Warfare Systems Command grant num- ber N00039-01-1-2248. We also would like to acknowledge the generous support and cooperation of: Ben-Gurion University of the Negev, Department of Information Sys- tems Engineering, University of South Florida, Department of Computer Science and Engineering, Tel-Aviv University, College of Engineering, The Fulbright Foundation, The US-Israel Educational Foundation.

January 2004 Mark Last Abraham Kandel Horst Bunke

This page intentionally left blank
This page intentionally left blank
CHAPTER 1
SEGMENTING TIME SERIES: A SURVEY AND
NOVEL APPROACH

Eamonn Keogh Computer Science & Engineering Department, University of California — Riverside, Riverside, California 92521, USA E-mail: [email protected]

Selina Chu, David Hart, and Michael Pazzani Department of Information and Computer Science, University of California, Irvine, California 92697, USA E-mail: {selina, dhart, pazzani}@ics.uci.edu

In recent years, there has been an explosion of interest in mining time series databases. As with most computer science problems, representa- tion of the data is the key to efficient and effective solutions. One of the most commonly used representations is piecewise linear approximation. This representation has been used by various researchers to support clus- tering, classification, indexing and association rule mining of time series data. A variety of algorithms have been proposed to obtain this represen- tation, with several algorithms having been independently rediscovered several times. In this chapter, we undertake the first extensive review and empirical comparison of all proposed techniques. We show that all these algorithms have fatal flaws from a data mining perspective. We introduce a novel algorithm that we empirically show to be superior to all others in the literature. Keywords: Time series; data mining; piecewise linear approximation; segmentation; regression.

  1. Introduction

In recent years, there has been an explosion of interest in mining time series databases. As with most computer science problems, representation of the data is the key to efficient and effective solutions. Several high level

1

Segmenting Time Series: A Survey and Novel Approach 3

Surprisingly, in spite of the ubiquity of this representation, with the exception of [Shatkay (1995)], there has been little attempt to understand and compare the algorithms that produce it. Indeed, there does not even appear to be a consensus on what to call such an algorithm. For clarity, we will refer to these types of algorithm, which input a time series and return a piecewise linear representation, as segmentation algorithms. The segmentation problem can be framed in several ways.

  • Given a time series T , produce the best representation using only K segments.
  • Given a time series T , produce the best representation such that the maxi- mum error for any segment does not exceed some user-specified threshold, max error.
  • Given a time series T , produce the best representation such that the combined error of all segments is less than some user-specified threshold, total max error.

As we shall see in later sections, not all algorithms can support all these specifications. Segmentation algorithms can also be classified as batch or online. This is an important distinction because many data mining problems are inherently dynamic [Vullings et al. (1997), Koski et al. (1995)]. Data mining researchers, who needed to produce a piecewise linear approximation, have typically either independently rediscovered an algo- rithm or used an approach suggested in related literature. For example, from the fields of cartography or computer graphics [Douglas and Peucker (1973), Heckbert and Garland (1997), Ramer (1972)]. In this chapter, we review the three major segmentation approaches in the literature and provide an extensive empirical evaluation on a very heterogeneous collection of datasets from finance, medicine, manufacturing and science. The major result of these experiments is that only online algo- rithm in the literature produces very poor approximations of the data, and that the only algorithm that consistently produces high quality results and scales linearly in the size of the data is a batch algorithm. These results motivated us to introduce a new online algorithm that scales linearly in the size of the data set, is online, and produces high quality approximations. The rest of the chapter is organized as follows. In Section 2, we provide an extensive review of the algorithms in the literature. We explain the basic approaches, and the various modifications and extensions by data miners. In Section 3, we provide a detailed empirical comparison of all the algorithms.

4 E. Keogh, S. Chu, D. Hart and M. Pazzani

We will show that the most popular algorithms used by data miners can in fact produce very poor approximations of the data. The results will be used to motivate the need for a new algorithm that we will introduce and validate in Section 4. Section 5 offers conclusions and directions for future work.

  1. Background and Related Work

In this section, we describe the three major approaches to time series seg- mentation in detail. Almost all the algorithms have 2 and 3 dimensional analogues, which ironically seem to be better understood. A discussion of the higher dimensional cases is beyond the scope of this chapter. We refer the interested reader to [Heckbert and Garland (1997)], which contains an excellent survey. Although appearing under different names and with slightly different implementation details, most time series segmentation algorithms can be grouped into one of the following three categories:

  • Sliding Windows: A segment is grown until it exceeds some error bound. The process repeats with the next data point not included in the newly approximated segment.
  • Top-Down: The time series is recursively partitioned until some stopping criteria is met.
  • Bottom-Up: Starting from the finest possible approximation, segments are merged until some stopping criteria is met.

Table 1 contains the notation used in this chapter.

Table 1. Notation. T A time series in the form t 1 , t 2 ,... , tn T [a : b] The subsection of T from a to b, ta, ta+1,... , tb Seg TS A piecewise linear approximation of a time series of length n with K segments. Individual segments can be addressed with Seg T S(i). create segment(T ) A function that takes in a time series and returns a linear segment approximation of it. calculate error(T ) A function that takes in a time series and returns the approximation error of the linear segment approximation of it.

Given that we are going to approximate a time series with straight lines, there are at least two ways we can find the approximating line.

6 E. Keogh, S. Chu, D. Hart and M. Pazzani

(i.e. the L∞ norm between the line and the data). As before, we have kept our descriptions of the algorithms general enough to encompass any error measure. In particular, the pseudocode function calculate error(T) can be imagined as using any sum of squares, furthest point, or any other measure.

2.1. The Sliding Window Algorithm

The Sliding Window algorithm works by anchoring the left point of a poten- tial segment at the first data point of a time series, then attempting to approximate the data to the right with increasing longer segments. At some point i, the error for the potential segment is greater than the user-specified threshold, so the subsequence from the anchor to i − 1 is transformed into a segment. The anchor is moved to location i, and the process repeats until the entire time series has been transformed into a piecewise linear approx- imation. The pseudocode for the algorithm is shown in Table 2. The Sliding Window algorithm is attractive because of its great sim- plicity, intuitiveness and particularly the fact that it is an online algorithm. Several variations and optimizations of the basic algorithm have been pro- posed. Koski et al. noted that on ECG data it is possible to speed up the algorithm by incrementing the variable i by “leaps of length k” instead of

  1. For k = 15 (at 400 Hz), the algorithm is 15 times faster with little effect on the output accuracy [Koski et al. (1995)]. Depending on the error measure used, there may be other optimizations possible. Vullings et al. noted that since the residual error is monotonically non-decreasing with the addition of more data points, one does not have to test every value of i from 2 to the final chosen value [Vullings et al. (1997)]. They suggest initially setting i to s, where s is the mean length of the previous segments. If the guess was pessimistic (the measured error

Table 2. The generic Sliding Window algorithm. AlgorithmAlgorithmAlgorithm Seg TS = Sliding Window(T, max error) anchor = 1; while not finished segmenting time serieswhile not finished segmenting time serieswhile not finished segmenting time series i = 2; whilewhilewhile calculate error(T[anchor: anchor + i ]) < max error i = i + 1; end;end;end; Seg TS = concat(Seg TS, create segment(T[anchor: anchor

  • (i - 1)]);anchor = anchor + i; end;end;end;

Segmenting Time Series: A Survey and Novel Approach 7

is still less than max error) then the algorithm continues to increment i as in the classic algorithm. Otherwise they begin to decrement i until the measured error is less than max error. This optimization can greatly speed up the algorithm if the mean length of segments is large in relation to the standard deviation of their length. The monotonically non-decreasing property of residual error also allows binary search for the length of the segment. Surprisingly, no one we are aware of has suggested this. The Sliding Window algorithm can give pathologically poor results under some circumstances, particularly if the time series in question con- tains abrupt level changes. Most researchers have not reported this [Qu et al. (1998), Wang and Wang (2000)], perhaps because they tested the algorithm on stock market data, and its relative performance is best on noisy data. Shatkay (1995), in contrast, does notice the problem and gives elegant examples and explanations [Shatkay (1995)]. They consider three variants of the basic algorithm, each designed to be robust to a certain case, but they underline the difficulty of producing a single variant of the algorithm that is robust to arbitrary data sources. Park et al. (2001) suggested modifying the algorithm to create “mono- tonically changing” segments [Park et al. (2001)]. That is, all segments con- sist of data points of the form of t 1 ≤ t 2 ≤ · · · ≤ tn or t 1 ≥ t 2 ≥ · · · ≥ tn. This modification worked well on the smooth synthetic dataset it was demonstrated on. But on real world datasets with any amount of noise, the approximation is greatly overfragmented. Variations on the Sliding Window algorithm are particularly popular with the medical community (where it is known as FAN or SAPA), since patient monitoring is inherently an online task [Ishijima et al. (1983), Koski et al. (1995), McKee et al. (1994), Vullings et al. (1997)].

2.2. The Top-Down Algorithm

The Top-Down algorithm works by considering every possible partitioning of the times series and splitting it at the best location. Both subsections are then tested to see if their approximation error is below some user- specified threshold. If not, the algorithm recursively continues to split the subsequences until all the segments have approximation errors below the threshold. The pseudocode for the algorithm is shown in Table 3. Variations on the Top-Down algorithm (including the 2-dimensional case) were independently introduced in several fields in the early 1970’s. In cartography, it is known as the Douglas-Peucker algorithm [Douglas and