The objective of this study is to present a novel rock formation identification model using a data-driven modeling approach. This study explores the use of real-time drilling data to train and validate a classification model to improve the efficiency of the drilling process by reducing Mechanical Specific Energy (MSE). In this study, we demonstrate the feasibility of a layer-based determination and change detection of properties of rock formation currently being drilled as accurately and fast as possible. Data for this study was collected from a custom-built lab-scale drilling rig equipped with multiple sensors. The experiment was conducted by drilling through an arrangement of different rock formations of varying rock strength properties. Data was recorded and stored at a frequency of 2 kHz, then filtered, processed, and downsampled to extract relevant features. This dataset was used to train an Artificial Neural Network and other machine learning classification algorithms. Feature selection was made first with ten most notable features found by Random Forest, and the second set with derived measurements and down-sampled dynamic features from the sensors. The classification analysis was divided into two steps: the best predictors/features extraction and classification model building. The models were trained using multiple classification algorithms, namely logistic regression, linear discriminant analysis (LDA), Support Vector Machines (SVM), Random Forest (RF), and Artificial Neural Networks (ANN). It was found that random forest and ANN performed the best with prediction accuracy of 99.48% and 99.58%, respectively, for the data set with ten most prominent features. The high prediction rate accuracy for the most prominent predictors suggests that if the high-frequency data can be processed in real-time, predicting what formation we are drilling in is possible to achieve in near real-time. This can lead to significant savings for drilling companies as optimal drilling parameters can be computed, and in turn, optimized Mechanical Specific Energy can be obtained in real-time. Since the rock formation identification is time-consuming, we also describe here an alternative approach using slightly less accurate but equally powerful dynamic predictors. In this case, we show that our dynamic predictor models with RF and ANN yielded prediction accuracy of 96.30% and 95.61%, respectively. Both the prominent feature and dynamic predictor approaches are described in detail in this paper. Our results suggest that accurately predicting rock formation type in real-time while drilling is very much feasible with lesser computational cost and complexity. This study provides the building blocks for the development of a completely autonomous downhole device and Electronic Device Recorders (EDR) that reduces the need for highly sophisticated sensors or data transmission processes downhole.