Comparative Explainable Machine Learning Framework for

Multiclass Drug Classification

Ahmed Ashraf Abdelfatah1,*

1 Department of Clinical Pharmacy and Pharmacy Practice, Faculty of Pharmacy, Mansoura University, Mansoura 35516, Egypt

Email: ahmedmohamedashraf@std.mans.edu.eg

Received: May 31, 2026 R ev ised: July 14, 2026 A cc epted: September 06, 2026 ⋆ C or responding author

ABSTRACT

Accurate drug classification is important for developing intelligent healthcare systems and supporting reliable

medication-related decision-making. The relationships between patient characteristics and prescribed drug categories

may be nonlinear and difficult to identify using conventional analytical procedures. This study presents a machine

learning framework for multiclass drug classification using demographic and clinical patient attributes. The

framework includes data cleaning, exploratory data analysis, numerical and categorical feature transformation,

model training, comparative evaluation, and explainable artificial intelligence analysis. Nine classification models

were investigated, including Random Forest, support vector machine, LightGBM, CatBoost, multilayer perceptron,

one-dimensional convolutional neural network, long short-term memory network, gated recurrent unit network, and

TabNet. The models were evaluated using accuracy, weighted precision, weighted recall, weighted F1-score, macro

F1-score, and balanced accuracy. Random Forest achieved the best overall balance between predictive performance

and interpretability, obtaining an accuracy of 97.50%, a macro F1-score of 98.51%, and a balanced accuracy of

98.18%. SHAP analysis identified the sodium-to-potassium ratio, blood-pressure categories, and age as the most

influential variables affecting the classification decisions. The obtained results demonstrate that an explainable

machine learning framework can provide accurate and transparent drug classification using a limited number of

patient-related variables.

Keywords: Drug classification Machine learning Random Forest Deep learning Explainable artificial intelligence

SHAP Healthcare decision support

1. INTRODUCTION

Drug classification is an important application of artificial

intelligence in pharmaceutical and healthcare systems because

it supports the organization of drug-related information

and assists in identifying suitable medication categories according

to patient characteristics. The increasing availability

of clinical and pharmaceutical data has created a need for

computational methods capable of processing heterogeneous

variables and detecting relationships that may be difficult to

identify through conventional analysis. Artificial intelligence

has consequently become an influential component of drug development,

drug repositioning, and clinical decision-support

systems [1, 2, 3].

Machine learning provides an effective framework for drug

classification by learning relationships between patient characteristics

and predefined drug classes. Patient records may

contain numerical attributes, such as age and sodium-topotassium

ratio, together with categorical attributes, such

as sex, blood-pressure level, and cholesterol category. These