fuzzy image processing applied to time series …fuzzy image processing applied to time series...

6
FUZZY IMAGE PROCESSING APPLIED TO TIME SERIES ANALYSIS R. Andrew Weekley 1 *, Robert K. Goodrich 1,2 , Larry B. Cornman 1 1 National Center for Atmospheric Research ** , Boulder, CO 2 University of Colorado, Department of Mathematics, Boulder, CO * Corresponding author address: R. Andrew Weekley, NCAR/RAP, P.O. Box 3000, Boulder, CO 80307-3000. e-mail: [email protected] ** The National Center for Atmospheric Research is sponsored by the National Science Foundation. 4.3 1. INTRODUCTION The analysis of times series data plays a fun- damental role in science and engineering. An important analysis step is the identification and classification of various features in the data. Qual- ity control can be viewed as a subclass of general feature identification and classification, for exam- ple, differentiating between a true signal and a contaminating signal. Many algorithms exist for the quality control of time series data, such as Fourier or wavelet analysis, as well as robust and standard statistics. (Abraham and Ledolter 1983, Priestly, 1981 and Barnett and Lewis, 1977). How- ever these algorithms are applicable only when certain assumptions are satisfied, such as station- arity, and a relative few number of outlier (less than 50% of the data). Unfortunately there are times when an instrument is failing and the assumptions of the standard methods are violated, and hence are not applicable. However, a quality indicator is still needed. Typically the image pro- cessing of a human is used to identify and mitigate failure mode data. Human analysts are adept at feature identification and classification, neverthe- less in many applications it is desired to have an automated algorithm that performs this role. In this paper, a machine-intelligent algorithm that mimics the feature classification and identification pro- cessing of the human analyst is presented and applied to the quality control of time series data. In cases where there are a large number of outliers - a situation that is problematic to most algorithms - this algorithm is able to classify the desired signal as well as the outliers. For example, consider the time series in Fig- ure 1 consisting of anemometer measurements of wind speed in ms -1 as a function of time in sec- onds. Aside from a few isolated outliers, it is straightforward to see that this is good quality data, and that most quality control algorithms would not have difficulty in diagnosing the outliers. On the other hand, the data in Figure 2 is certainly more complex, showing similar regions of good data as with the previous figure, but intermixed Figure 1. Nominal anemometer time series data. The vertical axis is wind speed in m s -1 . The horizontal axis is time in seconds. Figure 2. A nearby anemometer time series in a failure mode. Here a nut holding the anemometer head has worked loose. Figure 3. Data from a spinning anemometer. The verti- cal axis is wind direction measured in degrees from north in a clockwise direction, the horizontal axis is time in seconds. Figure 4. Data from an anemometer in a failure mode caused by a bad transistor.

Upload: others

Post on 13-Apr-2020

22 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: FUZZY IMAGE PROCESSING APPLIED TO TIME SERIES …FUZZY IMAGE PROCESSING APPLIED TO TIME SERIES ANALYSIS R. Andrew Weekley1*, Robert K. Goodrich1,2, Larry B. Cornman1 1National Center

FUZZY IMAGE PROCESSING APPLIED TO TIME SERIES ANALYSIS

R. Andrew Weekley1*, Robert K. Goodrich1,2, Larry B. Cornman1

1National Center for Atmospheric Research**, Boulder, CO2University of Colorado, Department of Mathematics, Boulder, CO

4.3

1. INTRODUCTION

The analysis of times series data plays a fun-damental role in science and engineering. Animportant analysis step is the identification andclassification of various features in the data. Qual-ity control can be viewed as a subclass of generalfeature identification and classification, for exam-ple, differentiating between a true signal and acontaminating signal. Many algorithms exist forthe quality control of time series data, such asFourier or wavelet analysis, as well as robust andstandard statistics. (Abraham and Ledolter 1983,Priestly, 1981 and Barnett and Lewis, 1977). How-ever these algorithms are applicable only whencertain assumptions are satisfied, such as station-arity, and a relative few number of outlier (lessthan 50% of the data). Unfortunately there aretimes when an instrument is failing and theassumptions of the standard methods are violated,and hence are not applicable. However, a qualityindicator is still needed. Typically the image pro-cessing of a human is used to identify and mitigatefailure mode data. Human analysts are adept atfeature identification and classification, neverthe-less in many applications it is desired to have anautomated algorithm that performs this role. In thispaper, a machine-intelligent algorithm that mimicsthe feature classification and identification pro-cessing of the human analyst is presented andapplied to the quality control of time series data. Incases where there are a large number of outliers -a situation that is problematic to most algorithms -this algorithm is able to classify the desired signalas well as the outliers.

For example, consider the time series in Fig-ure 1 consisting of anemometer measurements ofwind speed in ms-1 as a function of time in sec-onds. Aside from a few isolated outliers, it isstraightforward to see that this is good qualitydata, and that most quality control algorithms

* Corresponding author address: R. Andrew Weekley,NCAR/RAP, P.O. Box 3000, Boulder, CO 80307-3000.e-mail: [email protected]** The National Center for Atmospheric Researchis sponsored by the National Science Foundation.

would not have difficulty in diagnosing the outliers.On the other hand, the data in Figure 2 is certainlymore complex, showing similar regions of gooddata as with the previous figure, but intermixed

Figure 1. Nominal anemometer time series data. Thevertical axis is wind speed in m s-1. The horizontal axisis time in seconds.

Figure 2. A nearby anemometer time series in a failuremode. Here a nut holding the anemometer head hasworked loose.

Figure 3. Data from a spinning anemometer. The verti-cal axis is wind direction measured in degrees fromnorth in a clockwise direction, the horizontal axis is timein seconds.

Figure 4. Data from an anemometer in a failure modecaused by a bad transistor.

Page 2: FUZZY IMAGE PROCESSING APPLIED TO TIME SERIES …FUZZY IMAGE PROCESSING APPLIED TO TIME SERIES ANALYSIS R. Andrew Weekley1*, Robert K. Goodrich1,2, Larry B. Cornman1 1National Center

with numerous outliers. This data is from an ane-mometer located three meters from the one whosedata is shown in Figure 1, and from the same timeperiod. In this situation, standard methods mightwork well on certain segments of this time series,but other sections -- such as between 800 and1000 seconds -- might cause problems. However,except for some of the points close to the “gooddata,” a human analyst would not have much diffi-culty in discerning the good from the bad data (infact, this anemometer was having a mechanicalfailure where the strong winds vibrated, then loos-ened, the nuts holding the anemometer in place).

Consider the additional cases shown in Fig-ure 3 and Figure 4. From video footage, it hasbeen observed that certain wind frequencies canexcite normal modes of this type of anemometer’swind direction head and can cause the device tospin uncontrollably. Data from such a case can beseen in Figure 3, where the vertical axis is winddirection measured in a clockwise direction fromNorth. The horizontal axis is again time measuredin seconds. Between about 500 seconds and 1000seconds the wind direction measuring device isspinning and the data becomes essentially a ran-dom sample of a uniform distribution betweenabout 50 degrees to 360 degrees. The true winddirection is seen intermittently at about 225degrees, which is in general agreement with thevalue from another nearby anemometer. Figure 4shows the wind direction at another time distinctfrom that in Figure 3; the true wind direction isaround 40 degrees. Notice the suspicious streaksin the time series data near 200 degrees, as wellas other spurious data points. Again standard timeseries algorithms would have a difficult time withthese two examples, however it is straight forwardfor the human analyst to identify both the suspectand good data. This illustrates another aspect ofthe time series problem beyond identifying pointsas outliers, that is, classifying the nature of theoutliers.

It is difficult to create a single algorithm thatcan detect and identify many different types ofdata quality problems. Given that the human ana-lyst is able to quality control data in a pathologicalcase, motivated the development of a multi-com-ponent, fuzzy logic machine intelligent algorithm,the Intelligent Outlier Detection Algorithm (IODA).IODA incorporates cluster analysis, fuzzy imageprocessing, local and global analysis, correlationstructure, as well as a priori knowledge whenavailable, and returns a quality control index (con-fidence value) between 0 and 1 that indicates the

reliability of the data. In this paper the techniquesto accomplish such processing are given in thecontext of anemometer time series data. It isimportant to note that these techniques could bemodified to accommodate time series data fromother instruments with different failure processes,or failure modes.

2. FUZZY IMAGE PROCESSING

When creating a fuzzy logic algorithm, thecharacteristics and rules a human expert mightuse to partition the data (Zimmerman, 1996) intoa classification set C must be determined. Varioustests are devised to ascertain whether a certaindatum should be in C. The result of each test aretransformed into values between 0 and 1 by mem-bership functions. A membership function valuenear 1 for some test T is interpreted to mean thatthe test indicated that it was likely that the datumshould be classified as in C, and a value near zerowould indicate the datum is not likely to belong toC. These membership functions are combined inmany different ways by fuzzy logic rules to obtaina final membership function. A threshold is setand the points with final membership values abovethis threshold are defined to be in C. If a thresholdis not used the value of the combined membershipfunction may be used to indicate the degree towhich the datum belongs to C (a confidencevalue). This final membership function is calledthe fuzzy set C since the membership value indi-cates the degree to which a datum belongs to C.This methodology allows for a multiplicity of testsand membership functions. In the case of fuzzyimage processing, a membership value isassigned to each point from an analysis of animage (Chi, Hong and Tuan, 1996). This value canbe thought of as a height and by interpolation asurface. See for example Figure 6 where a cold(blue color) represents a higher height in the sur-face.

3. INTELLIGENT OUTLIER DETECTION ALGO-RITHM (IODA)

Suppose the data from Figure 2 is broken intooverlapping subregions using a sequence of run-ning windows. For each data window, an estimateof the probability density function (i.e. a normal-ized histogram) is calculated (note that the windowsize must be selected large enough to containenough data to give reasonable estimates of thedensity functions, but small enough to reflect thelocal structure of the non-stationary time series).These histograms can be plotted as a waterfall

Page 3: FUZZY IMAGE PROCESSING APPLIED TO TIME SERIES …FUZZY IMAGE PROCESSING APPLIED TO TIME SERIES ANALYSIS R. Andrew Weekley1*, Robert K. Goodrich1,2, Larry B. Cornman1 1National Center

plot, or stacked histograms, as shown in Figure 5.The histogram for the first time window is shown inthe bottom left, the plots then run up the left col-umn as a function of time and continue from thebottom right plot to the top right. These stackedhistograms can also be plotted as a contourimage, left to right as a function of time, as shownin Figure 6. The image in Figure 6 is the first fuzzyinterest map used in IODA, and is called the his-togram field (Figure 6 is a plot of the entire hourof data, whereas Figure 5 is of only the first 555data points). The contour plot in Figure 6 can bethought of as a surface, where the color of thecontour represents the height of the surface aboveeach point in the time-wind speed plane. The darkblue colors represent a larger height, whereas thedark red color represents a height near zero.

It is natural for a human to see large clumps ofblue in Figure 6. These region in the image can beencircled using a contour algorithm and defineconcentrations or clusters of points as shown inFigure 6. Here the cluster boundaries that sur-round the data points of the cluster are shown inblue. These clusters are found in the histogramfield by selecting a threshold for the contour algo-rithm, if a lower threshold is selected, the clustersgrown in size and connect. A sequence of clus-ters can be found by incrementally lowering thecontour threshold, or by “lowering the water”. Thisexpression is related to the idea that the contour isa set of mountain peaks and the threshold level

Figure 5. Plot of stacked time series histograms. Thefeature at the left represents the drop out data causedby the loose nut.

represents a water level. As the level is lowered,the peaks become connected by ridge lines.

Notice these blue clumps do not contain all thedata points in the original time series, i.e., there iscluster data and non-cluster data, however byinspection, the analyst combines these local clus-ters into larger scale features. For instance in Fig-ure 6, a human expert might group the largeclusters centered around 17 m/s-1 into a featureand the others near 1 m/s-1 into a second feature.In actuality there are three tasks at hand: charac-terize/categorize the clusters, group the clustersinto features and characterize/categorize the non-cluster data. In this way, the “good” and “bad” dataare distinguished. For example, in this case thereare three cluster categories, atmospheric clusters,failure mode clusters, and unknown clusters.Atmospheric clusters contain points that fit anexpected model, non-atmospheric clusters areclusters that do fit an expected model for a particu-lar failure mode. Unknown clusters are neitheratmospheric or non-atmospheric. The notion ofatmospheric, non-atmospheric clusters are quanti-fied using fuzzy logic algorithms. These fuzzy logic

Figure 6. The data from Fig. 5 is plotted from left to right.The horizontal axis is time in seconds. The vertical axisis wind speed in m s -1. The color represents the heightof this histogram with blue a higher height and red aheight near zero.

Figure 7. A threshold is selected and a contour plot isdrawn around the data above the threshold. This breaksthe data into several clusters.

Page 4: FUZZY IMAGE PROCESSING APPLIED TO TIME SERIES …FUZZY IMAGE PROCESSING APPLIED TO TIME SERIES ANALYSIS R. Andrew Weekley1*, Robert K. Goodrich1,2, Larry B. Cornman1 1National Center

algorithms require a priori knowledge of the char-acteristics of the atmospheric signal as well asknowledge of the failure modes. One of thestrengths of fuzzy logic algorithms is the ease inwhich new characteristics can be added, whenneeded or discovered. It is important to note thatnot all of the data points will clearly exhibit the apriori expected behavior. Again, this natural ambi-guity in classifications is handled by fuzzy logicmethods.

3.1.Classifying clustersIn general, clusters found using the above tech-

niques will, by definition, group data structurestogether. Clusters can be classified according towhether they are consistent with a known problemor failure mode, such as the loose nut scenario, orresult from nominal atmospheric data, i.e., datawith expected statistics. One such characterizationis auto-correlation as defined by lags of data. Con-sider the scatter plot of y(t) vs. y(t+1), or lag 1, forthe loose nut case, shown in Figure 8. Here y(t) isthe wind speed at time t. The color for each pointis simply the geometric mean of the initial confi-dence for the points y(i) and y(i+h) is given by:

The solid black line is the confidence-weighted lin-ear best fit to the data (here h=1). Notice in the lagscatter plot there are two distinct groups of data,the atmospheric data centered near 18 m s-1, andthe drop out data centered near the origin. Thefact there are two groups of data in the lag plotindicates that the data is not stationary, and can beused later to separate the histogram clusters intostationary groups of clusters. It is possible todefine a confidence-weighted auto correlation.Thus in lag(1) space, pairs of points that fit theexpected model should cluster around a line with a

Figure 8. A plot of the ordered pairs (y(t), y(t + 1)). Thevertical and horizontal axes are wind speed in m s -1.

Ci i h+, Ci Ci h+⋅=

slope close to one. A ρ=ρ(1) (the sample correla-tion) value close to zero indicates a poor fit and avalue near one indicates an excellent fit. In fact, ρsquared represents the percent of variation iny(i+1) explained by the fit.

Similar techniques can be applied to the lagplot to find clusters of points, that were applied tothe time series data. An image can be created bycalculating a local density using a tiling of overlap-ping rectangles. A contour algorithm can beapplied to the resulting image and clusters of datacan be found (other data clustering techniqueswould work well for this problem as well). Againthe water can be lowered and new clusters can befound for each contour threshold, and a value forρ can be calculated for each of these new clus-ters. The largest cluster that has a large value forρ, and contains points that are close to the best fitline is then selected, as shown in Figure 8. This isdone by a fuzzy algorithm. The color of the con-tour surrounding the lag points represents theatmospheric score given to that cluster. Where acool color is a high score and a warm color is a lowscore. Notice, the high scoring cluster in Figure 8contains the data from the time series plot that ahuman would probably classify as atmospheric.The pairs of points given by y(i) and y(i+1), in thislag cluster, are termed “atmospheric” since they fitthe expected auto correlation model of atmo-spheric data. It is now possible to calculate anatmospheric score for each cluster in time seriesspace.

3.2.Additional Membership ValuesNumerous additional membership values can

be calculated. For instance a membership valuecan be calculated by recursively fitting the timeseries with straight lines. Suppose a segment ofdata is fit with a line, and an quality of fit for thedata is calculated (such as ρ squared). If the qual-ity indicator is too low, the best fit line is bisectedand new fits are calculated for the two new sets ofdata. Fits are calculated until the quality indicatoris good enough or there are to few points in the fit.A local best fit confidence can then be calculatedby how far a point is from the fit. Another similarmembership value can be calculated from the lagplot, and the atmospheric lag cluster. Specificallythe number of sigma a point is from the best fit linecan be calculated given the variance in the atmo-spheric lag cluster data. A lag cluster nsigmaconfidence can then be calculated using an appro-

priate membership function such as .ex2–

Page 5: FUZZY IMAGE PROCESSING APPLIED TO TIME SERIES …FUZZY IMAGE PROCESSING APPLIED TO TIME SERIES ANALYSIS R. Andrew Weekley1*, Robert K. Goodrich1,2, Larry B. Cornman1 1National Center

3.3.Final confidence calculation and the FinalFeature

Recall from the Figure 6 that there were multi-ple clusters in the primary mode data. These clus-ters can be combined into a single large cluster ora final feature that spans the entire time interval.The idea is to partition the clusters into meta-clus-ters, or cluster the clusters. In the histogram fieldshown in Figure 6, both the good clusters (cen-tered on 17 ms-1) and the dropout clusters (nearzero) appear as bright blue regions. Recall thatthere were two clusters of data in the lag plot (Fig-ure 8), if the time series data were stationary thenthere should only be a single lag cluster, i.e., thepoints in the lag-1 plot would be distributed alongthe one-to-one line. The fact there are two suchclusters, can be used to partition the histogramclusters into meta-clusters that belong to the samestationary feature, that is by determining whichdata points occur in which cluster in both (Figure 8and Figure 6). For instance, suppose all the pointswhich are in the large cluster near the center ofFigure 8 are given a large stationary lag clustermembership value. Next the stationary histo-gram cluster membership value is calculated byfinding all the histogram clusters with a point whichhas a large stationary lag cluster membershipvalue. Consequently all clusters centered on 17ms-1 in Figure 6 will be given a large stationary lagcluster membership value, and hence belong tothe same stationary feature.

A combined membership value or finalconfidence for each point can be calculated (Fig-ure 9) by a fuzzy combination of all the individualmembership values, i.e. the histogram member-ship value, the stationary feature membershipvalue, the local best fit value, the lag clusternsigma value, and so on. Notice that the combined

Figure 9. The data from Figure 2 is shown where thecolor of each point is determined by the combinedmembership function. A blue color has a membershipnear 1, and a red color has a membership near zero.

membership value correctly gives a low confi-dence to the data dropouts, and the spuriouspoints that fall between the dropouts and the pri-mary signal. Notice the confidence value performswell in Figures 10 and 11 as well. Figure 10 is thefinal confidence values for the data from Figure 3.Notice most of the points from time periods whenthe anemometer was spinning are given low mem-bership values (red). Figure 11 is the final confi-dence values given for the data in Figure 4. Noticethe points in the suspicious streaks in the timeseries data near 200 degrees are given low mem-bership values (red). These confidence values inFigures 9, 10 and 11 do identify most of the outli-ers. Simulations and human verifications havebeen done, and IODA does well in classification ofoutliers. These studies will be reported elsewhere.

4. ADDITIONAL APPLICATIONS

The data in Figure 12 is the vertical wind asmeasured by an aircraft flying in the vicinity ofJuneau. As before the color of the points indicatesthe confidence in the data. There are two catego-ries of data in this plot, semi-continuous data

Figure 10. The data from Figure 3 is shown with bluecolors representing points with high membership val-ues.

Figure 11. The data from Figure 4 is shown. Notice thestreaks in the data are given a low membership value.

Page 6: FUZZY IMAGE PROCESSING APPLIED TO TIME SERIES …FUZZY IMAGE PROCESSING APPLIED TO TIME SERIES ANALYSIS R. Andrew Weekley1*, Robert K. Goodrich1,2, Larry B. Cornman1 1National Center

(mostly cool colors), and disperse data (dispersewarm points centered on 0 ms-1). On a gross scalethe confidence values assigned to the data corre-spond to what a human expert might give thepoints. However upon closer inspection there arelow confidence points intermixed with the semi-continuous data. These halo points are not wellauto correlated and hence are given a low atmo-spheric membership value. The confidence valuesshown in Figure 12 were calculated by IODA with-out any modification or tuning of parameters, andit is important to note that during the developmentof IODA such an example was never explicitlyconsidered (although individual aspects were,such as the near uniform appearance of the dis-perse data). This example is encouraging evi-dence that the principles and implementation ofIODA can be applied to time series data fromsources other than anemometers.

Figure 13 is the result of a simulation. Pointswere selected at random from an interval of timewith few outliers. The selected data points werethen replaced with values selected from a uniform

Figure 12. An example of aircraft wind speed timeseries data is shown. The vertical axis is in m s -1 andthe horizontal axis is in seconds. High membership val-ues are blue.

Figure 13. A simulation of anemometer data with uniformbackground noise. Notice the signal is given by highmembership values (blue).

distribution with the same range as the nominalanemometer data. As can be seen from Figure 13the underlying time series is discernible to thehuman eye (blue). Furthermore the confidencesassigned to the time series again roughly corre-sponds the what a human might assign to the data(given infinite patience). Such examples are seenin lidar data in the presence of a weak signalreturn.

5. CONCLUSIONS

We have studied the use of fuzzy image pro-cessing techniques to find outliers in time seriesdata. Even though IODA was developed usinganemometer data, and their specific failuremodes, these techniques should apply to otherdata sets as well. Specifically, if the time series isapproximately stationary over the analysis timewindow considered, the range of the correlationcoefficients for nominal data is understood in thefirst few lag spaces, the outliers are not well corre-lated with the true data, and the statistical proper-ties of the outliers are known, then such ananalysis should perform well. That is, if a humanexpert can separate the true data from the outliersin these and other images, then there is hope toconstruct fuzzy modules to separate the data fromthe outliers.

6. REFERENCES

Abraham, Bovas and Johannes Ledolter, 1983: Statisti-cal Methods for Forecasting. J. Wiley and Sons,New York, pp. 445

Barnett, V. and T. Lewis, 1977: Outliers in StatisticalData, (3rd Edition), John Wiley and Sons, NewYork, pp. 584

Chi, Z., Y. Hong and P. Tuan, 1996: Fuzzy Algorithmswith Applications to Image Processing and PatternRecognition, Wold Scientific, Singapore, pp. 225

Priestley, M. B., 1981: Spectral Analysis and TimeSeries, Academic Press, New York, pp 890.

Zimmerman, H. J., 1996: Fuzzy set theory and its appli-cations, Kluwer Academic Publishers, Boston, pp.435

7. ACKNOWLEDGEMENTS

We thank Brant Foote for providing funding throughthe National Center for Atmospheric Research,Research Applications Program opportunity funds. Wealso thank Corinne Morse and Inger Gallo for their edito-rial assistance.