  We present a data-driven algorithm and mathematical model for anomaly
alarming at directional drilling. The algorithm is based on machine learning.
It compares the real-time drilling telemetry with one corresponding to past
accidents and analyses the level of similarity. The model performs a
time-series comparison using aggregated statistics and Gradient Boosting
classification. It is trained on historical data containing the 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. Validation 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.
