Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Full text
Introduction Case study Literature review Methodology Results Conclusion References References Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells PhD student Rodrigo Marcel Araujo Oliveira Prof. PhD Ângelo Márcio Oliveira Sant’Anna Prof. PhD Paulo Henrique Ferreira da Silva Federal University of Bahia (UFBA) March 27, 2025 O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References 1Introduction 2Case study 3Literature review 4Methodology 5Results 6Conclusion 7References O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Oil and Gas Industry Oil and gas extraction involves complex structures. A set of sensors, electrical, mechanical, and hydraulic systems make up an oil well. Driven by economic, environmental, and regulatory factors, monitoring processes to ensure operational safety is essential. Failures in oil production wells can lead to financial losses and catastrophic environmental damage. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Failures in oil wells Offshore platform Figure 1: Accident on Petrobras’s P-36 offshore platform in 2001 (Figueiredo et al., 2018). O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Machine Learning (ML) Supervised Learning: Models learn from labeled data, making predictions based on past observations. Unsupervised Learning - Clustering: Identifies hidden structures in data without labels, grouping similar instances. Unsupervised Learning - Anomaly Detection: Detects rare or unusual patterns in data, often using techniques like Isolation Forest or Graph Neural Networks. Deep Learning: Leverages neural networks to learn complex patterns from large datasets. Effective in image recognition, natural language processing, and generative models. Reinforcement Learning: Agents learn by interacting with an environment to maximize long-term rewards. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Machine Learning for Anomaly Detection Real-Time Anomaly Detection: Machine learning models analyze data streams to identify unusual patterns, enabling early detection of anomalies before they escalate into critical issues. Adaptive and Scalable Solutions: Unlike static threshold-based methods, ML-based anomaly detection adapts to evolving data distributions and scales to large datasets. Interpretable Insights for Decision-Making: Techniques such as SHapley Additive exPlanations (SHAP) values and attention mechanisms help explain model decisions, providing actionable insights for root cause analysis. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Explainable Artificial Intelligence (XAI) Model Transparency: Ensures that machine learning models, especially complex ones like deep neural networks, can be interpreted by humans, improving trust and accountability. Feature Attribution: Methods like SHAP and Local Interpretable Model-Agnostic Explanations (LIME) quantify the impact of each feature on the model’s predictions, helping to understand decision-making processes. Rule-Based Explanations: Techniques such as decision trees and symbolic AI provide interpretable decision rules, making models easier to validate and audit. Counterfactual Explanations: Highlights minimal changes needed to alter a model’s decision, offering actionable insights for users and policymakers. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Statistical Process Control (SPC) SPC is a powerful tool for detecting anomalies in industrial processes. Here are some highlights: Real-Time Process Monitoring: SPC utilizes control charts (such as Shewhart Control Charts) to track process variation over time, enabling the identification of trends, deviations, or special causes of variation before they lead to defects. Variability Reduction and Quality Improvement: SPC helps minimize inconsistencies, enhancing process stability and capability. Defect Prevention and Cost Reduction: By detecting issues early, SPC reduces rework, waste, and nonconformance-related costs. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Statistical Process Control (SPC) Control chart Figure 2: Example of a control chart. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Oil and gas wells Figure 5: Oil and gas extraction scheme in offshore wells (Vargas et al., 2019). O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Objectives Evaluate different statistical machine learning algorithms for anomaly detection. Propose approaches to the explainability of models that serve as a prognosis for detecting anomalies and not just as a diagnosis. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References 1Introduction 2Case study 3Literature review Statistical machine learning for anomaly detection 4Methodology 5Results 6Conclusion 7References O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Statistical machine learning for anomaly detection 1Introduction 2Case study 3Literature review Statistical machine learning for anomaly detection 4Methodology 5Results 6Conclusion 7References O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Statistical machine learning for anomaly detection Vargas et al. (2017) proposed utilizing techniques such as K-Nearest Neighbors (K-NN), t-distributed Stochastic Neighbor Embedding (t-SNE). The approach using the unsupervised Local Outlier Factor (LOF) model for anomaly detection in oil wells was proposed by Aranha et al. (2023). Marins et al. (2021) investigated Bayesian models and Random Forest for condition-based monitoring construction. Short-Term Memory (LSTM) and Support Vector Machine (SVM) models proposed by Machado et al. (2022). O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References 1Introduction 2Case study 3Literature review 4Methodology Project flowchart Unsupervised statistical learning Explainable Artificial Intelligence (XAI) Control Charts Proposed framework 5Results 6Conclusion 7References O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Project flowchart 1Introduction 2Case study 3Literature review 4Methodology Project flowchart Unsupervised statistical learning Explainable Artificial Intelligence (XAI) Control Charts Proposed framework 5Results 6Conclusion 7References O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Project flowchart Framework for the proposed anomaly detection approaches Flowchart Figure 6: Project development stages. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Unsupervised statistical learning 1Introduction 2Case study 3Literature review 4Methodology Project flowchart Unsupervised statistical learning Explainable Artificial Intelligence (XAI) Control Charts Proposed framework 5Results 6Conclusion 7References O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Unsupervised statistical learning Unsupervised statistical learning Models for anomaly detection Isolation Forest (Liu et al., 2008) Lightweight On-line Detector of Anomalies (Pevný, 2016) Principal Component Analysis (Shyu et al., 2003) One-Class SVM using Stochastic Gradient Descent (Sopyła and Drozda, 2015) Visualization methods t-distributed Stochastic Neighbor Embedding (Zhou et al., 2018) O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Explainable Artificial Intelligence (XAI) 1Introduction 2Case study 3Literature review 4Methodology Project flowchart Unsupervised statistical learning Explainable Artificial Intelligence (XAI) Control Charts Proposed framework 5Results 6Conclusion 7References O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Explainable Artificial Intelligence (XAI) SHapley Additive exPlanations (SHAP) The SHAP method, based on cooperative game theory (Lundberg et al., 2017), emerged to explain the results of ML algorithms. It computes the contributions of features to individual predictions of complex models. The Shapley value distributes total gains among players; in other words, a feature’s value is determined by its contribution to the payout, as shown in Equation (7). ˆ ϕi=∑ S⊆{1,...,N}\{i} |S|!(M− |S| − 1)! M ·|gx(S∪ {i})−gx(S)|,(7) where Sis a subset of features used in the model, xis the vector of feature values to be explained, Mis its cardinality, and gxcorresponds to the predicted feature values in subset S. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Explainable Artificial Intelligence (XAI) SHapley Additive exPlanations (SHAP) The SHAP approach allows interpreting ML model predictions by calculating the impact of each feature on the prediction for a specific input. SHAP represents the Shapley value as an additive feature attribution method, modeling linearly binary variables, as shown in Equation (8). ψ(z) = ϕ0+ N ∑ j=1 ϕjzj,(8) where ψis the explanation model, z∈ {0,1}Nis the coalition vector, Nis the maximum coalition size, and ϕjis the Shapley value assignment for feature j. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Control Charts 1Introduction 2Case study 3Literature review 4Methodology Project flowchart Unsupervised statistical learning Explainable Artificial Intelligence (XAI) Control Charts Proposed framework 5Results 6Conclusion 7References O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Control Charts Exponentially Weighted Moving Average (EWMA) The EWMA statistic is calculated according to Equation (9): Zt=λXt+ (1−λ)Zt−1,t=1,2, . . . , (9) where Ztis the EWMA value at time t,Xtis the observed value at time t,λis the weighting factor with 0 < λ ≤1, and Zt−1is the EWMA value at the previous time (Wang and Liu, 2024). The upper (UCL) and lower (LCL) control limits for the EWMA chart are calculated using Equations (10) and (11). UCL =µ0+L·σ·√λ 2−λ·[1−(1−λ)2t],(10) LCL =µ0−L·σ·√λ 2−λ·[1−(1−λ)2t].(11) O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Proposed framework 1Introduction 2Case study 3Literature review 4Methodology Project flowchart Unsupervised statistical learning Explainable Artificial Intelligence (XAI) Control Charts Proposed framework 5Results 6Conclusion 7References O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Proposed framework Data preprocessing This work is limited to real data only. The historical data consists of three types of periods: normal, transient, and anomaly. For model development, the transient data was considered as anomalous. The data was divided into two sets of samples, taking into account the temporal order of the data for each oil well, with 80% for training and 20% for testing, representing, respectively, 8,887,177 and 2,221,800 samples, null values were discarded. Data standardization using the Gaussian distribution N(0,1)was adopted due to the differences in the magnitudes of the predictor variables. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Proposed framework Assessment methodologies Metrics based on the confusion matrix Number of true positives (TP); false positives (FP); false negatives (FN); true negatives (TN). Receiver operating characteristic (ROC) curve Precision-recall (AP) curve Accuracy Specificity Precision Recall F1score O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Proposed framework Experimental procedures Figure 8: Cross-validation. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Proposed framework Performance comparison McNemar’s Statistical Test H0: Similarity in the error proportions of the models. H1: The models’ performances are different. Test Statistic a aUnder the null hypothesis, considering that nji indicates the number of events incorrectly classified by method jbut correctly classified by method i, and nij indicates the number of events incorrectly classified by method ibut not by method j, the result follows a X2distribution with 1 degree of freedom (Oliveira et al., 2024). T=(|nji −nij| − 1)2 nji +nij ∼χ2(1) O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Visualization scheme Figure 10: t-SNE components based on machnine learning output. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Visualization scheme Figure 11: t-SNE components based on iForest output. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References iForest global interpretation with SHAP Figure 12: Global importance of variables in the model result. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Control charts with EWMA (Oil Well 2) Figure 13: Control charts with EWMA for the iForest model score of well number 2. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References iForest local interpretation with SHAP (Oil Well 2) Figure 14: Bar plot using the iForest model for anomaly (a) and normal (b) point. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Control charts with EWMA (Oil Well 6) Figure 15: Control charts with EWMA for the iForest model score of well number 6. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References iForest local interpretation with SHAP (Oil Well 6) Figure 16: Force plot using the iForest model for anomaly (a) and normal (b) point. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References 1Introduction 2Case study 3Literature review 4Methodology 5Results 6Conclusion 7References O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Conclusions This work proposed unsupervised machine learning models, XAI, and SPC techniques as diagnostic and prognostic approaches for anomaly detection in multivariate time series data from oil and gas wells. The EWMA technique enabled process monitoring to assess potential risks of undesirable events in oil and gas extraction using the iForest model. This allows for real-time prediction in oil and gas wells, essential for mitigating risks and anticipating potential production failures that could be financially, environmentally, and humanly catastrophic. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Acknowledgments This study was financed in part by the Higher Education Improvement Coordination (CAPES) - Brazil - Finance Code 001. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Wang, J., Liu, L., 2024. A new multivariate control chart based on the isolation forest algorithm. Quality Engineering 36, 390–406. URL: https://www.tandfonline.com/doi/abs/10.1080/08982112.2023.2220773, doi:10.1080/08982112.2023.2220773. Zhou, H., Wang, F., Tao, P., 2018. t-Distributed Stochastic Neighbor Embedding Method with the Least Information Loss for Macromolecular Simulations URL: https://pubs.acs.org/sharingguidelines, doi:10.1021/acs.jctc.8b00652. O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells
Introduction Case study Literature review Methodology Results Conclusion References References Thanks PhD student: Rodrigo Marcel Araujo Oliveira - rodrigoma[email protected]r Advisor: Prof. Dr. Ângelo Márcio Oliveira Sant’Anna - [email protected]r Co-advisor: Prof. Dr. Paulo Henrique Ferreira da Silva - [email protected]r O, R.M.A. & S, A.M.O. & S, P.H.F. Federal University of Bahia (UFBA) Explainable unsupervised machine learning and control charts for multivariate time series anomaly detection in oil wells