Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Journal of Petroleum Science and Engineering xxx (xxxx) xxx

Contents lists available at ScienceDirect

Journal of Petroleum Science and Engineering


journal homepage: http://www.elsevier.com/locate/petrol

Application of machine learning to accidents detection at


directional drilling
Ekaterina Gurina a, *, 1, 2, 4, 5, Nikita Klyuchnikov a, 1, 2, 4, 5, Alexey Zaytsev a, 1, 2, 4,
Evgenya Romanenkova a, 1, 2, 4, Ksenia Antipova a, 1, 2, 4, Igor Simon b, 3, 6, Victor Makarov b, 3, 6,
Dmitry Koroteev a, 1, 6
a
Skolkovo Institute of Science and Technology (Skoltech), 121205, Moscow, Russia
b
Gazprom Neft Science & Technology Center, 19000, St. Petersburg, Russia

A R T I C L E I N F O A B S T R A C T

Keywords: We present a data-driven algorithm and mathematical model for anomaly alarming at directional drilling. The
Machine learning algorithm is based on machine learning. It compares the real-time drilling telemetry with one corresponding to
Anomaly detection past accidents and analyses the level of similarity. The model performs a time-series comparison using aggre­
Directional drilling
gated statistics and Gradient Boosting classification. It is trained on historical data containing the drilling
Classification
Measurements while drilling
telemetry of 80 wells drilled within 19 oilfields. The model can detect an anomaly and identify its type by
comparing the real-time measurements while drilling with the ones from the database of past accidents. Vali­
dation tests show that our algorithm identifies half of the anomalies with about 0.53 false alarms per day on
average. The model performance ensures sufficient time and cost savings as it enables partial prevention of the
failures and accidents at the well construction.

1. Introduction Drilling support engineers use mud logging to detect accidents while
drilling. Due to the fact, that engineers support a large number of wells
Anomaly detection is the identification of rare objects, events, or at the same time, they usually do not have time to monitor all the wells
observations that are significantly different from most data (Zimek and online, and drilling accident patterns are considered after the occur­
Schubert, 2017). Regardless of the level of the well’s construction rence of the accident. Thus, the creation of a system that signals about
technology, anomaly situations inevitably happened during drilling. drilling accident will help engineers more efficiently support the drilling
Anomalies may have both positive and negative influence on a system, process. Early detection of failures can significantly reduce the
depending on their interpretation and consequences. For example, a nonproductive time of the well associated with the elimination of acci­
significant increase in the number of visits to a website might be dents’ consequences and costs for additional materials and technical
considered as a positive anomaly, that results in website popularity resources. Most of the oil and gas companies also create knowledge base
growth. In the case of directional drilling, abnormal behavior rather systems, in which information about failures is collected and carefully
leads to failures (emergencies which make any further work impossible studied in order to use accumulated experience for further failures
or delay future activity), than to the improvement of the drilling process. detection by comparison current drilling conditions and previous cases.
Accidents have a significant impact on the further operation of wells Such an approach is called analogues search and was successfully used
and usually lead to an increase in construction time and the cost of work. for time-series forecast (Diomede et al., 2008; Moore and Little, 2014).

* Corresponding author.
E-mail address: Ekaterina.Gurina@skoltech.ru (E. Gurina).
1
Research concepts.
2
Implementation methods.
3
Data collection.
4
Data analysis and interpretation.
5
Drafting the manuscript.
6
Revising the manuscript.

https://doi.org/10.1016/j.petrol.2019.106519
Received 15 May 2019; Received in revised form 23 August 2019; Accepted 20 September 2019
Available online 23 September 2019
0920-4105/© 2019 Elsevier B.V. All rights reserved.

Please cite this article as: Ekaterina Gurina, Journal of Petroleum Science and Engineering, https://doi.org/10.1016/j.petrol.2019.106519
E. Gurina et al. Journal of Petroleum Science and Engineering xxx (xxxx) xxx

Thus, the presence of extra support during drilling operations as an approaches. Due to the high variability of general methods and a large
expert system, that includes accumulated accident detection experience, number of a review papers on them, we will not focus on description and
is an effective method for making the right real-time decisions. Such a will show only a few examples, which are relevant to the analogues
system will allow to avoid additional expenses during drilling opera­ search problem.
tions, and reduce the high workload level of the drilling engineers. In paper Patcha and Park (2007) authors describe the approach,
Therefore, the development of the methods, that can help to detect based on sliding window technique, in which some parts of time series
failures during the real-time drilling operations is essential for the oil with width w is converted into a single target value yi by some particular
and gas industry. classifier. By this principle, the sequences of signals were classified for
This paper is aimed at the analysis of the analogues search approach the whole time-series signal as an anomaly or non-anomaly target value.
for application to drilling accidents detection. In more details, the key The main advantage of this method is the possibility of applying
objectives of the article are the development of the model, that will be different existing classification methods. For anomaly detection in
able to distinguish similar and non-similar drilling situations, the anal­ drilling, such an approach allows us to convert the unsupervised
ysis of model’s applicability limits, and quality. approach into supervised one, but do not involve physics of the drilling,
The main contribution of this paper is an anomaly detection which is significant for drilling accidents detection problem.
approach for directional drilling operations, called the analogues search Nowadays, there are a lot of cases of neural networks (Hagan et al.,
model. It is designed for ranking the accidents from the knowledge base 1996) applications for anomaly detection (Ghosh et al., 2000; Cannady,
according to their relevance to the current situation in the drilling 1998). For example, authors in Yan and Yu (2015) used a neural
process, in order to find analogues and prevent anomalous behaviour. network to hierarchically learn features from the sensor measurements
The solution is based on the compassion of mud logging data with the of exhaust gas temperatures and used them as the input to a neural
classification model built on Gradient Boosting of decision trees. network classifier for performing combustor anomaly detection. As a
training set, the authors used 13791 samples before the accident. In our
1.1. State-of-the-art case, this approach may be inefficient due to the small size of the
training sample and inability automatically handle missing values,
Anomaly detection is an important issue that has been investigated in which usually occur in mud logging data.
various research areas: there are some examples of anomaly detection in In article Chandola et al. (2009) authors highlight such approaches
Information Technology systems (Chandola et al., 2009), medicine as a deviation of normal behavior and statistical methods. For example,
(Bettencourt et al., 2007) and industry (King et al., 2002). In oil and gas Hofmeyr et al. (1998) collected the stable database of activities not
industry anomaly detection is widely spread: in downstream it is used leading to intrusions and then used it to analyse the current behavior of
for controlling pumping and pressure in different systems, drilling pro­ the system by its comparison with database modes by different statistics.
cess (Nayeem et al., 2016), lithology classification (Klyuchnikov et al., Comparing this approach with the problem of drilling accidents detec­
2018; Romanenkova et al., 2019); in upstream, for example, engineers tion, it can be noticed that this approach is almost impossible to use,
usually use it for detection sensors faults in a refinery (Saybani et al., because, unlike the user system, each well and field is unique. Usually, a
2011) and pipelines (van der Meijde et al., 2009). similar slight deviation of normal drilling regime in one well can lead to
Solving the problem of unusual behavior detection in drilling by serious accidents on the other.
analogues search, it is necessary to consider not only previous studies on
time-series comparison and general algorithms of anomalies detection 1.1.3. Physics-based methods for drilling accident detection
but also methods and approaches for accidents detection during drilling, Physics-based methods for detection accidents are primarily based
since they often happen as a result of anomalies. on the monitoring and analysis of the key indicators of the drilling
system. For example, Vadetskii (1983) describes physical indicators and
1.1.1. Methods for time-series comparison their changes, leading to failures. One of the main indicators of fluid
Considering the problem of analogues search, it is necessary to shows while drilling are an increase in the volume of the drilling mud in
compare different time-series. Several authors (Kontaki et al., 2005; the receiving tanks, a reduction of standpipe pressure, an increase in the
Serra and Arcos, 2014; Bagnall and Lines, 2014) suggest to measure the effluent flow rate with a constant flow of pumps, an unexpected increase
similarity between two time-series by different metrics, for example, in the mechanical penetration rate (due to a decrease in the density of
general Euclidean distance, Fourier coefficients, the Time-wrapping the drilling mud, and, consequently, the pressure in the well). In case of
(TW) distance, and its modifications. wash-outs, the main evidence of the accident is an increase of a drill
After the introduction of any distance, the whole database of time- string weight, friction reduces, reduction versus the calculated volume
series can be split into several groups with different clustering tech­ of fluid full up when lifting the pipe string, movement of the drilling
niques, for example, K-means algorithm (Kanungo et al., 2002), mud along the ditch system with the circulation stopped.
mean-shift clustering (Cheng, 1995), agglomerative hierarchical clus­ One more example of a physical-based method for failure detection is
tering (Day and Edelsbrunner, 1984). Authors highlighted, that general vibration, namely modeling the movement of the drill string and its
Euclidean distance and Fourier coefficients showed themselves ineffi­ components, which is represented in paper Shor et al. (2014). Early
cient for time series with different length, while the cost for models of drill string dynamics have been developed primarily as an aid
Time-wrapping distance computation for m-dimensional time-series to drilling engineers and rig designers, to help them understand wells
might be significant. For our case, mud logging patterns for different behavior and provide recommendations for improving the drilling op­
accidents and different oilfields are too diverse to apply such metrics erations. Currently, models are being used and investigated based on
effectively. Thus, clustering of raw time-series seems incompetent for three parallel but different vibration modes, those help engineers detect
analogues search problem, which makes us move to supervised anomaly by high vibration values.
approach for similarity learning based on statistical features extracted Due to the inability to track all the indicators above, such physical-
from time-series. based methods are not suitable for solving our problem.
In addition to the methods shown above, there are a different
1.1.2. Methods for anomaly detection anomaly and failure patterns in mud logging plots. For example, a high
Most of the general methods for anomaly detection were described number of drags and slack off are used as signs of a possible pipe stuck.
previously, for example, in papers Patcha and Park (2007); Omar et al. Column drags usually occur while the column was lifting with an in­
(2013); Chandola et al. (2009). Authors distinguished several groups, crease a hook load over its weight of pipes; the slack off of the tool re­
based on statistical methods, machine learning, and unsupervised sults in a significant reduction in the load on the hook. One of the

2
E. Gurina et al. Journal of Petroleum Science and Engineering xxx (xxxx) xxx

evidence of columns stuck is also stopping of the column movement. In parts are similar or not.
the case of wash-outs, a decrease in pressure at a constant flow rate For the current approach, we decided to build a classification model
might be observed (Grace, 2017). The main failure pattern character­ based on Gradient Boosting of decision trees, because they are relatively
ising the mud loss is a decrease in the volume in the tanks. Breakdown of undemanding in terms of sample size and data quality, can work with
the tools is marked by a reduction in pressure at a constant flow rate missing data, and learn quickly with a large number of features, what
simultaneously with a sharp drop in weight. So, particular patterns for was shown in papers (Burnaev et al., 2015; Kozlovskaia and Zaytsev,
each type of accidents on mud logs might be used as the first signs by 2017).
which the model can determine the presence of failure. The general principle of analogues search model is shown in Fig. 1. In
order to take into account different patterns, for real-time signal and
2. Methodology lessons from the database values of mean, variance, slope angle, abso­
lute deviations, and relative coefficients of MWD time-series were
2.1. Data overview calculated with different window sizes and were used as input features for
Gradient Boosting classification model. To assign targets, we assumed
To solve the problem of failures detection by analogues search that pairs of intervals were similar if their accident types and drilling
approach, a database with different types of accidents and their mud log operations coincided. Henceforth we will refer to them as to ground
data was collected. truth.
Most of the failures happened in North and West Siberia oilfields and To test the analogues model, several experiments were conducted. In
were composed of accident lessons that contain the information about order to validate our model, the standard quality metrics for the binary
these events: the exact date-time or depth at which the failure occurred. classification problem using leave-one-out cross-validation control were
Such criterion was chosen in order to match the mud log data with the calculated. We also carried out a clustering analysis based on similarity
accident from the database and get a part of it that includes the failure. values from the model to validate the aggregated statistics approach and
Each lesson included in the database also contained information about evaluate the consistency of the similarity learning. The similarity dis­
its accident type (stucks, wash-outs, breaks of drill pipe, mud loss, shale tributions between MWD data with accidents and random MWD parts of
collars, gas, and water shows) and drilling operation at the moment of wells without abnormal behavior were analysed, in order to assess the
failure (tripping in, tripping out, drilling, cleaning, reaming). Such model ability to distinguish regular drilling regime and accidents. In
groups of accidents and drilling operations were chosen by the number addition, we provided a sensitivity analysis with respect to various kinds
of available cases and a possibility to be distinguished visually on mud of noise in MWD data.
logs.
In total, the database contains 94 lessons from 80 different wells and 3. Results and discussions
19 oilfields. The summary of the size of different considered groups of
accidents and related drilling operations is provided in Table 1. 3.1. Quality of the analogues search model
The considered measurements while drilling (MWD) data included
depth of the drill bit, torque on the rotor, weight on the hook, input For the analogues search model, the cross-validation was carried out
pressure, rotation speed, a volume of input flow, a depth of the bottom as follows:
hole, gas content, and weight on bit.
1. For each of k iterations of cross-validation, random indexes of acci­
dents from the database were generated for training and testing sets.
2.2. Design of the analogues search model
The set of wells for accidents were different for training and test part
of the split.
In section 1.1, we discussed existing approaches for time-series
2. The model was trained based on lessons, which indices were chosen
comparison, anomaly, and failure detection. It was concluded, that for
as training ones.
the problem of a drilling accident detection, it is necessary to use a su­
3. Similarity values among entries in the training and test set were
pervised machine learning approach. The algorithm should take into
calculated. The model finds the analogue and, consequently, detects
account the particular mud logs pattern for different accident groups
failure, if the similarity value is bigger than the selected threshold
and be able to work with a small training set and corrupted or missing
(s ¼ 0:7).
signal values.
4. The predicted values were compared with ground truth labels.
We decided to solve the analogues search problem based on two-
class classification of MWD pairs: for a specific well part, we need to
The results of cross-validation for analogues search model are in
understand whether something similar is present in the database by
Table 2. Using the current model, it is possible to identify almost all
comparing features from MWD data of this part with those of entries in
wells with abnormal drilling regime with low false alarm rate. So, it can
the database. Thus, there are two classes that determine whether two
be concluded that the model distinguishes different pairs quite well and
identifies most of the similar ones.
Table 1
In order to obtain the model quality, two common metrics for clas­
Breakdown of included accidents by type of accident and phase of drilling: in
sification problems were used: area under the receiver operating char­
some cells we have almost no example for training.
acteristic curve (ROC AUC) and area under the Precision-recall curve
Triping Tripping Drilling Cleaning Reaming Total (PR AUC), which are described in details in Appendix A. The receiver
in out
operating characteristic (ROC) curve is presented in Fig. 2. The area
Stuck 18 11 10 0 1 40 under ROC curve is 0.908, and significantly higher, than the area under
Wash-outs 1 1 10 1 0 13
the random guess classifier ROC curve 0.5. Since it is an unbalanced
Breaks of 1 2 4 6 0 13
drilling classification problem, a more suitable measure of model quality will be
Mud loss 2 2 6 0 1 11 a Precision-Recall curve, which is shown in Fig. 2. The area under the
Shale 0 0 9 0 0 9 Precision-Recall curve is 0.6086, which also indicates adequate model
collars quality.
Fluid 0 3 5 0 0 8
shows

Total 22 19 44 7 2 94

3
E. Gurina et al. Journal of Petroleum Science and Engineering xxx (xxxx) xxx

Fig. 1. General scheme of analogues search model. Using 2 h parts of MWD signals, different aggregated statistics were calculated. These features are inputs for
gradient boosting classifier, that provides similarity scores for a pair of input signals.

(F P ) alarms was selected. After that, based on the true accident time
Table 2
for each well, the true and false model’s alarms rate were calculated as
Confusion matrix for threshold s ¼ 0:7.
follows. We assumed, that accident was correctly detected, and for this
Predicted ¼ 1 Predicted ¼ 0 accident T P ¼ 1, if the similarity value was more than the chosen
True ¼ 1 5792 294 threshold, the model alarm was in the 4-h interval before and 2 h after
True ¼ 0 223 345 the true accident (T P interval), and the most common accident type
for the top-5 analogues matched with true one.
In case of the false alarm, it was supposed that F P ¼ 1 for this
3.2. Hold-out validation and threshold selection by analysis of confusion
interval if the model alarm was out of T P interval and there were no
matrix
other alarms during the last hour. So if two or more alarms happened
within 1 h, it was counted as one false alarm. Here we also assumed, that
In this section, we used the analogues search model differently: it
predicted accident type was the most common one within top-5 ana­
was applied to hold-out wells in order to understand how it works “in the
logues types; otherwise, it is supposed that F P ¼ 1. Obtained results
wild.” The analogues model was run on MWD signals from 30 hold-out
for the threshold 0.7 are presented in Appendix C.
cases, which included both normal and anomaly drilling modes.
To select the threshold, the total number of T P and F P for
Next, the threshold to balance the number of correct (T P ) and false

Fig. 2. Quality metrics for analogues search model. ROC AUC is 0.908, thus the model is significantly better than a random guess with ROC AUC 0.5. The area under
PR curve is 0.6086, which is significantly better than the area under curve for a random guess approach 0.1.

4
E. Gurina et al. Journal of Petroleum Science and Engineering xxx (xxxx) xxx

different threshold values was counted (Fig. 3). For the threshold value to new cases of accidents. This is a more realistic estimate of the
0.7, the total number of model false alarms is less than 16 alarms per quality of the similarity evaluations.
well, while the number of correct alarms is still high.
Let us consider one example of analogues search model results for a The results of the conducted test are shown in Fig. 4. Usage of
hold-out well. In this case, the model ran on a well that contained a aggregated statistics with Gradient Boosting model gives us a better
wash-out drilling accident. The model found an analogue with the same cluster distribution than approaches based on an unsupervised com­
type of operation (drilling) as in the hold-out MWD measurements. It parison of MWD data. Results, obtained from cross-validation, shows us
can be seen based on the general similarity of trends in such parameters clearly selected clusters corresponding to different types of accidents
as hook position, depth of drill bit, and bottom hole depth. In cases, and drilling operations. For some types of accident, the training set is
when similarity values exceeded the selected threshold, the model quite complete, that can be seen by the trees above and to the left of the
assumed, that current 2 h in the past are similar to the analogue mea­ plot, and has enough cases (clusters number 1,3,4,5). For others (clus­
surements. For both cases, we observe a decrease in pressure at a con­ ters number 2,6–9), there is a greater distance for objects within the
stant flow rate, which indicates the wash-out of the drill pipe. A careful cluster. In our opinion, the reason for this might be the lack of examples
examination of this case proves that the model correctly detected a of accidents in these groups. Consequently, for the correct determination
wash-out accident and found an analogue. Similarity values and MWD of such groups of failures, the inclusion of a larger amount of data is
signals for the “current” measurements and the analogue are presented required.
in Appendix B.

3.4. Robustness of the analogues search model


3.3. Clustering analysis
The analogues search model should meet the following two re­
The dendrograms clustering analysis (Maimon and Rokach, 2005) quirements. If an example from the training sample was submitted, the
was also used to assess the consistency of the similarity learning. First of model should recognise it and provide it as the analogue with high
all, we represented it via adjacency matrix clusters based on the ground similarity. Moreover, after reasonable distortion of such an example, the
truth distribution of similarity. As mentioned earlier, two lessons are model should still recognise it.
similar if their accident types and drilling operations are equal. Next, to While testing the first property is straightforward, to test the second
compare initial distribution, similarity values that were used as an input one-two types of transformations were applied to the original time se­
parameter for constructing dendrograms were calculated in different ries: slight smoothing, distortion, and shift of data on given number of
ways: time ticks (1 tick ¼ 10 s). An example of the original and distorted time
series for different values of the standard deviation is given in Fig. 5.
� Unsupervised comparison: similarity values for lessons from the To understand how well the model distinguishes MWD parts of wells
database were calculated only by the weighed l1 norm among all with normal behavior and ones with accidents, the model was trained on
MWD parameters, excluding the depth of the bottom hole and drill MWD parts, corresponding to the lessons from the current database and
bit. tested for normal and distorted parts.
� Using Gradient boosting technique: dendrograms used similarities, that The distribution of obtained similarity values was presented as box-
were calculated for lessons from the training set, and resulted from plots for different testing sets: random parts without accidents, intervals
the Gradient boosting model with aggregated statistics. This is an with accidents, time-shifted duplicates of the intervals with accidents
optimistic estimate of the quality of the similarity evaluations. and copies of the intervals with accidents with varying levels of shift and
� Cross-validation: calculations were made with the model described in noise. The distortion of original time-series was done by the multipli­
the previous step (using Gradient boosting technique) and cross- cation of a smooth curve with average mean 1 and a given standard
validation, which allows us to see how well the model generalise deviation.

Fig. 3. Total number of model correct (True Positive, TP) and false (False Positive, FP) alarms for different thresholds. Numbers at the curve are thresholds. The
threshold 0.7 was used on final model.

5
E. Gurina et al. Journal of Petroleum Science and Engineering xxx (xxxx) xxx

Fig. 4. Clustering analysis: a) Initial clusters distribution, b) Dendrogram, based on simple comparison of MWD data, c) clusters, obtained from aggregated statistics
and gradient boosting technique, d) dendrogram, obtained from cross-validation. Clustering analysis represented by dendrograms, which illustrates how each cluster
is composed by drawing a link between clusters: the top of the link indicates a cluster merge, while the two legs indicate which clusters were merged. In our case,
each true group of accidents correspond to one colour, and is formed by the same type of drilling accidents, which have the same operation type. The presence of
colour at the intersection of row i and column j means that two cases,i and j respectively, of drilling accidents from the database belong to the same true accident
group. Since the main aim of this experiment is to see if similar anomalies can be grouped into clusters using different approaches, instead of the global order of
clusters it is important to observe local proximity of elements. Using aggregated statistics as an input for Gradient boosting classifier, the clusters distribution is more
similar to the initial one, and it is possible to obtain more separated clusters, than by using only raw signals.

The numerical characteristic R was also calculated: the difference separate random MWD parts from the data, corresponding to the lessons
between the 90% quantile of random parts set and the 10% quantile of from the database, for shifting up to 400 s and for noise with a standard
data that we would like to highlight. Valid values are bigger than 0; good deviation of up to 0.03.
ones are more than 0.2. Standard deviations for R were calculated using
the bootstrap technique (Efron and Tibshirani, 1986), the calculation
3.5. Discussion
used 100 samples.
The box-plots for cases, mentioned above, and values of R coefficient,
When a drilling engineer encounters an accident, he or she can
which characterises the difference in the similarity values for two
identify the type of the accident and rely on actions taken during similar
different sets of intervals are in Fig. 6.
cases in the past. Moreover, from now, it is rather evident, that it is
The analogues search model shows high similarity values for noised
possible to correlate the real-time state of the drilling process with the
lessons with standard deviations as high as 0.01 and time-shifted lessons
past events from the historical database with machine learning (see
as high as 20 ticks. So, in these cases, the model finds similar sections
sections 3.1, 3.3 and 3.4).
from the training set.
The quality of the machine learning model is acceptable for use
At the same time, the similarity values for normal parts are low,
during drilling as even a single successful application of the developed
which shows the model ability to distinguish normal drilling mode from
model can save time and money. However, there is still room for
the accidents-related drilling mode. It also can be seen that model can
improvement. In particular, the model quality for identification of types

6
E. Gurina et al. Journal of Petroleum Science and Engineering xxx (xxxx) xxx

Fig. 5. An example of original and distorted time series values.

Fig. 6. Box-plots for different intervals. Such figure gives us an idea of how much MWD data can be distorted, so that the model can still recognise them.

of accidents underrepresented in the database is sometimes low. Thus, to by the ranking of the lessons from the database by their similarity to the
maximize quality, a larger database is required. real-time state. The comparison and the ranking utilize Gradient
In the separate section, we address the issue of model reliability and boosting classification model.
generalization ability. Conducted tests suggest a limit of applicability of Conducted analysis of analogues search model showed that obtained
the model, as after significant distortion of the initial signal the model no quality metrics, such as ROC AUC (0.908) and PR AUC (0.6086), are
longer works correctly. However, the obtained results correspond to the significantly higher than the same metrics for the random guess classi­
general machine learning theory of extrapolation and generalization fier (ROC AUC: 0.5, PR AUC: 0.1). Obtained metrics suggest that the
properties of the data-driven models. model is of reasonable quality and can distinguish pairs of similar and
non-similar cases well.
4. Conclusions Clustering analysis showed that the use of basic MWD signals is not
sufficient for the selection of analogues, and in general for the analogues
We developed a real-time analogues search model that detects search model. We have discovered that the introduction of aggregated
anomalies and finds analogues in a database of historical data. statistics as input for Gradient boosting classifier allows finding a suf­
The anomaly detection is based on the smart comparison of the real- ficiently larger number of analogues of real-time signals.
time MWD data and the MWD data from the historical database followed According to the robustness analysis, the model identifies lessons

7
E. Gurina et al. Journal of Petroleum Science and Engineering xxx (xxxx) xxx

from the training sample, if such lessons are also in a testing sample. The MWD signal distortion is still acceptable for an accurate analogues
analogue search quality remains high even after reasonable distortion of identification.
examples from the training sample by adding noise and shifts to the We plan to expand the functionality of the model and conduct
initial signal. These experiments helped to identify the limits of appli­ research on whether it is possible to predict the failures beforehand.
cability of the model, ensuring a good understanding of what level of

Appendix A

To define area under the ROC curve (ROC AUC) and area under the Precision-recall curve (PR AUC) metrics it is necessary to introduce additional
n
notations. Suppose there are the true labels of the classes fyi gni¼1 and the predicted labels of the classes fb y i gi¼1 for a test sample. Then the following 4
indicators sufficiently reflect the quality of classification: number of true classified objects for the first class (True Positive), the first class objects, that
were classified as objects from the second class (False Negative), the second class objects, that were classified as objects from the first class (False
Positive), true classified objects for the second class (True Negative).
X
n
True PositiveðTPÞ ¼ ½yi ¼ 1�½by i ¼ 1�; (1)
i¼1

X
n
False PositiveðFPÞ ¼ ½yi ¼ 0�½b
y i ¼ 1� (2)
i¼1

X
n
False NegativeðFNÞ ¼ ½yi ¼ 1�½b
y i ¼ 0�; (3)
i¼1

X
n
True NegativeðTNÞ ¼ ½yi ¼ 0�½by i ¼ 0� (4)
i¼1

Based on such indicators, it is possible to introduce derived metrics: True Positive Rate (TPR) and False Positive Rate (FPR).
TP FP TP
TPR ¼ ; FPR ¼ ; Precision ¼ ; Recall ¼ TPR (5)
TP þ FN FP þ TN TP þ FP
By setting the threshold, fixed TPR and FPR for the test sample were obtained. Varying the threshold, we get a ROC curve that starts at ð0; 0Þ and
ends at ð1; 1Þ. Similarly, the PR curve defined by the (Precision, Recall) values for a set of thresholds. ROC AUC, PR AUC are the areas under the curves,
respectively, ROC and PR. The higher the values of these metrics, the better the quality of the classifier (Artemov and Burnaev, 2015).

Appendix B

Fig. 7 represented analogues search model results for one hold-out well, containing wash-out drilling accident.

Fig. 7. Analogues search model results in acion for hold-out well. Two plots on the right are MWD signals for a hold-out well, two plots on the left are the MWD for
the analogue accident identified by the model. In the center there are similarity scores provided by the model: when similarity value exceeds the selected threshold
the model alerts that the past 2 h are similar to analogue measurements. For example, in the figure one of the similar areas for the hold-out case and analogue are
highlighted in yellow colour. Both areas have similar signal trends, indicating a wash-out accident, which gives us an idea that the model correctly detected an
accident and found a past analogue for it.

8
E. Gurina et al. Journal of Petroleum Science and Engineering xxx (xxxx) xxx

Appendix C

Table 3 provides more detailed results of the analogues search model testing.
Table 3
Total number of correct and false alarms for each testing well and accident type for threshold 0.7.

Well True accident type Total signal duration (days) Stuck Wash-outs Shale collars Mud loss Breaks Fluid shows

T P F P T P F P T P F P T P F P T P F P T P F P

1 Normal mode 22 0 9 0 1 0 0 0 5 0 0 0 0
2 Fluid show 46 0 16 0 0 0 0 0 1 0 0 1 0
3 Normal mode 17 0 6 0 0 0 0 0 3 0 0 0 0
4 Fluid show 105 0 22 0 0 0 0 0 30 0 1 1 0
5 Normal mode 18 0 0 0 0 0 0 0 0 0 0 0 0
6 Normal mode 9 0 6 0 0 0 0 0 2 0 0 0 0
7 Normal mode 10 0 7 0 1 0 0 0 1 0 0 0 0
8 Fluid show 33 0 18 0 0 0 0 0 0 0 1 0 4
9 Normal mode 19 0 8 0 0 0 0 0 0 0 0 0 0
10 Normal mode 13 0 4 0 0 0 0 0 2 0 0 0 0
11 Normal mode 16 0 6 0 0 0 0 0 1 0 0 0 0
12 Normal mode 11 0 3 0 0 0 0 0 3 0 1 0 0
13 Mud loss, 31 0 17 0 0 0 0 1 3 0 0 0 0
2 cases
14 Wash-outs, 21 0 10 0 0 0 0 0 4 0 0 0 0
2 cases
15 Stuck 35 1 28 0 0 0 0 0 2 0 0 0 0
16 Stuck 34 1 12 0 0 0 0 0 0 0 0 0 0
17 Stuck 27 1 13 0 0 0 0 0 1 0 0 0 0
18 Stuck 28 1 13 0 2 0 0 0 5 0 0 0 0
19 Mud loss 23 0 13 0 1 0 0 0 0 0 0 0 0
20 Stuck 34 1 12 0 2 0 0 0 3 0 0 0 0
21 Wash-out, 31 1 7 0 0 0 0 0 0 0 0 0 0
Stuck 2 cases,
Mud loss 2 cases
22 Wash-outs, 39 0 10 1 0 0 0 0 1 0 0 0 0
2 cases
23 Stuck 31 0 11 0 0 0 0 0 0 0 0 0 0
24 Normal mode 30 0 13 0 0 0 0 0 0 0 0 0 0
25 Shale collar 18 0 8 0 0 0 0 0 6 0 0 0 0
26 Shale collars, 15 0 3 0 0 0 0 0 0 0 0 0 0
2 cases
27 Wash-out, 27 0 20 0 0 0 0 0 1 0 0 0 0
Fluid show
28 Shale collar 41 0 15 0 0 0 0 0 3 0 0 0 0
29 Fluid show 57 0 16 0 1 0 0 0 8 0 0 1 0
30 Fluid show 101 0 43 0 0 0 1 0 1 0 0 1 0

Appendix D. Supplementary data

Supplementary data to this article can be found online at https://doi.org/10.1016/j.petrol.2019.106519.

References Ghosh, A.K., Michael, C., Schatz, M., 2000. A real-time intrusion detection system based
on learning program behavior. In: International Workshop on Recent Advances in
Intrusion Detection. Springer, pp. 93–109.
Artemov, A., Burnaev, E., 2015. Ensembles of detectors for online detection of transient
Grace, R.D., 2017. Blowout and Well Control Handbook. Gulf Professional Publishing.
changes. In: Eighth International Conference on Machine Vision (ICMV 2015), vol.
Hagan, M.T., Demuth, H.B., Beale, M.H., De Jesús, O., 1996. Neural Network Design, vol.
9875. International Society for Optics and Photonics, p. 98751Z.
20. Pws Pub, Boston.
Bagnall, A., Lines, J., 2014. An Experimental Evaluation of Nearest Neighbour Time
Hofmeyr, S.A., Forrest, S., Somayaji, A., 1998. Intrusion detection using sequences of
Series Classification arXiv preprint arXiv:1406.4757.
system calls. J. Comput. Secur. 6 (3), 151–180.
Bettencourt, L.M., Ribeiro, R.M., Chowell, G., Lant, T., Castillo-Chavez, C., 2007.
Kanungo, T., Mount, D.M., Netanyahu, N.S., Piatko, C.D., Silverman, R., Wu, A.Y., 2002.
Towards real time epidemiology: data assimilation, modeling and anomaly detection
An efficient k-means clustering algorithm: analysis and implementation. IEEE Trans.
of health surveillance data streams. In: NSF Workshop on Intelligence and Security
Pattern Anal. Mach. Intell. 1 (7), 881–892.
Informatics. Springer, pp. 79–90.
King, S., King, D., Astley, K., Tarassenko, L., Hayton, P., Utete, S., 2002. The use of
Burnaev, E., Erofeev, P., Papanov, A., 2015. Influence of resampling on accuracy of
novelty detection techniques for monitoring high-integrity plant. In: Proceedings of
imbalanced classification. In: Eighth International Conference on Machine Vision
the International Conference on Control Applications, vol. 1. IEEE, pp. 221–226.
(ICMV 2015), vol. 9875. International Society for Optics and Photonics, p. 987521.
Klyuchnikov, N., Zaytsev, A., Gruzdev, A., Ovchinnikov, G., Antipova, K., Ismailova, L.,
Cannady, J., 1998. Artificial neural networks for misuse detection. In: National
Muravleva, E., Burnaev, E., Semenikhin, A., Cherepanov, A., et al., 2018. Data-
Information Systems Security Conference, vol. 26, pp. 443–456. Baltimore.
driven Model for the Identification of the Rock Type at a Drilling Bit arXiv preprint
Chandola, V., Banerjee, A., Kumar, V., 2009. Anomaly detection: a survey. ACM Comput.
arXiv:1806.03218.
Surv. 41 (3), 15.
Kontaki, M., Papadopoulos, A.N., Manolopoulos, Y., 2005. Similarity search in time
Cheng, Y., 1995. Mean shift, mode seeking, and clustering. IEEE Trans. Pattern Anal.
series databases. In: Encyclopedia of Database Technologies and Applications. IGI
Mach. Intell. 17 (8), 790–799.
Global, pp. 646–651.
Day, W.H., Edelsbrunner, H., 1984. Efficient algorithms for agglomerative hierarchical
Kozlovskaia, N., Zaytsev, A., 2017. Deep ensembles for imbalanced classification. In:
clustering methods. J. Classif. 1 (1), 7–24.
2017 16th IEEE International Conference on Machine Learning and Applications
Diomede, T., Nerozzi, F., Paccagnella, T., Todini, E., 2008. The use of meteorological
(ICMLA). IEEE, pp. 908–913.
analogues to account for lam qpf uncertainty. Hydrol. Earth Syst. Sci. 12 (1),
Maimon, O., Rokach, L., 2005. Data Mining and Knowledge Discovery Handbook.
141–157.
Springer.
Efron, B., Tibshirani, R., 1986. Bootstrap methods for standard errors, confidence
intervals, and other measures of statistical accuracy. Stat. Sci. 54–75.

9
E. Gurina et al. Journal of Petroleum Science and Engineering xxx (xxxx) xxx

Moore, P., Little, M., 2014. Enhancements to a method of analogues forecasting Serra, J., Arcos, J.L., 2014. An empirical evaluation of similarity measures for time series
algorithm. NOLTA2014 317–320. classification. Knowl. Based Syst. 67, 305–314.
Nayeem, A.A., Venkatesan, R., Khan, F., 2016. Monitoring of down-hole parameters for Shor, R.J., Pryor, M., Van Oort, E., 2014. Drillstring vibration observation, modeling and
early kick detection. J. Loss Prev. Process. Ind. 40, 43–54. prevention in the oil and gas industry. In: ASME 2014 Dynamic Systems and Control
Omar, S., Ngadi, A., Jebur, H.H., 2013. Machine learning techniques for anomaly Conference. American Society of Mechanical Engineers.
detection: an overview. Int. J. Comput. Appl. 79 (2). V003T37A004–V003T37A004.
Patcha, A., Park, J.-M., 2007. An overview of anomaly detection techniques: existing Vadetskii, Y.V., 1983. Drilling Oil and Gas Wells. Nedra, Moscow.
solutions and latest technological trends. Comput. Network. 51 (12), 3448–3470. van der Meijde, M., Van Der Werff, H., Jansma, P., van der Meer, F.D., Groothuis, G.,
Romanenkova, E., Zaytsev, A., Klyuchnikov, N., Gruzdev, A., Antipova, K., Ismailova, L., 2009. A spectral-geophysical approach for detecting pipeline leakage. Int. J. Appl.
Burnaev, E., Semenikhin, A., Koryabkin, V., Simon, I., et al., 2019. Real-time Data- Earth Obs. Geoinf. 11 (1), 77–82.
Driven Detection of the Rock Type Alteration during a Directional Drilling arXiv Yan, W., Yu, L., 2015. On accurate and reliable anomaly detection for gas turbine
preprint arXiv:1903.11436. combustors: a deep learning approach. In: Proceedings of the Annual Conference of
Saybani, M.R., Wah, T.Y., Amini, A., Yazdi, S.R.A.S., 2011. Anomaly detection and the Prognostics and Health Management Society, pp. 1–8.
prediction of sensors faults in a refinery using data mining techniques and fuzzy Zimek, A., Schubert, E., 2017. Outlier detection. Encycl. Database Syst. 1–5.
logic. Sci. Res. Essays 6 (27), 5685–5695.

10

You might also like