Explainable Natural Language Processing Models using Partial Dependence Plots with Random Forests
The interpretability of natural language processing (NLP) models is needed to comprehend the decision-making, especially in the ensemble-based models, like the Random Forests. This paper will discuss how Partial Dependence Plots (PDP) can be used to measure and plot the influence of individual words on model predictions on a variety of NLP models. The datasets that were taken into consideration were multi-class topic classification (20 Newsgroups, AG News), binary sentiment analysis (IMDB, Amazon Reviews), and SMS spam detection. Random Forest classifiers were trained on TF-IDF features and PDPs were used to analyze key words that are representative of each class or sentiment. Findings indicate that words that are class specific and those that bear sentiments have high values of partial dependence, which have strong effects on the classes they are predicted to belong to, whereas generic words have moderate cross-class effects. The method gives both numerical and graphical understanding of the contribution of features, and one can easily interpret the model behavior without compromising the predictive performance. In datasets, PDPs showed consistent patterns, which indicated the generality of the approach. The results highlight that PDPs are useful to discover meaningful word-level relations, identify subtle interactions, and increase the model transparency. Having generalized the use of PDPs across several NLP domains, this work provides a viable framework of interpretable machine learning, making practitioners apply models with confidence and knowing the underlying factors that lead to the predictions. In general, the suggested methodology fills the disconnection between model performance and interpretability, which can make NLP systems more transparent and reliable.
Authors
- Anandakumar Haldorai (ORCID: https://orcid.org/0000-0001-9975-6462)
Institutions
- Sri Eshwar College of Engineering
Publication Details
- Journal
- Elaris Computing Nexus
- Published
- 2025-06-06
- DOI
- https://doi.org/10.65148/ecn/2025007
- Citations
- 1
- Primary Topic
- Explainable Artificial Intelligence (XAI)
- Type
- article
- Field-Weighted Citation Impact
- 2.48