Comparative Study of KNN and Isolation Forest for Anomaly Detection in Oil and Gas Sensor Data using Moving Average Labeling
Anomaly detection in sensor data is essential for ensuring operational reliability in the oil and gas industry. This study presents a comparative analysis between supervised and unsupervised approaches to anomaly detection using K-Nearest Neighbors (KNN) and Isolation Forest (IF), respectively. A moving average-based statistical method is employed to generate ground truth labels with an anomaly ratio target of 5%, serving as the foundation for the supervised model. The dataset consists of four key sensor features PRESSURE, TEMPERATURE, N2, and NC5 aggregated daily and normalized for modeling. KNN is configured with distance-weighted neighbors, while IF uses a contamination-adjusted ensemble structure. Both models are evaluated using ROC- AUC and F1-score metrics. Visual analysis on daily detection patterns reveals distinct behavioral differences between the models: KNN tends to follow conservative patterns shaped by the labeling method, whereas IF captures more outliers based on internal data structure. The results demonstrate the complementary strengths of both approaches in identifying anomalies in multivariate time-series sensor data.
Authors
- Aditya Firman Ihsan (ORCID: https://orcid.org/0000-0002-1201-7198)
- Amalia Nur Alifah (ORCID: https://orcid.org/0009-0007-4356-7532)
- Halim Arif Cahyono
Institutions
- University of Surabaya (ID)
- Universitas Negeri Surabaya (ID)
- Telkom University (ID)
Publication Details
- Journal
- Procedia Computer Science
- Published
- 2025-01-01
- DOI
- https://doi.org/10.1016/j.procs.2025.08.275
- Primary Topic
- Anomaly Detection Techniques and Applications
- Type
- article
- Field-Weighted Citation Impact
- 0.00