Directional oil well drilling requires high precision of the wellbore\npositioning inside the productive area. However, due to specifics of\nengineering design, sensors that explicitly determine the type of the drilled\nrock are located farther than 15m from the drilling bit. As a result, the\ntarget area runaways can be detected only after this distance, which in turn,\nleads to a loss in well productivity and the risk of the need for an expensive\nre-boring operation.\n We present a novel approach for identifying rock type at the drilling bit\nbased on machine learning classification methods and data mining on sensors\nreadings. We compare various machine-learning algorithms, examine extra\nfeatures coming from mathematical modeling of drilling mechanics, and show that\nthe real-time rock type classification error can be reduced from 13.5 % to 9 %.\nThe approach is applicable for precise directional drilling in relatively thin\ntarget intervals of complex shapes and generalizes appropriately to new wells\nthat are different from the ones used for training the machine learning model.\n