Source-linked AI summary

A framework for automated anomaly detection in high frequency water-quality data from in situ sensors

Catherine Leigh, Omar Alsibai, Rob J. Hyndman, Sevvandi Kandanaarachchi, Olivia C. King, James M. McGree, Catherine Neelamraju, Jennifer Strauss, Priyanga Dilini Talagala, Ryan S. Turner, Kerrie Mengersen, Erin E. Peterson

arXiv:1810.13076v2stat.AP

TL;DR

High-frequency sensor data can contain anomalies caused by technical errors, while the data volume and velocity make manual checking impractical. The authors develop a framework that selects and compares detection methods in line with end-user needs and anomaly types. Regression-based, feature-based, and rule-based methods each detect some anomaly types well, supporting the recommendation to combine methods while minimizing false detections.

  • Problem

    Technical sensor errors can confound water-quality measurements, while high-volume, near-real-time data make manual checking, labelling, and correction impractical.

    Source: §1 · p. 2
  • Method

    The authors develop a ten-step framework that identifies end-user needs and anomaly types, then selects and compares detection methods for high-frequency sensor data.

    Source: §1 · p. 2, §2.1 · p. 3
  • Results

    Regression and feature-based methods detected sudden spikes and level shifts well, rule-based methods detected missing and impossible values, and a combination is recommended to improve classification while minimizing false detections.

    Source: §5 · p. 14
  • Takeaways & Limitations

    The framework emphasizes communication between end-users and analysts and is described as transferable to other high-frequency time-series and anomaly-detection applications.

    Source: §5 · p. 14

    Feature-based methods were not proficient at detecting Class 3 anomalies, and regression residuals showed heteroscedasticity that may have reduced prediction-interval accuracy.

    Source: §3.2.2 · p. 12, §4 · p. 14

Abstract

from arXiv · show

River water-quality monitoring is increasingly conducted using automated in situ sensors, enabling timelier identification of unexpected values. However, anomalies caused by technical issues confound these data, while the volume and velocity of data prevent manual detection. We present a framework for automated anomaly detection in high-frequency water-quality data from in situ sensors, using turbidity, conductivity and river level data. After identifying end-user needs and defining anomalies, we ranked their importance and selected suitable detection methods. High priority anomalies included sudden isolated spikes and level shifts, most of which were classified correctly by regression-based methods such as autoregressive integrated moving average models. However, using other water-quality variables as covariates reduced performance due to complex relationships among variables. Classification of drift and periods of anomalously low or high variability improved when we applied replaced anomalous measurements with forecasts, but this inflated false positive rates. Feature-based methods also performed well on high priority anomalies, but were also less proficient at detecting lower priority anomalies, resulting in high false negative rates. Unlike regression-based methods, all feature-based methods produced low false positive rates, but did not and require training or optimization. Rule-based methods successfully detected impossible values and missing observations. Thus, we recommend using a combination of methods to improve anomaly detection performance, whilst minimizing false detection rates. Furthermore, our framework emphasizes the importance of communication between end-users and analysts for optimal outcomes with respect to both detection performance and end-user needs. Our framework is applicable to other types of high frequency time-series data and anomaly detection applications.

1. Introduction

Technical sensor errors can make in situ water-quality measurements anomalous and confound assessment of real water-quality changes, while streaming data volume makes manual checking impractical. The paper develops a ten-step framework to compare anomaly-detection methods for high-frequency sensor data, focusing on turbidity and conductivity.

1. Introduction

  • Technical sensor errors can create anomalies that confound the assessment or identification of real water-quality changes.The study defines anomalies as observations affected by sensor-equipment technical errors rather than ecological patterns and processes.Source: §1 · pp. 2–3
  • Near-real-time, high-volume data make manual checking, labelling, and correction of every observation unfeasible, motivating automated anomaly detection.The authors identify automated detection as necessary before sensor data can be used with confidence for visualization, analysis, and reporting.Source: §1 · p. 2
  • The authors develop a ten-step framework to implement and compare anomaly-detection methods for high-frequency in situ sensor data.They demonstrate it with turbidity, conductivity, and river-level data from rivers flowing into the Great Barrier Reef lagoon in northeast Australia.Source: §1 · p. 2
  • Turbidity and conductivity are the detection targets because they are typically more temporally stable than dissolved oxygen and temperature and were the case-study end-user’s target variables.The framework treats anomalies as technical errors, not real ecological patterns or processes.Source: §1 · p. 3

2. Methods

The framework moves from identifying end-user needs and anomaly priorities toward selecting suitable detection methods. In the case study, near-real-time graphical outputs were the agency’s foremost short-term need, while longer-term goals included quality assurance and corrected data for estimating river sediment and nutrient concentrations.

2.1 Identify end-user needs and goals (Step 1)

  • End-user needs and goals guide which anomaly types matter most and, in turn, which detection methods are suitable.The framework describes these components among its steps for developing and comparing anomaly-detection methods.Source: §2.1 · p. 3, §2 · p. 3
  • The agency’s foremost short-term need was near-real-time graphical visualization of streaming sensor data, with potential anomalies identified and labelled.The longer-term goals included complete quality control and assurance, possible automated correction, and using corrected data to estimate sediment and nutrient concentrations in near-real time.Source: §2.1 · p. 3
  • Other end-users may prioritize online, real-time warnings of water-quality breaches associated with real events rather than technical anomalies.The passage notes possible economic and public-health consequences for commercial and recreational sites.Source: §2.1 · p. 3

2.2 Identify data characteristics (Step 2)

The study considers time-series characteristics and monitoring context when describing its data. It uses turbidity and conductivity measurements from two northeast Australian rivers, alongside interpolated river-level observations to examine water-quality dynamics.

2.2 Identify data characteristics (Step 2)

  • The study focuses on Pioneer River and Sandy Creek, in a tropical region with wet-season event flows and a drier season with low or zero river flows.Seasonal rainfall and temperature patterns affect water-quality patterns through time.Source: §2.2 · p. 3
  • Sensors recorded turbidity and conductivity approximately hourly or every hour and a half, while river level was measured every 10 minutes.River-level observations were linearly interpolated to match the turbidity and conductivity measurements; level was examined for context, not anomaly detection.Source: §2.2 · p. 4
  • Turbidity tends to rise rapidly during runoff and may rise gradually during low flow, while conductivity can increase in low-flow periods and decrease with fresh-water inputs.Measurements may be more frequent during event flows, and relationships among river level, turbidity, and conductivity are complex.Source: §2.2 · p. 4
  • The sensor time series covered 12 March 2017 to 12 March 2018, with 6,280 observations at Pioneer River and 5,402 at Sandy Creek.The data included turbidity, conductivity, and time-matched river level.Source: §2.2 · p. 4

2.3 Define anomalies and their types (Step 3)

The study defines anomalies as sensor-technical errors and specifies types in consultation with the end-user. It groups those types by whether they involve sudden changes, can be detected by hard-coded rules, or may need post hoc user confirmation.

2.3 Define anomalies and their types (Step 3)

  • An anomaly is a water-quality datum or set of data caused by technical error in the in situ sensor equipment.A rare high turbidity value during a real high-flow event can be valid, whereas a similarly high value beyond the sensor’s detection range can be anomalous.Source: §2.3 · p. 4
  • The end-user consultation identified sudden spikes, low or high variability, constant offsets, sudden shifts, impossible or out-of-range values, drift, spike clusters, missing values, and other untrustworthy data.The study also labels the first observation after more than 180 minutes without observations as a missing-value anomaly.Source: §2.3 · pp. 4–5
  • Class 1 covers sudden-change anomalies; Class 2 covers types suited to simple hard-coded rules; Class 3 may require post hoc user confirmation alongside automated detection.Class 1 includes types A, D, I, and J; Class 2 includes F, G, and K; Class 3 includes B, C, E, H, and L.Source: §2.3 · p. 5
  • Experts and the end-user visually identified and labelled potential anomalies and their types for implementing and assessing detection methods.Labels drew on knowledge of riverine water-quality dynamics and the specific sites and watersheds.Source: §2.3 · p. 5

2.4 Rank anomaly types by importance (Step 4)

Anomaly priorities were ranked by their potential impact if left undetected and the end-user’s goals. Large sudden spikes ranked first, followed by shifts, calibration offsets, and changes in variance.

2.4 Rank anomaly types by importance (Step 4)

  • The ranking reflects each anomaly type’s potential impact if undetected in light of end-user needs, shaping which methods count as most suitable.A method detecting the same number of anomalies may be less suitable if it catches lower-impact types instead of the end-user’s priority anomalies.Source: §2.4 · p. 5
  • Large sudden spikes ranked first; shifts, calibration offsets, and changes in variance followed, with shifts and calibration offsets tied for third.Source: §2.4 · p. 5

2.5 Select suitable methods of anomaly detection (Step 5)

The framework selects methods to suit end-user priorities and the temporal properties of near-real-time data, combining rule-based, regression-based, and feature-based approaches. The methods differ in their data requirements and detection mechanisms.

2.5 Select suitable methods of anomaly detection (Step 5)

  • Methods were selected for near-real-time, nonstationary data streams, and physical-process models and dynamic Bayesian networks or hidden Markov models were not pursued.The authors cite complexity and transferability challenges for physical-process models and limited water-quality software for the latter methods.Source: §2.5 · p. 6

2.5.1 Automated classification rules

  • Hard-coded rules flag missing-data gaps over 180 minutes, negative or zero turbidity and conductivity, and values outside sensor-specific ranges.The missing-data threshold depends on end-user needs and sensor sampling frequency.Source: §2.5.1 · p. 6

2.5.2 Regression-based methods

  • Regression methods forecast one step ahead and flag observations outside a prediction interval, using past observations and, in RegARIMA, other water-quality variables as covariates.ARIMA components can include differencing for nonstationary series; the methods also include naïve prediction, linear autoregression, and an anomaly-mitigation variant that substitutes forecasts for detected anomalies.Source: §2.5.2 · pp. 7–8
  • The general regression model combines covariates with an ARIMA error structure, and its prediction interval uses a t quantile and the training residual standard deviation.The interval was set to 99% to limit false-positive probability to 1% given relatively few labelled anomalies.Source: §2.5.2 · p. 7

2.5.3 Feature-based methods

  • Feature-based methods transform turbidity and conductivity series to expose anomalies, then apply unsupervised detection in a multivariate feature space.HDoutliers uses normalized series, representative cluster members, nearest-neighbour distances, and an extreme-value threshold; kNN-agg aggregates weighted distances across neighbour counts, while kNN-sum sums distances, using k = 10.Source: §2.5.3 · p. 9

2.6 Select metrics to evaluate and compare methods (Step 6)

The evaluation uses confusion-matrix metrics, predictive values suited to imbalanced anomaly counts, and regression forecast error. Computation time is also considered, with expected differences depending on how methods are run.

2.6 Select metrics to evaluate and compare methods (Step 6)

  • Methods were compared using accuracy, error rate, negative and positive predictive values, and regression-based root mean square error.The predictive values were included to better capture performance when anomalous and normal observations are unbalanced.Source: §2.6 · p. 9
  • Feature methods are expected to take less time than regression methods in batch runs, but near-real-time feature classification may make their computation times more comparable.HDoutliers considers one nearest neighbour, whereas the kNN methods consider all k neighbours; regression methods may also require training and parameter optimization.Source: §2.6 · pp. 9–10

2.7 Prepare data for anomaly detection (Step 7)

The data were prepared separately for regression-based and feature-based anomaly detection. Labelled anomalies were removed from regression training, while transformed water-quality series were used for feature detection.

2.7 Prepare data for anomaly detection (Step 7)

  • Regression training used clean data with labelled Class 1 and 3 anomalies removed, while testing used the original series after natural-log transformation.Linear autoregression instead used differences of the natural logarithms; zero or negative values were replaced with the previous observation to permit forecasting.Source: §2.7 · p. 10
  • Feature-based detection used one-sided and two-sided derivatives of log-transformed turbidity and conductivity to highlight priority sudden spikes.The one-sided transformation used the negative derivative for turbidity and the positive derivative for conductivity.Source: §2.7 · p. 10

2.8 Implement anomaly detection methods (Step 8)

The framework implements regression-based methods with the forecast package and feature-based methods with DDoutliers within oddwater in R. Shared rule-based code classifies observations across both method families.

  • Regression-based methods were implemented with the forecast package in R.Source: §2.8 · p. 10
  • Feature-based methods were implemented with DDoutliers through the oddwater package in R.Source: §2.8 · p. 10
  • The same rule-based code was used for automated classification within regression- and feature-based methods.Source: §2.8 · p. 10

3. Results

Across the tested time series, regression-based methods generally had high accuracy and low error rates except with ADAM; feature-based methods detected some high-priority anomalies but often missed other types. Rule-based classification detected all Class 2 anomalies without false positives.

3.1 Anomalies and their types

  • The data contained 1651 anomalous turbidity observations, 521 conductivity observations, and 8 level observations, mainly types E, H, and L.Anomaly counts were imbalanced across classes and types; some types comprised multiple observations while others had only one.Source: §3.1 · p. 11
  • No examples of types C, G, or clusters of spikes (I) were present, while missing data (K) occurred in every time series.Impossible values (F) were numerous and can be detected by rules in the same way as out-of-sensor-range values.Source: §3.1 · p. 11

3.2.1 Automated classification rules

  • Rule-based classification correctly detected every Class 2 anomaly (types F, G, and K) with no false positives in each time series.Source: §3.2.1 · p. 11

3.2.2 Regression-based methods

  • Regression-based methods generally had accuracy above 0.80 and error rates below 0.20, except when ADAM was used.ADAM could detect Class 3 anomalies missed by detection alone, but its false positives were high; naïve prediction with ADAM produced over 5000 false positives for PR turbidity, versus 133 without mitigation.Source: §3.2.2 · p. 11
  • Adding water-quality covariates did not improve RegARIMA over ARIMA and reduced conductivity classification at PR, with PPV 0.49 versus 0.93.The authors link this result to complex relationships among conductivity, turbidity, and level at the site.Source: §3.2.2 · p. 12
  • Regression residual diagnostics indicated heteroscedasticity, which may have reduced prediction-interval accuracy and affected anomaly classification.Source: §3.2.2 · p. 12

3.2.3 Feature-based methods

  • Feature-based methods had high false negative rates, especially for Class 3 anomalies; no method detected any of the 718 type L anomalies in PR turbidity.For PR conductivity, accuracy was 0.92 and error rate was 0.08, but false negatives remained high; at SC, all methods had over 900 false negatives for turbidity.Source: §3.2.3 · pp. 12–13

4. Discussion

The authors recommend choosing methods around end-user priorities and the structure of the data. ARIMA alone may suit detection of sudden spikes and shifts, while ARIMA with mitigation may detect drift or unusual variability, with training-data and model limitations to consider.

  • ARIMA without mitigation may be most useful when end-users prioritize detecting sudden spikes and shifts, which can distort summary statistics used in water-quality assessments and compliance checking.Source: §4 · p. 13
  • ARIMA with mitigation could be used to detect Class 3 anomalies such as drift and periods of high variability, which can indicate a need for sensor recalibration.Source: §4 · p. 13
  • Regression models assume evenly spaced observations, and training data should cover the full range of natural water-quality dynamics.Less frequent or irregular measurements may be problematic, particularly if natural events are missed.Source: §4 · p. 13
  • Regression-based methods are strongly influenced by training data, and the one-year case study used the same data, minus anomalies, for training and testing, raising possible over-fitting.Training on another nearby site or a different period at the same site could lessen this issue, but such nearby sensor data were unavailable.Source: §4 · p. 13
  • Because water-quality patterns can change with river flow regimes, segmenting time series into regimes may improve regression-based anomaly detection.The authors suggest hidden Markov models as one possible way to segment regimes before applying regression models.Source: §4 · pp. 13–14
  • Feature-based methods were not proficient at detecting Class 3 anomalies because their transformations and algorithms were designed to prioritize Class 1 anomalies.Other transformations may be needed to target Class 3 anomalies in different applications.Source: §4 · p. 14

5. Conclusions

The authors recommend combining anomaly-detection methods to balance correct classification with minimized false detections. They also stress end-user–analyst communication and describe the framework as transferable, while noting that more dynamic water-quality variables may make anomaly identification more challenging.

5. Conclusions

  • Combining methods is likely to improve correct anomaly classification while minimizing false detections in streaming water-quality data.The framework also emphasizes communication between end-users and anomaly-detection developers for outcomes suited to both detection performance and end-user application.Source: §5 · p. 14
  • The framework is presented as transferable to other high-frequency time series and anomaly-detection applications.Within water-quality monitoring, the authors suggest applying it to dissolved oxygen, water temperature, and nitrate.Source: §5 · p. 14
  • Applying anomaly detection to more dynamic water-quality properties may make it harder to distinguish anomalies from real events.The authors contrast dissolved oxygen, water temperature, and nitrate with the less dynamic turbidity and conductivity studied here.Source: §5 · p. 14

Supplementary materials

The supplementary materials document the study sites and anomaly labels, describe methods and performance measures, and provide additional classification plots, diagnostics, data, and code.

Supplementary materials

  • Supplementary figures show bivariate relationships and time series for Pioneer River and Sandy Creek, including end-user-identified anomalies and maintenance events.The time-series figures distinguish non-anomalous and potentially anomalous observations and mark probe swaps and other maintenance activities.Source: Supplementary materials · p. 34, Figure S1 · p. 35, Figure S2 · p. 36
  • Supplementary classification plots show results for regression methods and feature methods across the two sites and water-quality variables.The supplement also provides diagnostic plots and partial autocorrelation plots for regression-based methods.Source: Supplementary materials · p. 34, Figure S4 · p. 42, Figure S5 · p. 43
  • Separate files provide the time-series data, anomaly-type coding, and R code used to implement regression methods and calculate performance metrics.The listed scripts include site-specific files and files for naïve prediction, prediction, and performance assessment.Source: Supplementary materials · p. 34
  • The supplement includes a table of anomaly-detection method characteristics and tables describing classification and performance metrics.It also lists methods spanning rule-based, regression, uncertainty-fusion, and feature-based approaches.Source: Table S1 · p. 38, Supplementary materials · p. 38, Table S2 · p. 39
  • Additional performance tables report regression-based results for Sandy Creek conductivity and feature-based results for multivariate Sandy Creek conductivity data.The regression table incorporates automated classification rules detecting all Class 2 anomalies.Source: Table S4 · p. 41, Table S5 · p. 41
Loading 1810.13076v2…