Complex Systems: Solutions and Challenges in Economics, Management and Engineering pp 251-267 | Cite as

# Detecting Changes in Time Sequences with the Competitive Detector

## Abstract

The concept of the competitive edge detector is revisited and extended. In the case of application to 1D signals it can be denoted as the detector of changes. In the detector two approximators are used working one at the ‘past’ and one at the ‘future’ side of the considered data point. The difference of their outputs makes it possible to find the change of the value and the derivative of the signal. The new features introduced consist in performing robust analysis and in adding the option to use a quadratic function as an approximator. Weighted voting of elemental subsets is used with weights related to the significance of a subset for the result. Weak fuzzification is used to increase the robustness. Results of change detection on test data as well as some real-life economic data are encouraging.

### Keywords

Change detector Competitive Robust Fuzzy Weighted## 1 Introduction

The most interesting phenomena which manifest themselves in the data collected about the world are related to the changes. The change in the existing signal or the emergence of a new one is something that invokes an accelerated cognitive process of deciding whether it is necessary to react.

The method to be presented here has its origin primarily in the domain of image processing; therefore, we shall first review the approaches to change detection in image processing setting, where the problem of change detection is incessantly one of the main topics of research. If the changes in space are considered, then the problem is related to the detection of edges. This comprises the detection of changes in image intensity or color, but also finding the precise localization, directionality, continuity, and finally the significance of the edges. The changes in time relate to the detection of movement or lighting. The research in edge detection has been summarized in the reviews [2, 3, 19, 21] and older surveys [12, 25, 36]. The research in motion detection was recapitulated among others in the surveys [16, 28]. The motion is related to the movement of the objects viewed (cf. e.g. [18]) and is the necessary step towards solving the problem of surveillance (e.g. [13]). A more general problem is the detection of changes between multiple images, reviewed for example in [27]. One of the well-established applications is the detection of differences in medical images (e.g. [34]).

The change detection in general is broadly treated in the statistical meaning [30] (see [26] for a state-of-the-art survey; see also e.g. [1, 15, 32] and an extensive list of references in [33]). One of its main applications is the detection of faults and damages. In simple words it can be formulated as testing the hypothesis that a new sample comes from a different statistical distribution than the previous samples [14, 17]. The sample can consist of more than one measurement.

In this study we shall come back to the concept of fitting a model of the signal to the data, present in the image processing domain from its early years. This concept was used by so many authors that we can name just some of them. Blake and Zisserman in [4] proposed to approximate the image intensity function with models based on mechanical analogies, which remove noise and simultaneously detect edges in the simulated process of stretching and breaking a membrane. The filter performed very well on two-dimensional noisy data but its speed was small [8]. A roof edge detector proposed by Pajdla and Hlaváč [24] consisted in fitting the edge model to the image with the edge direction found beforehand to speed up the process. Niedźwiecki, Sethares and Suchomski in [22, 23] proposed a filter denoted as the *competitive filter*. It consisted of two filters working simultaneously from the two sides of an edge. The filter in which the approximation error was smaller won the competition and the output from that filter was used as the filtering result. Each filter approximated the image intensity in 2D with the simple constant function which was the reason why the algorithm was extremely effective.

In 1996 one of us proposed to use the concept of competitive filtering to detect edges [6] (the idea went back to 1994 [5]). The concept was successfully developed for one-dimensional data in the form of two linear filters. The extension to two dimensions failed due to the due to the problematic definition of the two sides of an edge in face of the complexity of shapes of the image intensity function near the edge junctions, and was abandoned [7].

We have revisited the concept of the competitive edge detection in the application to one-dimensional data in a pilot study [11] where we have added the fuzzy weighted robust analysis mechanism to the fitting of the two filters. We have made preliminary analyzes of some real-life data The detector performed in a promising way. In this paper we have implemented a second degree polynomial function as an additional option of the approximators and we have tried to process economical data.

The robustness is understood as immunity to outlying data and as such it will not always be applicable to economic data. An outlying data point can appear as a result of an erroneous measurement or observation and then it is a gross error and as such it should be rejected form the analysis. However, if it appears as a result of a proper observation it is the evidence of an unknown or unexpected phenomenon, and hence it is a valuable piece of information which should be paid special attention in the analysis.

The method presented here will not deal with the change of the statistical nature of the signal but rather with the detection of steps or jumps in the value and the first derivative, or slope, of the signal. This could serve as a source of information on the signal as well as a hint for a human observer to pay attention to the details related to the signal. There exist a large number of stock exchange state indicators, like the moving averages or the Relative Strength Index. Our detector can be viewed in a similar way, although it is neither directly related to the market analysis nor has emerged or was derived with such analysis in view. However, we deem it useful in looking at time series of economy-related data in a more insightful way.

In fact, what we had in mind, was the detection of early signals of important events to come in the near future [29]. This far-reaching goal by no means can be attained with simple methods, but we hope our proposition can be an incentive in the search.

The detector originated from the domain of image processing. Therefore, some image processing terminology will still appear in places, although the relation of the detector to images is only historical. In particular, the notions of *change*, *step*, *jump* will be interchanged according to the context.

The software and the graphs were produced within the Matlab® environment.

The remaining part of this chapter will be organized as follows. In the next section the detector in its previous form will be described and its new features will be explained. The description will be illustrated with examples of detection in synthetic images. Then, the results of the detection of changes in some real-life data will be presented. The propositions of further development of the method and some concluding remarks will come at the end.

## 2 Method

### 2.1 General Concept

According to [23] let us take a sequence of measurements \(z(t)=y(t)+n(t)\), where *n*(*t*) is noise. Time *t* is discrete. The measurements are known up to the time \(t_0+\varDelta {}t\). Two predictors, or approximators, will be used to find \(y(t_0)\), one running from the past towards the future, using \(z(t), t\in [t_0-s-\delta ,t_0-\delta ]\) to find \(\hat{y}_-(t_0)\), and one running towards the past, using \(z(t), t\in [t_0+\delta , t_0+s+\delta ]\) to find \(\hat{y}_+(t_0)\). The approximators will be referred to as *past* and *future*, or *left* and *right*. The data used in one approximation will form its support. For each prediction its error is estimated yielding \(e_-(t_0)\) and \(e_+t_0\). As the estimate of the result at the point of interest, \(y(t_0)\), the output of the filter which has smaller error is used. The filter can work providing enough measurements are known in advance. The parameter *s* can be understood as the scale of the filter. Parameter \(\delta \) is the gap between the point of interest and each of the estimators.

*t*the error from the past increased and that for the future decreased. These conditions were expressed in [6] in a complicated way but they can be simply written down, respectively, as

*at*, but

*between*the points, these conditions could be reformulated accordingly. Here we shall not do so; instead, we can point out that it seems reasonable that \(\varepsilon \) should be as small as possible and \(\varepsilon \le \delta \), and that both can be equal to one. This was assumed in [6] and so it will be in the present paper. Because the past error should be known for \(t_0+\varepsilon \) then the measurements for \(t_0+\varDelta {}t = t_0+\delta +s+2\varepsilon = t_0+s+3\) should be known for the detector to operate.

The result of formulating the condition for a step using the values in two points distant by 2 is that a step can be detected in two points, like this at \(x=29,3\) in Fig. 1. This is reasonable, because in fact the step is formed by data in both points.

There is no separate step existence condition for steps of the function and of its derivative. These two appear together, except the points where the value of one of them is zero or small.

At present, as it was in [6], as the measure of error the mean square error is used. This is not the best solution if the approximators are found with the robust analysis. In the application of our present interest not the filtered value but the detection of changes is important. The error measure do not influence the value of the step, but only its location. The question of error measure in relation to detectability and location of change points will be commented on further in the end of the next section, as soon as some more images will be shown.

### 2.2 Extensions and Changes

The new extension is the quadratic approximator, so it will be described first. The extensions are applied to the detector in pairs, triples etc. In the following, the detector without the robustness feature will be denoted as the *classic* one. The independent variable will be denoted by *x* instead of *t*.

Quadratic Approximator

Robustness

*weak fuzzification*is fulfilled [9, 10]. Accumulator for each approximator is searched for maxima which indicate the solutions for them.

The similar image but with some noise added is analyzed in Fig. 5. The robust approximators omit some extraneous data points.

The ability to omit some data points can sometimes have a negative influence on the result. This frequently appears with the robust quadratic approximator. An example can be seen in Fig. 6. The approximated line passes with precision through some points and omits the points which are the nearest to the central point of the detector located at \(x=18\). In the case shown, this leads to an un acceptable result. This phenomenon can be treated by proper weighting the influence of the data points. The weighting will be the subject of the next paragraph.

Weighting

It is not reasonable to treat votes equally important. Note that the noise in pairs with data points which are close to each other have larger impact on the parameters of the approximation than those which contain distant points. Therefore, the pairs with distance equal to one were dismissed. Attention should be paid to weighting the remaining votes. Let us concentrate upon the linear approximator. If the votes were weighted with the distance of points in their pairs, then it is very probable that the voting pair consisting in the endpoints of the support would always win. Therefore, not to promote the most elongated pairs excessively, at present the votes are weighted with the support length to the power of 0.25. The pairs which contain data points for which the *x* coordinates differ by one are dismissed.

The problem of weighting is complex and at present it was only partly solved. As shown in the previous paragraph, it is necessary to promote those data which come from points closer to the central point of the detector. This means that there are at least two criteria for finding the weights, which makes it necessary to find some optimum between them. This will be the subject of further studies. At present the robust quadratic detector is too vulnerable to omitting important data and will not be used in the examples which follow.

Output without extrapolation

In Fig. 7 the results for data containing all the detectable changes can be seen. Some point noise or outlying values are added, mainly to illustrate the advantageous functioning of the robust detector. It should be pointed out that if the outlying point at \(x=42\) were moved towards the slope between \(x=36\) and 37, for example to point 39, it would be doubtful whether this is an outlier or a part of the slope at 36, 37, interrupted at 38 and continued at 39. The data element is an outlier if it does not follow the trend, which is not always univocal.

The graph in Fig. 7 was drawn so that the scale *s* of the detector were smaller than the distance between the changes to be detected. Let us now look closely at subfigure b, point \(x=37\). At this point the error of the right approximator is zero (dark magenta line with small triangles pointing to the right). What would happen if the already mentioned outlier at \(x=42\) were moved left by one, so that this error went up instead of falling down to zero? graphs would not cross and the jump would not be detected. In this way it can be seen that the jumps which are closer to each other than the scale, do interfere, and this can make them undetectable. It is expected that the formulation of the error measure in a better way than as the mean square error, for example with the use of information coming from the robust approximators on which points are treated as extraneous, would limit the detrimental mutual influence of the close jumps. This will be studied in the future research.

## 3 Real-Life Examples

The scale of the images and lack of access to the intermediate data in the paper edition of this study makes it impossible to notice, but as previously, it can be said also now that the difficulties with detecting the locations of the change points is related to the existence of many small jumps in the data which interfere within the supports of the approximators and make it impossible for the approximation errors to go down to the extent which would make it possible for the error graphs to cross. This problem will be studied further.

## 4 Discussion

At present we see two problems needing further studies. As already mentioned, these are: the interference between nearby changes and the question of optimal weighting the votes in the robust detector. The question of weighted voting and the question of choosing the right error measure needs further work.

It should be reminded that it is easy to introduce weighting also in the classic least squares detector so the experience gained will be used also in it.

The calculations in the detection for each point are performed for small sets of data so they are effective. The only operation which need longer time is the processing of the 3D accumulator in the quadratic robust version. It should be considered to use another method to eliminate outstanding sets of parameters, for example some of the unsupervised clustering methods. This should be easy due to that the number of objects (set of parameters) is small and distance measures between the sets seem to be easy to design.

The features of the proposed detector can be summarized as follows.

Detection is performed together with the filtering process.

The classic version in the linear as well as quadratic form has only one parameter: the scale.

Higher order derivatives can be estimated according to the order of the approximating function.

The processes in some versions of the detector are relatively effective.

A considerable part of data about the future must be known before the detection can be made. It can be too late for reaction.

The interference between changes which are closer to each other than the scale is the source of problems with jump localization.

The detector in its weighted version has many parameters and their tuning needs optimization.

The robust procedure by fuzzy voting is time-consuming. This can be overcome by using a different data clustering technique than the accumulation.

## 5 Summary and Prospects

The concept of the competitive edge detector was recalled, extended and used to analyze some sets of data. In the proposed detector of changes two approximators are used. One of them works at the ‘past’ of ‘left’ and one at the ‘future’ or ‘right’ side of the considered data point. The outputs from the approximators are used to calculate the change of the value and the derivative of the data. The detector can perform robust analysis with weak fuzzification which make it possible to postpone extraneous data points. In the present study the option to use a quadratic function as an approximator was added. Weighted voting of elemental subsets is used with weights related to the significance of a subset for the result. Results of change detection on test data as well as some real-life economic data are encouraging.

As the directions of future work the optimization of the weighting process, the question of reducing the interference of neighboring jumps in data, and the choice of an effective clustering method for votes in the robust algorithm were indicated.

### References

- 1.Basseville, M.: Statistical methods for change detection. In: H. Unbehauen (ed.) Control Systems, Robotics and Automation. Encyclopedia of Life Support Systems (EOLSS), Developed under the Auspices of the UNESCO, vol. XIV. Eolss Publishers, Paris, France (2002). http://www.eolss.net
- 2.Basu, M.: Gaussian-based edge-detection methods-a survey. IEEE Trans. Syst. Man Cybern. Part C (Applications and Reviews)
**32**(3), 252–260 (2002). https://doi.org/10.1109/TSMCC.2002.804448 - 3.Bhardwaj, S., Mittal, A.: A survey on various edge detector techniques. Procedia Technol.
**4**, 220–226 (2012). https://doi.org/10.1016/j.protcy.2012.05.033 - 4.Blake, A., Zisserman, A.: Visual Reconstruction. MIT Press, Cambridge, MA, London (1987)Google Scholar
- 5.Chmielewski, L.: The concept of step and roof edge detector derived from a competitive filter. EPSILON ARG Report (1994)Google Scholar
- 6.Chmielewski, L.: The concept of a competitive step and roof edge detector. Mach. Graphics Vis.
**5**(1–2), 147–156 (1996)Google Scholar - 7.Chmielewski, L.: Failure of the 2D version of the step and roof edge detector derived from a competitive filter. Report of the Division of Optical and Computer Methods in Mechanics, IFTR PAS (1997)Google Scholar
- 8.Chmielewski, L., Skłodowski, M., Cudny, W., Nieniewski, M., Kuriański, A., Michalski, B.: Fringe image enhancing in the light wavelength stepping method. Mach. Graphics Vis.
**3**(3), 543–578 (1994)Google Scholar - 9.Chmielewski, L.J.: Fuzzy histograms, weak fuzzification and accumulation of periodic quantities. Application in two accumulation-based image processing methods. Pattern Anal. Appl.
**9**(2–3), 189–210 (2006). https://doi.org/10.1007/s10044-006-0037-7 - 10.Chmielewski, L.J.: Evidence accumulation methods in digital image analysis. Corrected edition (in Polish). Akademicka Oficyna Wydawnicza EXIT Andrzej Lang, Warsaw (2015). http://www.lchmiel.pl/akum06
- 11.Chmielewski, L.J., Orłowski, A.: Detecting changes with the robust competitive detector. In: Proceedings 8th Iberian Conference on Pattern Recognition and Image Analysis IbPRIA 2016. Lecture Notes in Computer Science. Springer, Faro, Portugal (2017) (Submitted for review)Google Scholar
- 12.Davis, L.: A survey of edge detection techniques. Comp. Graph. Image Proc.
**4**, 248–270 (1975). https://doi.org/10.1016/0146-664X(75)90012-X - 13.Frejlichowski, D., Forczmański, P., et al.: SmartMonitor: An approach to simple, intelligent and affordable visual surveillance system. In: Bolc, L., et al. (ed.) Computer Vision and Graphics: Proceedings International Conference ICCVG 2012. Lecture Notes in Computer Science, vol. 7594, pp. 726–734. Springer, Heidelberg, Warsaw, Poland (2012). https://doi.org/10.1007/978-3-642-33564-8_87
- 14.Furmańczyk, K., Jaworski, S.: Large parametric change-point detection by a v-box control chart. Sequ. Anal.
**35**(2), 254–264 (2016). https://doi.org/10.1080/07474946.2016.1165548 - 15.Gordon, L., Pollak, M.: An efficient sequential nonparametric scheme for detecting a change of distribution. Ann. Statist.
**22**(2), 763–804 (1994). https://doi.org/10.1214/aos/1176325495 - 16.Hu, W., Tan, T., Wang, L., Maybank, S.: A survey on visual surveillance of object motion and behaviors. IEEE Trans. Syst. Man Cybern. Part C (Applications and Reviews)
**34**(3), 334–352 (2004). https://doi.org/10.1109/TSMCC.2004.829274 - 17.Jaworski, S., Furmańczyk, K.: On the choice of parameters of change-point detection with application to stock exchange data. Quant. Methods Econ.
**XII**(1), 87–96 (2011)Google Scholar - 18.Kuriański, A., Nieniewski, M.: A model of the MRF with three observation sources for obtaining the masks of moving objects. In: Borgefors, G. (ed.) Proceedings 9th Scandinavian Conference on Image Analysis, vol. 2, pp. 931–940. IAPR, Uppsala (1995)Google Scholar
- 19.Maini, R., Aggarwal, H.: Study and comparison of various image edge detection techniques. Int. J. Image Process. (IJIP)
**3**(1), 1–11 (2009)Google Scholar - 20.Maître, H.: Un panorama de la transformation de Hough. Traitement du Signal
**2**(4), 305–317 (1985)MathSciNetGoogle Scholar - 21.Narendra, V.G., Hareesh, K.S.: Study and comparison of various image edge detection techniques used in quality inspection and evaluation of agricultural and food products by computer vision. Int. J. Agric. Biol. Eng.
**4**(2), 83 (2011). https://doi.org/10.3965/j.issn.1934-6344.2011.02.083-090 - 22.Niedźwiecki, M., Sethares, W.: New filtering algorithms based on the concept of competitive smoothing. In: Proceedings 23rd International Symposium on Stochastic Systems and Their Applications, pp. 129–132. Osaka (1991)Google Scholar
- 23.Niedźwiecki, M., Suchomski, P.: On a new class of edge-preserving filters for noise rejection from images. Mach. Graphics Vis.
**1–2**(3), 385–392 (1994)MATHGoogle Scholar - 24.Pajdla, T., Hlaváč, V.: Surface discontinuities in range images. In: 5th International Conference Computer Vision, pp. 524–528. IEEE Computer Society Press, Berlin (1993). https://doi.org/10.1109/ICCV.1993.378168
- 25.Peli, T., Malah, D.: A study of edge detection algorithms. Comput. Graphics Image Process.
**20**(1), 1–21 (1982). https://doi.org/10.1016/0146-664X(82)90070-3 - 26.Polunchenko, A.S., Tartakovsky, A.G.: State-of-the-art in sequential change-point detection. Method. Comput. Appl. Probab.
**14**(3), 649–684 (2012). https://doi.org/10.1007/s11009-011-9256-5 - 27.Radke, R.J., Andra, S., Al-Kofahi, O., Roysam, B.: Image change detection algorithms: a systematic survey. IEEE Trans. Image Process.
**14**(3), 294–307 (2005). https://doi.org/10.1109/TIP.2004.838698 - 28.Räty, T.D.: Survey on contemporary remote surveillance systems for public safety. IEEE Trans. Syst. Man Cybern. Part C (Applications and Reviews)
**40**(5), 493–515 (2010). https://doi.org/10.1109/TSMCC.2010.2042446 - 29.Scheffer, M., Bascompte, J., Brock, W.A., et al.: Early-warning signals for critical transitions. Nature
**461**, 53–59 (2009). https://doi.org/10.1038/nature08227 - 30.Shiryaev, A.N.: On optimum methods in quickest detection problems. Theory Probab. Appl.
**8**(1), 22–46 (1963). https://doi.org/10.1137/1108002 - 31.Strauss, O.: Use the fuzzy Hough transform towards reduction of the precision-uncertainty duality. Pattern Recognit.
**32**, 1911–1922 (1999)CrossRefGoogle Scholar - 32.Tartakovsky, A., Nikiforov, I., Basseville, M.: Sequential analysis: hypothesis testing and changepoint detection. In: Monographs on Statistics and Applied Probability. CRC Press, Chapman & Hall/CRC (2012)Google Scholar
- 33.Veeravalli, V.V., Banerjee, T.: Quickest change detection. (2012). arXiv:1210.5552
- 34.Venot, A., Golmard, J., Lebruchec, J., et al.: Digital methods for change detection in medical images. In: Deconink, F. (ed.) Information Processing in Medical Imaging. Martinus Nijhoff Publishers, Dodrecht, The Netherlands (1984)Google Scholar
- 35.WGPW—Warszwska Giełda Papierów Wartościowych (Warsaw Stock Exchange) (2016). http://www.gpw.pl. Accessed 15 Nov 2016
- 36.Ziou, D., Tabbone, S.: Edge detection techniques—An overview. Pattern Recognit. Image Anal.
**8**(4), 537–559 (1998)Google Scholar