Classification is a technique in data mining used to build predictive models based on patterns or characteristics of data. One widely used classification algorithm is Random Forest, an ensemble learning method that combines several decision trees to produce more accurate and stable predictions. However, the performance of the Random Forest algorithm can be affected by the parameters used, one of which is the number of decision trees (n_estimators). This study aims to analyze the effect of variations in the number of trees on the performance of the Random Forest algorithm in classifying and determine the configuration of the number of trees that produces the best accuracy. The research method was carried out by applying the Random Forest algorithm using variations in the number of trees of 50, 100, 150, and 200. Model performance evaluation was carried out using accuracy, confusion matrix, and feature importance analysis. The test results showed that variations in the number of trees had an impact on model performance, although the increase in accuracy obtained was relatively small. The accuracy values for n_estimators 50, 100, 150, and 200 were 89.44%, 89.44%, 89.53%, and 89.42%, respectively, with the best performance obtained when using n_estimators = 150. The confusion matrix results showed that this configuration provided a better classification balance between the Cancel and Not_Cancelled classes. In addition, feature importance analysis showed that lead time, average price, and special requests were the most influential features on the classification results across all variations in the number of trees. Based on the results of the study, the use of the optimal number of trees can improve the stability of the Random Forest model, but adding a larger number of trees does not always result in a significant increase in accuracy. The Random Forest source code and dataset are available on GitHub at https://github.com
Copyrights © 2026