In this work, we focus on the detection of leaks occurring in district metered areas (DMAs). Those leaks are observable as a number of time-related deviations from zone patterns over days or weeks. While they are detectable given enough time, due to the huge cost of water loss resulting from an undetected leak, the main challenge is to find them as soon as possible, when the deviation from the zone pattern is small. Using our collected observational data, we investigate the appearance of leaks and discuss the performance of several machine learning (ML) anomaly detectors in detecting them. We test a diverse set of six anomaly detectors, each based on a different ML algorithm, on nine scenarios containing leaks and anomalies of various kinds. The proposed approach is very effective at quickly (within hours) identifying the presence of a leak, with a limited number of false positives.

  • We focus on the detection of leaks and anomalies occurring in the district metered areas (DMAs).

  • We use machine learning anomaly detection algorithms on hourly inflow, loss, consumption and pressure data.

  • We test the proposed approach on nine scenarios and show its good performance, potentially finding leaks within hours, with a limited number of false positives.

Growing human population, especially in urban areas, creates many new challenges for water distribution systems maintenance, as growing demand requires them to be more efficient and limit water losses. In those, major factors are leakages and burst in pipe networks, which occur between water treatment and delivery to customer locations. As quoted in Mamlook & Al-Jayyousi (2003) and Beuken et al. (2008), water loss occurs in almost all water networks and starts from 3 to 7% in developed countries, rising to more than 50% in undeveloped ones. While this creates an obvious economical issue and is a major concern for water delivery companies, the problems of water loss are also environmental, sustainability and potentially even energy, health and safety issues (Colombo & Karney 2002). In recent years, there has been a significant amount of research concerning leak management in water delivery systems (WDS), as seen in reviews (Puust et al. 2010; Xu et al. 2014).

Water leak management consists of: leak detection, localisation and repair (Islam et al. 2011); this paper is focused on the first of those issues. While a large burst in a pipe network may sometimes be easily detected, e.g. by reported flooding or when it causes a sudden pressure drop in the WDS, small leakages may stay undetected for days or even weeks. WDS are commonly segmented into zones, or district metered areas (DMAs).

Data-based leak detection is DMAs was typically based on inlet meter and pressure sensors. The inlet meter provides frequent (e.g. hourly) information about the water inflow into the DMA, while pressure sensors provide information from selected points within the DMA – often a single measure at the inlet. Inflow analysis methods (Buchberger & Nadimpalli 2004; Rahmat et al. 2017) are typically applied to such data by system operators. One of the most significant approaches is the analysis of minimum night flow (MNF) (Farley & Trow 2003; Liemberger & Farley 2004; Alkasseh et al. 2013) based on the observation that nightly DMA consumption is much lower than during the daytime, which means leakages or pipeline bursts easier to observe. An approach, called BABE (Bursts and Background Estimates) was proposed in Lambert (2007) and used both inflow information and annual losses data. Inflow was often used in conjunction with data from pressure sensors, such as in a fuzzy approach presented in Islam et al. (2011), multi-scale neural networks proposed in Hu et al. (2021) or in statistical anomaly detection (AD) in time series-based approach in Wu & He (2021).

Wider use of smart meters, which are able to provide frequent data from every single end-point of the water network, resulted in a significant number of works on using such data to detect post-meter leaks (leaks within the internal network of the consumer). Example approaches include the use of individual periods of null consumption and minimum night usage to detect client leaks (Boudhaouia & Wira 2018) or building a user usage profile (Abate et al. 2019). Data from smart meters can also be employed for DMA leak detections, it allows for calculating DMA's joint consumptions and using them along with the inflow values to obtain the DMA water loss value. A problem of detecting leaks using a smart meter system is presented in Farah & Shahrour (2017), example approaches include the pressure-driven balance model proposed in Yu et al. (2021), or graph partitioning methods (Rajeswaran et al. 2018).

In this work, we study the problem of leak detection using the DMA monitoring data. We use hourly data of DMA inflow, total water consumption (computed from a smart meter grid) and a small number of pressure sensors (1–3, depending on the particular DMA configuration). These hourly data vectors form an input to the detection algorithm while the output is a binary value indicating that a leak is detected. Such detection can easily be integrated into the monitoring software (e.g. through a dashboard notification for the DMA operator). The use of hourly DMA in this scenario differs from a more typical scenario of MNF analysis, which may require three or more data points to detect consistent growth in loss values which means that at least 72 h have to pass before the leak can be detected – as we show, usage of hourly data can lead to much quicker reaction time.

Our proposition for detecting leaks is to detect the anomalies it causes in the DMA monitoring time series data. By treating leak detection as an AD problem, we can use many well-researched machine learning (ML) algorithms, which have been successfully applied in other domains. The ML methods have already been applied to leak detection: in Farah & Shahrour (2017), the probability density function was applied to hourly water consumption on the customer level to detect local leaks. Self-supervised leak detector (SSLD) was proposed in Blázquez-García et al. (2021), the method is based on differences from normal system behaviour in hourly inflow data. An interesting approach is proposed by the authors of Sadeghioon et al. (2018) who use AD methods on the pressure and temperature monitoring for the pipeline. However, a typical approach is to use a physical pressure simulation model such as an EPANET simulation in Mashhadi et al. (2021) or Fan et al. (2021). Compared to this approach, our method is simpler, easier to apply and less computationally expensive. In addition, it can be applied to DMAs with a limited number of pressure sensors.

The main challenge that is to be expected when applying general AD methods for leak detection is the complex nature of the input data. Most effective approaches to AD are based on ML, i.e. learning typical patterns from the data and detecting outliers as non-conforming to those patterns. This usually requires a long history of stationary data for model learning. In contrast to that, DMA monitoring data are heterogeneous (e.g. inflow or loss has different nature to pressure data), complex (e.g. hourly and daily variations, irregular users) and frequently changing in character (due to e.g. maintenance and management operations). Due to those difficulties, the performance of AD methods in a leak detection role is an open question.

In this paper, we present an experimental analysis of applying eight algorithms that represent the current state of the art of AD to detection of two distinct classes of leaks: a build-up leak and a spike leak. We use a dataset of eight scenarios analysed and confirmed by experts in three different DMAs. In addition to leaks, we investigate anomalous situations resulting from pipeline maintenance. We show that the proposed approach is a promising method of leak detection with an ability to capture a majority of tested leaks within the first 24 h.

We focus on time series AD, the task of which is to identify patterns in time series data that do not correspond to a well-defined notion of a normal or typical behaviour (Chandola et al. 2009).

Our detection scenario is based on the observation that DMA time series data are not stationary, i.e. its statistical properties may change in time. A moment of such change is often visible as a distinct anomaly in data, e.g. a sharp change in pressure readings, inflow or loss values. If such event is spotted by an operator, it is investigated or sometimes ignored, e.g. when it results from a planned maintenance task. Typically, anomalous readings last for a time, from a few hours to even days, until they stabilise. However, the new ‘normal’ DMA state is often distinctly different from its state before the anomaly which may correspond to differences in mean values of pressures or loss, their variance or even a presence (or lack of) a subset of pressure sensors. This indicates the need to retrain AD models, which work in a time-localised region of the DMA data, i.e. between what the operator defines as a new normal state (after e.g. the previous leak is repaired) and the discovery of a new one (reported by the AD and being investigated).

Time-localised AD for leak detection

Given a set of DMA time regions, our data are time series where are hourly timestamps and is a number of raw measured data streams and/or derived features in the DMA region . In all cases considered in this paper, includes values of zone inflow, aggregated consumptions as well as hourly water loss value, computed as DMA inflow and consumption difference. Some cases include also one of more pressure sensor data – minimum, average and maximum values over hourly intervals.

Given a set of training vectors representing a typical DMA behaviour, an anomaly detector is a function that for any input data vector returns a value of detection statistics (DS). High values of DS indicate the abnormality of a data vector compared to the statistical properties of the training set. Given some value of a detection threshold , an anomaly is detected in the DMA region z and time t if .

Training set

Given a DMA region z, a detector D starts to process DMA data starting from time . Vectors from up to form a training set , where n is a training set size. An anomaly can then be detected in time .

Detection accuracy metric

An anomaly in a dataset is labelled by its anomaly time associated with the moment when the anomaly begins. The (first) moment of detection by an algorithm is denoted as . The difference between the detection and anomaly times is the detection accuracy metric used to estimate the performance of the detector. Since the accuracy metrics value can be negative (indicating a detection before the anomaly time) or positive, when this value is minimised, e.g. in the case of detector parameter selection, its absolute value is used.

Anomaly threshold

Given a training set for a DMA region , and a detector D, first the maximum and minimum values of the DS over the training set, and , respectively, are computed. The anomaly threshold is estimated as where is a scaling parameter of the detection algorithm. Larger values of the scaling parameter may be used to lower the probability of false alarms, especially for small training sets.

The detection probability of a detector D for a data vector v is estimated as
(1)

In our experiments, a value of corresponds to detecting an anomaly.

Parameter selection

The detection performance of every algorithm depends on its internal parameters, e.g. the number of neighbours k for a -NN detector, and the threshold scaling parameter, common to all detectors. In order to select the parameters in the most objective and unbiased manner, for every scenario, parameter values are determined based on data from other scenarios and without access to data from the currently tested scenario. This approach follows two assumptions: on one hand, a number of examples of DMA leaks are available. On the other hand, parameters of the detectors should be general, which means that all leaks can be detected (a detector is not trained for a particular class or type of leaks). In the presented experiments, we require that a chosen set of detector parameters should work for both classes of leaks in our scenarios.

More formally, the parameters of the detector are estimated by performing a grid-search using a leave-one-scenario-out approach: Given a set of parameters in a searched parameter grid (i.e. a Cartesian product of the parameter grid), a parameter candidate is evaluated by computing its averaged detection score. The averaged detection score is computed by performing a detection experiment on a set of remaining scenarios and averaging absolute values of their detection accuracy. The best parameters are chosen by minimising the averaged detection scores among all parameter candidates.

Detectors

We have chosen eight AD algorithms for our experiments. These algorithms include both well-known and recent methods and represent a diverse set of approaches to AD problems with regard to both assumptions and detector complexity:

  • 1.

    -nearest neighbours (-NN) (Angiulli & Pizzuti 2002) and local outlier factor (LOF) (Breunig et al. 2000) detectors are examples of proximity-based detectors, where the abnormality of an example depends on the distance from its neighbours in the feature space.

  • 2.

    Isolation forest (IF) (Liu et al. 2012) is an ensemble approach which works on the principle of randomly choosing features and generating ensembles of binary trees, measuring the abnormality of examples by the length of their paths in the trees.

  • 3.

    One-class support vector machine (OCSVM) (Schölkopf et al. 2001) is a kernel-based approach based on the principle of finding a maximal margin hyperplane separating the dataset from its origin after mapping data points into a high-dimensional feature space (using a kernel function).

  • 4.

    AutoEncoder (AE) (Charu 2019) is a neural-network, reconstruction-based approach, where an NN model is used to encode and then reconstruct a dataset and the abnormality of examples depends on the value of the reconstruction error.

  • 5.

    Principal component analysis (Shyu et al. 2003) is a subspace-based approach where the abnormality score of an example is obtained as the sum of its projected distance on eigenvectors with small or large eigenvalues.

  • 6.

    Unsupervised outlier detection using empirical cumulative distribution functions (ECOD) (Li et al. 2022) and copula-based outlier detection (COPOD) (Li et al. 2020) are examples of probabilistic approaches which first estimate the distribution of data and then estimate example abnormalities based on their tail distributions across dimensions.

Detection scenarios

The scenarios were selected from leak and anomaly events discovered during routine maintenance of WDS in one Polish city. The events were taken from three DMAs (denoted as ‘zone A’, ‘zone B’, ‘zone C’) and numbered accordingly (e.g. A-1, A-2, B-1). Expert's knowledge and consultations with WDS operators were used to select the DMAs, events within the zones, their starting times and AD targets . In order to test the performance of detectors in the absence of unusual events in data, one additional scenario marked as N-1 was prepared.

Scenario A-1

The A-1 scenario (Figure 1) presents the leak that was caused by the break in the pipeline that was gradually growing under the continuous pressure of water. This results in a consistent, growing trend in water loss. As the break gets bigger and the leak increases, the average pressure in the zone drops noticeably. The leak was detected by the provider on the 1st of August, located on the 4th and repaired on the 5th, which can be observed as a major drop in the water loss. The labelling visible in the data was done post-factum by analysis of changes in MNF. The experts set the value 9 days before it was actually noticed in the DMA by human operators, as it is the recommended behaviour of a leak detection system.
Figure 1

Scenario A-1, a leak that grows bigger as the break in the pipeline gets larger under water pressure which results in increasing loss and decreasing pressure values. The loss plot is computed as the difference between zone inflow and the sum of consumptions of individual customers. The pressure plot is hourly average and minimum of the sensor readout. The vertical dashed line denotes the target for anomaly detectors () set by the experts. Note that in this case the target was set by the experts 9 days earlier than the leak was originally detected, as it is the recommended behaviour of a leak detection system.

Figure 1

Scenario A-1, a leak that grows bigger as the break in the pipeline gets larger under water pressure which results in increasing loss and decreasing pressure values. The loss plot is computed as the difference between zone inflow and the sum of consumptions of individual customers. The pressure plot is hourly average and minimum of the sensor readout. The vertical dashed line denotes the target for anomaly detectors () set by the experts. Note that in this case the target was set by the experts 9 days earlier than the leak was originally detected, as it is the recommended behaviour of a leak detection system.

Close modal

Scenario A-2

The A-2 scenario (Figure 2) presents a leak that was located in the district of detached houses, originating in the break in the PE-63 pipe. The lower diameter of the piping caused the increase in water loss to be smaller than in scenario A-1, which resulted in the leak being detected long after it began – around the 22nd of September when a sudden growth in the water can be observed, as the deterioration of the piping progressed. It is likely that this particular leak was caused by the process of refilling the pipeline under high pressure after repairing the leak from scenario A-1, as they were located close to each other. The repair of this leak was performed with the part of the district cut off from the main pipeline which can be noticed by a sudden pressure loss when the pipes are cleaned and refilled.
Figure 2

Scenario A-2, a slowly increasing leak resulting in a consistent, growing trend in the water loss. The presented leak followed the one in scenario A-1.

Figure 2

Scenario A-2, a slowly increasing leak resulting in a consistent, growing trend in the water loss. The presented leak followed the one in scenario A-1.

Close modal

Scenario A-3

The A-3 scenario (Figure 3) presents the third case of a build-up leak. Compared to scenarios A-1 and A-2, this one is the most dynamic, with an increase in water loss values from two to seven cubic meters per hour within 2 weeks. Similarly to scenario A-1, a slight but noticeable pressure loss can be observed. The leak was located on 4 November and repaired on the following day. During the repair, a part of the district was cut off from the main pipeline which can be seen as a sudden drop in pressure on the 4 November.
Figure 3

Scenario A-3, a dynamically increasing leak resulting in a consistent, growing trend in the water loss and small but noticeable pressure drop.

Figure 3

Scenario A-3, a dynamically increasing leak resulting in a consistent, growing trend in the water loss and small but noticeable pressure drop.

Close modal

Scenario A-4

The A-4 scenario (Figure 4) presents a leak that was not caused by pipeline damage, but according to experts, it could be a result of improperly performed maintenance – an operation of cleaning and refilling a DMA fragment after repairing an actual leak (the leak in scenario A-2). A sudden inflow from the main pipeline resulted in a sudden drop in pressure values followed by a sharp spike in water loss values as the water was filling empty pipes. This water was not registered by clients' meters; therefore, it is still considered a loss.
Figure 4

Scenario A-4, a sharp drop followed by a spike in DMA water loss values. The most probable cause of this anomaly is the maintenance of the pipeline.

Figure 4

Scenario A-4, a sharp drop followed by a spike in DMA water loss values. The most probable cause of this anomaly is the maintenance of the pipeline.

Close modal

Scenario A-5

The A-5 scenario (Figure 5) shares similarities with scenario A-4 – the event follows the leak from scenario A-3. The decrease in loss and pressure values is the result of pipeline repair. They are followed by a sharp spike in the loss function. According to experts, the fact that this spike occurred after a few hours may indicate that it resulted from a new pipeline break, which was immediately noticed and repaired – perhaps by the same crew that performed the first maintenance. The scenario may be considered a special, challenging case for anomaly detectors, as it is composed of two events; a build-up and a spike leak.
Figure 5

Scenario A-5, a challenging case of two anomalies: a build-up and a spike leak one after another.

Figure 5

Scenario A-5, a challenging case of two anomalies: a build-up and a spike leak one after another.

Close modal

Scenarios A-6 and B-1

Scenarios A-6 and B-1 (Figure 6) present two points of view on the same event, which is the closure of the gate valves between two DMAs, one of which is part of the other. The DMA A which is usually supplied through DMA B has been temporarily connected to a different DMA. The gate between DMAs B and A was closed which caused a drop of pressure in the pipe connecting them. There is no consistent increase in loss values after the event which may differentiate this situation from an obvious leak. The characteristic feature of this anomaly is a sharp drop in minimum pressure values of the sensor located between DMAs – this sensor is the input sensor of DMA A and the output sensor of DMA B. According to experts, the relatively large water loss value in the DMA B may be caused by a ‘stable’, undetected leak of approximately 5 m3 of water per hour.
Figure 6

Scenarios A-6 (top plot) and B-1 (bottom plot): an anomaly resulting from pipeline maintenance in two connected DMAs with a sharp drop in minimum pressure values in the pipe connecting them.

Figure 6

Scenarios A-6 (top plot) and B-1 (bottom plot): an anomaly resulting from pipeline maintenance in two connected DMAs with a sharp drop in minimum pressure values in the pipe connecting them.

Close modal

Scenario C-1

Scenario C-1 (Figure 7) presents a clear case of a pipeline break. The leak results in an increase in losses and a decrease in pressure values in the DMAs. In contrast to scenarios A-4, A-5 and A-6, the pressure drop is not a single peak but lasts for a longer period.
Figure 7

Scenario C-1, a break in the pipeline located in the DMA, indicated by an increase in DMA loss values and a decrease in values on one of the pressure sensors, lasting for a long period of time.

Figure 7

Scenario C-1, a break in the pipeline located in the DMA, indicated by an increase in DMA loss values and a decrease in values on one of the pressure sensors, lasting for a long period of time.

Close modal

The visible pressure values come from sensors located in the provider's pipes (the highest pressure value, with values consistently above 6,000 mbar), the sensor located after the pressure reducer and the third one located deep within the DMA. The first two sensors do not show any major changes which indicate that the anomaly is located within the DMA, far from the source.

Scenario N-1

Scenario N-1 (Figure 8) was prepared to test the sensitivity of detectors to false-positive (FP) errors. The scenario consists of 20 selected time series of water meter consumptions, examined by experts and containing no anomalous events. The inflow was artificially generated by adding the hourly consumptions of individual meters and subtracting the scaled loss value, sampled from the distribution derived from the DMA.
Figure 8

Scenario N-1, with no anomalous events present in the data.

Figure 8

Scenario N-1, with no anomalous events present in the data.

Close modal

Experiments

Experiments were implemented in Python 3.9 using NumPy, SciPy, pandas, Matplotlib libraries, as well as PyOD library (Zhao et al. 2019). For every scenario, the length of the training set was set to half of the period between its first timestamp and the timestamp of the anomaly . Only the moment of the first detection for each detector is evaluated.

Features

The data features consisted of hourly values of DMA consumptions, raw inflow, and loss (difference between consumptions and inflow), as well as min, max and mean values of pressures from all DMA pressure sensors. This set of features was chosen as one of the best after initial experiments.

In every scenario, the features were standardised, by subtracting the mean and dividing them by the standard deviation, the values of which were estimated on the training set. The features with zero variance in the training set were removed.

Parameters

The ranges of parameters used in our experiments were as follows:

  • 1.

    For every detector, the range threshold scaling parameter .

  • 2.

    -NN: the number of neighbours, three approaches to outlier score estimation were tested: a distance to the -th neighbour and both average and median distances to all -neighbours.

  • 3.

    LOF: the number of neighbours .

  • 4.

    IF: the size of the ensemble .

  • 5.

    OCSVM: Radial Basis Function (RBF) kernel, parameters , .

  • 6.

    AE: four hidden layers neurons, bath size , learning rate .

  • 7.

    PCA: the number of components is estimated using the heuristics described in Minka (2000).

  • 8.

    ECOD, COPOD: the methods are nonparametric.

Results

Overall results of the experiments in the form of the detection accuracy are presented in Table 1. Negative values of accuracy correspond to early detection, while positive values to late detection of an anomaly. The absolute value of the accuracy score, i.e. the distance to the denoted anomaly time, may be viewed as the performance score of the scenario/detector pair. Detection results of individual detectors are presented in Figures 911.
Table 1

Results of detection experiments with all features

DetectorA-1A-2A-3A-4A-5A-6B-1C-1Avg
COPOD          
ECOD       
k-NN          
LOF          
PCA          
OCSVM          
AE          
IFOREST      
Avg          
DetectorA-1A-2A-3A-4A-5A-6B-1C-1Avg
COPOD          
ECOD       
k-NN          
LOF          
PCA          
OCSVM          
AE          
IFOREST      
Avg          

Values in the table represent the detection accuracy, i.e. the difference between the actual and detected starting time of an anomaly (in hours) with ‘x’ denoting no detection. The last row and last column present values averaged over their absolute value.

Figure 9

Detection results for experimental scenarios with annotated responses of individual detectors. Values near the detector name are the detection accuracy scores. (a) A1, (b) A2, (c) A3.

Figure 9

Detection results for experimental scenarios with annotated responses of individual detectors. Values near the detector name are the detection accuracy scores. (a) A1, (b) A2, (c) A3.

Close modal
Figure 10

Detection results for experimental scenarios with annotated responses of individual detectors. Values near the detector name are the detection accuracy scores. (a) A4, (b) A5.

Figure 10

Detection results for experimental scenarios with annotated responses of individual detectors. Values near the detector name are the detection accuracy scores. (a) A4, (b) A5.

Close modal
Figure 11

Detection results for experimental scenarios with annotated responses of individual detectors. Values near the detector name are the detection accuracy scores. (a) A6, (b) B1, (c) C1.

Figure 11

Detection results for experimental scenarios with annotated responses of individual detectors. Values near the detector name are the detection accuracy scores. (a) A6, (b) B1, (c) C1.

Close modal

Our scenarios can be divided into four ‘types’ of events:

  • 1.

    Scenarios A-1, A-2 and A-3 are examples of typical leaks resulting from breaks in the pipeline. This type of leak is usually detected through analysis of MNF which requires a minimum of two or three values from consecutive days. In this context, leak detection in less than h can be considered a good result compared to the MNF analysis. A majority of tested detectors achieved this result with only three higher values of detection scores. In scenarios A-1 and A-3, the detection time of almost all detectors was lower than h. Scenario A-2 proved to be challenging which is indicated by its high mean detection score compared to other scenarios. The relatively late response of most detectors in this scenario may result from a large variance in the values of loss and pressure in the training set. As a result, some detectors reacted only to strong changes in the trend visible in Figure 8(b) after about 4 and 7 days.

  • 2.

    Scenarios A-4 and A-5 are examples of rapid, huge losses which cannot be detected by MNF analysis. In the case of A-4, a majority of detectors reacted to the sudden drop in loss values 2 h before the actual leak – the early activation of the copod detector can be considered a false positive. Scenario A-5 was clearly a challenge for half of the detectors, which is indicated by its second-worst mean detection score. However, looking at Figure 9(b), it seems that detectors that activated early were triggered by rising loss values. Since rising losses are also an indication of leaks in scenarios A-1, A-2 and A-3, it can be expected that algorithms trained to detect both kinds of leaks may be sensitive to such anomalies.

  • 3.

    Scenarios A-6 and B-1 are an example of the same event observed in two connected DMAs. The event was a result of pipeline maintenance works but exhibited clearly anomalous characteristics with sharp changes in both loss and pressure values. Interestingly, while in B-1 scenario, all detectors captured the event within 1 h, in A-6, a majority of detectors reacted to a sharp spike in loss values 25 h earlier. Only a copod detector reacted almost the same in both scenarios, which may indicate that it was triggered by changes in pressure values instead of loss (notice that both DMAs share a pressure sensor at the point of their connection). The difference in performance may result from the fact that B-1 DMA contains more water meters and has significantly higher raw inflow; therefore, the DMA consumption and loss functions have lower variance.

  • 4.

    Scenario C-1 is an example of a confirmed break in the pipeline resulting in a sharp spike in loss values and a drop in minimal and average pressures. A majority of detectors activated within 2 h which can be considered an acceptable result. Interestingly, both ECOD and COPOD detectors which share similarities in their design, acted differently – one activated early while the other activated late.

Regarding the scores of individual detectors:
  • When considering detection scores presented in Table 1, the PCA, -NN, AE, COPOD and LOF detectors were on average able to capture anomalies within 24 h time. On the other hand, ECOD and IFOREST detectors performed relatively poorly with regard to their mean score.

  • Two detectors: ECOD and IFOREST were not able to detect anomalies in multiple scenarios which may indicate their low sensitivity.

  • Activation times of the COPOD detector are visibly different from the remaining algorithms while its mean detection score is fourth among tested methods. When considering averaging scores of multiple detectors in some form of ensemble learning, this diversity makes COPOD a valid candidate for such an ensemble.

  • Figure 12 presents the detection probability of three example detectors in the A-3 scenario. In this example, the COPOW detector estimated probability function seems to be primarily correlated with average pressure values, while PCA and LOF functions follow the change in both the pressure and loss functions of DMA. A comparison of detection probabilities of all detectors and scenarios reveals that this is a common pattern: responses of COPOD and ECOD detectors share similarities and are less correlated with loss values than responses of the remaining detectors.

Figure 12

Detection results for scenario A-3 with estimated probability and an annotated moment of activation of three example detectors. The probability of PCA and LOF detectors is correlated with the loss function; therefore at some point, it becomes, saturated. The COPOD detector probability seems to depend more on pressure values. (a) COPOD detector, 0 h difference; (b) PCA detector, 1 h difference; (c) LOF detector, 94 h difference.

Figure 12

Detection results for scenario A-3 with estimated probability and an annotated moment of activation of three example detectors. The probability of PCA and LOF detectors is correlated with the loss function; therefore at some point, it becomes, saturated. The COPOD detector probability seems to depend more on pressure values. (a) COPOD detector, 0 h difference; (b) PCA detector, 1 h difference; (c) LOF detector, 94 h difference.

Close modal
The output of detectors in a scenario that does not contain anomalous events is presented in Figure 13. In the experiment, half of the data (300 h) was used for training and parameters were selected using all remaining scenarios. Every detection in the other half is a false positive. Most of the detectors made no errors or only one error. The exception is detector ECOD, which made six errors. This corresponds to false-positive ratio (FPR) of % for detectors that triggered once and % for the ECOD.
Figure 13

Detection results for scenario N-1 testing the detectors for false positives (FP). Vertical lines denote every case of detection.

Figure 13

Detection results for scenario N-1 testing the detectors for false positives (FP). Vertical lines denote every case of detection.

Close modal

Discussion

Results indicate that on average, a large subset of anomaly detectors captures both the gradually growing and the sudden DMA leaks within the first 24 h. Compared to the MNF analysis which requires 2 or 3 days, the overall response time of anomaly detectors should be considered short.

Despite these promising results, the presented scenarios show the complexity of the leak detection problem in hourly data. Hourly consumption and pressure data show significant variance. The nature of the anomalies themselves is also varied, which makes it difficult to describe and classify them. It is even more difficult as the cases of actual, confirmed leakages, which may constitute training data for ML methods, are relatively rare. In addition, anomalies resulting from both leakages and other events may occur directly after each other or coexist, as in scenario A-5.

Considering the complexity of DMA hourly data and lack of training examples, one of the major problems of using anomaly detectors for detecting DMA leaks is their parameterisation, i.e. finding parameters that will allow for accurate detection while keeping the number of false alarms low. Since our approach to parameter selection involves averaging detection accuracy scores over several example scenarios (see Section 2.1.4), we can treat the aggregated score of the best parameter set as a measure of expected detector performance. The results of parameter selection are presented in Table 2. Comparing these scores with the final results in Table 1, it can be concluded that they are a good estimation of detector performance, especially with regard to the best (PCA) and the worst (ECOD, IFOREST) detectors. They are, however, not a good estimation of a dataset performance which can be expected, since the estimation of these scores for a dataset is performed using the remaining datasets. The results for scenario N-1 indicate that the FPR of the detectors with the proposed parameterisation scheme is relatively low (% for the majority of algorithms tested). In practice, the detector parameters, and in particular, the detection threshold, are manually adjusted for most DMAs, which helps to keep the FPR low.

Table 2

Results of parameter selection described in Section 2.1.4

DetectorA-1A-2A-3A-4A-5A-6B-1C-1Avg
COPOD          
ECOD          
k-NN          
LOF          
PCA          
OCSVM          
AE          
IFOREST          
Avg          
DetectorA-1A-2A-3A-4A-5A-6B-1C-1Avg
COPOD          
ECOD          
k-NN          
LOF          
PCA          
OCSVM          
AE          
IFOREST          
Avg          

The table presents averaged scores of detectors over training scenarios (using the leave-one-scenario-out approach) for the best set of parameters that were used in the final experiment. Values in the table can be treated as a measure of the expected performance of the detector in a given scenario. Note that the value in the table for a given scenario/detector pair is estimated i.e. it is created without access to this scenario data.

Possible approaches to better detector parameterisation include extending the set of training scenarios by examples where anomalies do not exist – these examples are more common than ones with anomalies present and their inclusion may lower the number of false positives; allowing for periodic detector retraining; employing an ensemble of multiple detectors which vote for the final score.

Regarding the problem of feature selection, the set of features in our experiments was chosen as a result of initial experiments. Example alternative candidate sets included an extended set with additional features characterising missing values in hourly consumptions of individual DMA sensors. The incompleteness of data results from physical constraints related to the acquisition process, e.g. loss of packets transmitted over the radio which results in underestimated DMA consumption values which must be corrected with data imputation. However, compared to the set of parameters used in experiments, the extended set was on average times worse than the chosen set with regard to mean scenario scores in Table 1 and times worse with regard to mean detector scores. Another example was a reduced set including only DMA loss and raw inflow values as well as minimal and average DMA input pressures; this set of parameters was worse than the chosen one times with regards to mean scenario scores and times with regards to mean detector scores.

The goal of our experiments was to test the performance of anomaly detectors applied to detecting leaks in hourly DMA loss and pressure data. We focus on two types of leaks: the gradually growing breaks resulting in a rise in DMA losses over an extended period and sudden leaks resulting in sharp changes in loss and/or pressure values. We used eight unique datasets with examples of anomalies and leaks collected by the analysis of the annual data of four real DMAs in Poland and eight representative state-of-the-art (SOA) anomaly detectors.

Our results suggest that on average, anomaly detectors can detect both types of leaks in less than h and sometimes within 1–2 h of the incident. This is a promising result when compared with MNF analysis which usually requires data from 2 or 3 days. On the other hand, paramaterisation of detectors is challenging due to variance in hourly DMA data and a small number of example incidents which can be used as training data.

The main topics of future work will be: improving the parameterisation of detectors, examining their performance in a scenario where incidents occur one after another, and the classification of detected leaks.

This work has been partially supported by the Polish National Centre for Research and Development grant POIR.01.01.01-00-1414/20-00, ‘Intelligence Augumentation Ecosystem for analysts of water distribution networks’.

Data cannot be made publicly available; readers should contact the corresponding author for details.

The authors declare there is no conflict.

Abate
F.
,
Carratù
M.
,
Liguori
C.
&
Pietrosanto
A.
2019
Smart meters and water leakage detection: a preliminary study
. In:
B. Ando (ed.)
2019 IEEE International Instrumentation and Measurement Technology Conference (I2MTC)
.
IEEE
,
Piscataway, NJ, USA
, pp.
1
6
.
Alkasseh
J.
,
Adlan
M. N.
,
Abustan
I.
,
Aziz
H. A.
&
Hanif
A. B. M.
2013
Applying minimum night flow to estimate water loss using statistical modeling: a case study in Kinta Valley, Malaysia
.
Water Resources Management
27
(
5
),
1439
1455
.
Angiulli
F.
&
Pizzuti
C.
2002
Fast outlier detection in high dimensional spaces
. In:
European Conference on Principles of Data Mining and Knowledge Discovery
(T. Elomaa, H. Mannila & H. Toivonen (eds))
.
Springer
,
Berlin
, pp.
15
27
.
Beuken
R. H. S.
,
Lavooij
C.
,
Bosch
A. S.
&
Schaap
P. G.
2008
Low leakage in the Netherlands confirmed
. In:
8th Annual Water Distribution Systems Analysis Symposium
(S. G. Buchberger, R. M. Clark, W. M. Grayman & J. G. Uber (eds))
.
Reston, VA
.
Blázquez-García
A.
,
Conde
A.
,
Mori
U.
&
Lozano
J. A.
2021
Water leak detection using self-supervised time series classification
.
Information Sciences
574
,
528
541
.
ISSN 0020-0255. https://doi.org/10.1016/j.ins.2021.06.015
.
Boudhaouia
A.
&
Wira
P.
2018
Water consumption analysis for real-time leakage detection in the context of a smart tertiary building
. In:
2018 International Conference on Applied Smart Systems (ICASS)
(A. Tlemçani & A. Kouzou (eds))
. pp.
1
6
.
Institute of Electrical and Electronics Engineers (IEEE)
,
Piscataway, NJ, USA
.
doi:10.1109/ICASS.2018.8651976
.
Breunig
M. M.
,
Kriegel
H.-P.
,
Ng
R. T.
&
Sander
J.
2000
Lof: identifying density-based local outliers
. In:
M. Dunham, J. F. Naughton, W. Chen & N. Koudas
Proceedings of the 2000 ACM SIGMOD International Conference on Management of Data
.
Association for Computing Machinery
,
New York, USA
, pp.
93
104
.
Buchberger
S. G.
&
Nadimpalli
G.
2004
Leak estimation in water distribution systems by statistical analysis of flow readings
.
Journal of Water Resources Planning and Management
130
(
4
),
321
329
.
Chandola
V.
,
Banerjee
A.
&
Kumar
V.
2009
Anomaly detection: a survey
.
ACM Computing Surveys (CSUR)
41
(
3
),
1
58
.
Charu
C. A.
2019
Outlier Analysis
.
Springer
,
Cham, Switzerland
.
Colombo
A.
&
Karney
B.
2002
Energy and costs of leaky pipes: toward comprehensive picture
.
Journal of Water Resources Planning and Management
128
,
441
450
.
doi:10.1061/(ASCE)0733-9496(2002)128:6(441)
.
Fan
X.
,
Zhang
X.
&
Yu
B.
2021
Machine learning model and strategy for fast and accurate detection of leaks in water supply network
.
Journal of Infrastructure Preservation and Resilience
2
.
doi:10.1186/s43065-021-00021-6
.
Farah
E.
&
Shahrour
I.
2017
Smart water for leakage detection: Feedback about the use of automated meter reading technology
.
2017 Sensors Networks Smart and Emerging Technologies (SENSET)
.
IEEE
,
Piscataway, NJ, USA
, pp.
1
4
.
Farley
M.
&
Trow
S.
2003
Losses in Water Distribution Networks
.
IWA Publishing
,
London, UK
.
Hu
X.
,
Han
Y.
,
Yu
B.
,
Geng
Z.
&
Fan
J.
2021
Novel leakage detection and water loss management of urban water supply network using multiscale neural networks
.
Journal of Cleaner Production
278
,
123611
.
ISSN 0959-6526. https://doi.org/10.1016/j.jclepro.2020.123611. Available from: https://www.sciencedirect.com/science/article/pii/S0959652620336568.
Islam
M. S.
,
Sadiq
R.
,
Rodriguez
M. J.
,
Francisque
A.
,
Najjaran
H.
&
Hoorfar
M.
2011
Leakage detection and location in water distribution systems using a fuzzy-based methodology
.
Urban Water Journal
8
(
6
),
351
365
.
Lambert
A.
2007
Accounting for losses: the bursts and background concept
.
Water and Environment Journal
8
,
205
214
.
doi:10.1111/j.1747-6593.1994.tb00913.x
.
Li
Z.
,
Zhao
Y.
,
Botta
N.
,
Ionescu
C.
&
Hu
X.
2020
Copod: copula-based outlier detection
. In:
C. Plant, H. Wang, A. Cuzzocrea, C. Zaniolo & X. Wu (eds)
2020 IEEE International Conference on Data Mining (ICDM)
.
IEEE
,
Los Alamitos, California, Washington, Tokyo
, pp.
1118
1123
.
Li
Z.
,
Zhao
Y.
,
Hu
X.
,
Botta
N.
,
Ionescu
C.
&
Chen
G. H.
2022
Ecod: Unsupervised outlier detection using empirical cumulative distribution functions. arXiv preprint arXiv:2201.00382
.
Liemberger
R.
&
Farley
M.
2004
Developing A non-Revenue Water Reduction Strategy, Part 1: Investigating and Assessing Water Losses
.
Liu
F. T.
,
Ting
K. M.
&
Zhou
Z.-H.
2012
Isolation-based anomaly detection
.
ACM Transactions on Knowledge Discovery From Data (TKDD)
6
(
1
),
1
39
.
Mamlook
R.
&
Al-Jayyousi
O.
2003
Fuzzy sets analysis for leak detection in infrastructure systems: a proposed methodology
.
Clean Technologies and Environmental Policy
6
(
1
),
26
31
.
Mashhadi
N.
,
Shahrour
I.
,
Attoue
N.
,
El Khattabi
J.
&
Aljer
A.
2021
Use of machine learning for leak detection and localization in water distribution systems
.
Smart Cities
4
(
4
),
1293
1315
.
Minka
T.
2000
Automatic choice of dimensionality for PCA
. In:
Advances in Neural Information Processing Systems
(T. K. Leen, T. G. Dietterich & V. Tresp (eds))
.
The MIT Press
,
Cambridge, MA
, p.
13
.
Puust
R.
,
Kapelan
Z.
,
Savic
D.
&
Koppel
T.
2010
A review of methods for leakage management in pipe networks
.
Urban Water Journal
7
(
1
),
25
45
.
Rahmat
R. F.
,
Satria
I. S.
,
Siregar
B.
&
Budiarto
R.
2017
Water pipeline monitoring and leak detection using flow liquid meter sensor
.
IOP Conference Series: Materials Science and Engineering
190
,
012036
.
https://doi.org/10.1088/1757-899x/190/1/012036
.
Rajeswaran
A.
,
Narasimhan
S.
&
Narasimhan
S.
2018
A graph partitioning algorithm for leak detection in water distribution networks
.
Computers & Chemical Engineering
108
,
11
23
.
ISSN 0098-1354. https://doi.org/10.1016/j.compchemeng.2017.08.007
.
Schölkopf
B.
,
Platt
J. C.
,
Shawe-Taylor
J.
,
Smola
A. J.
&
Williamson
R. C.
2001
Estimating the support of a high-dimensional distribution
.
Neural Computation
13
(
7
),
1443
1471
.
Shyu
M.-L.
,
Chen
S.-C.
,
Sarinnapakorn
K.
&
Chang
L.
2003
A Novel Anomaly Detection Scheme Based on Principal Component Classifier
.
Technical Report, Miami Univ Coral Gables Fl Dept of Electrical and Computer Engineering
.
Xu
Q.
,
Liu
R.
,
Chen
Q.
&
Li
R.
2014
Review on water leakage control in distribution networks and the associated environmental benefits
.
Journal of Environmental Sciences
26
(
5
),
955
961
.
ISSN 1001-0742. https://doi.org/10.1016/S1001-0742(13)60569-0
.
Yu
J.
,
Zhang
L.
,
Chen
J.
,
Xiao
Y.
,
Hou
D.
,
Huang
P.
,
Zhang
G.
&
Zhang
H.
2021
An integrated bottom-up approach for leak detection in water distribution networks based on assessing parameters of water balance model
.
Water
13
(
6
),
867
.
ISSN 2073-4441. doi:10.3390/w13060867
.
Zhao
Y.
,
Nasrullah
Z.
&
Li
Z.
2019
Pyod: a Python toolbox for scalable outlier detection
.
Journal of Machine Learning Research
20
(
96
),
1
7
.
This is an Open Access article distributed under the terms of the Creative Commons Attribution Licence (CC BY-NC-ND 4.0), which permits copying and redistribution for non-commercial purposes with no derivatives, provided the original work is properly cited (http://creativecommons.org/licenses/by-nc-nd/4.0/).