Nour Elislem Karabadji, Ali Assi, Abdelaziz Amara Korba, Ahmed Abdulaziz Al Nuaim, Hassina Seridi, Mohamed Elati, Wajdi Dhifli
Random forests are widely recognized for their robustness and generalization across diverse datasets. However, their performance can be hindered by the inclusion of redundant or weakly contributing trees, which may dilute ensemble accuracy and reduce model diversity. This paper presents WRFO , a novel approach for Weighted Random Forest Optimization. WRFO aims to improve random forests mainly through dynamic (1) tree weighting and (2) accuracy and diversity-preserving pruning. WRFO leverages particle swarm optimization to selectively preserve the most informative trees where the latter are assigned higher weights based on their diversity and predictive contribution. This results in a leaner, more accurate, and more diverse ensemble. We present comprehensive experiments on 24 UCI benchmark datasets as well as on a real-world scenario for network intrusion detection. The obtained results demonstrate the effectiveness of WRFO in real-world scenarios and show that it consistently outperforms three state-of-the-art Random Forest methods.