A machine learning system that recommends personalised malaria treatment (ACT or Non-ACT) based on individual patient clinical profiles, developed as part of a Master's degree thesis.
Malaria remains one of the leading causes of death globally, with 249 million cases and 608,000 deaths recorded in 2023 alone, the majority in sub-Saharan Africa. Current treatment approaches largely follow a one-size-fits-all model that does not account for individual patient differences such as age, pregnancy status, malaria type, and disease severity.
This project explores how machine learning can move beyond that limitation by training models to recommend the most clinically appropriate treatment for a given patient, rather than applying a single standard treatment to every case.
The dataset consists of 2,000 anonymized patient records sourced from Kaggle, containing 20 clinical variables including patient demographics, presenting symptoms, malaria type, disease severity indicators, and treatment outcomes.
Several preprocessing steps were applied to prepare the dataset for model training:
- Column removal:
cerebral_malariawas dropped as redundant withsevere_malaria;malaria_statuswas dropped after filtering to malaria-positive patients only;residencewas dropped as non-predictive. - Age encoding: Raw age values were converted into five ordinal groups (Child, Teenager, Young Adult, Adult, Elderly) to resolve mixed numerical and categorical data types, in line with WHO age-based treatment differentiation.
- Filtering: The dataset was filtered to retain only the 1,330 malaria-positive patients, since the goal is to personalise treatment for confirmed cases.
- Target encoding: Treatment regimens were grouped into two binary classes, ACT (0) and Non-ACT (1), where Non-ACT encompasses both Quinine and Chloroquine.
- Data augmentation: The dataset was triplicated to 3,990 records to improve model learning.
- Class balancing: SMOTE (Synthetic Minority Oversampling Technique) was applied exclusively on the training set to address class imbalance between ACT and Non-ACT cases.
The dataset was split 70/10/20 into training, validation, and testing sets. Five classification algorithms were trained and compared under a unified experimental framework:
- Random Forest
- XGBoost
- Support Vector Machine (SVM)
- Logistic Regression
- AdaBoost
Each model was evaluated using accuracy, precision, recall, and F1-score. Beyond numerical metrics, each model was also tested on two unseen patient profiles, an elderly male and a pregnant woman with Plasmodium Falciparum malaria, to assess real-world clinical decision-making capability.
| Model | Test Accuracy | Macro F1-Score |
|---|---|---|
| Random Forest | 85.34% | 0.85 |
| XGBoost | 83.21% | 0.83 |
| Logistic Regression | 71.43% | 0.71 |
| SVM | 71.30% | 0.71 |
| AdaBoost | 71.30% | 0.71 |
Random Forest was selected as the final model based on two criteria: it achieved the highest test accuracy among all five models, and it was one of only two models to correctly recommend Non-ACT treatment for the pregnant patient, aligning with WHO clinical guidelines. This demonstrates that raw accuracy alone is not a sufficient basis for model selection in a clinical context; clinical correctness on real patient scenarios matters just as much.
Feature importance analysis identified age, malaria severity, and malaria type as the strongest predictors of treatment choice. This was further validated using Spearman correlation analysis, which confirmed malaria severity (r = 0.271, p < 0.001) and malaria type (r = 0.207, p < 0.001) as statistically significant predictors, while age, vomiting, and weight showed weak or non-significant linear correlation, indicating their influence is captured through more complex, non-linear interactions that tree-based models like Random Forest are better suited to learn.
Untitled.ipynb— Full notebook containing data preprocessing, model training, evaluation, and visualisation codeMalaria_dataset_model_training.csv— Source datasetmalaria_treatment_model_final.pkl— Final trained Random Forest modelconfusion_matrix.png— Confusion matrix for the final modelfeature_importance.png— Feature importance chartmodel_accuracy_final.png— Model comparison chart
Python, Pandas, Scikit-learn, XGBoost, Imbalanced-learn (SMOTE), SciPy, Matplotlib, Seaborn, Joblib
Beyond numerical accuracy, each of the five models was tested on three unseen patient profiles to evaluate real-world clinical decision-making.
| Model | Elderly Male, Falciparum | Pregnant Woman, Falciparum (Severe) | Newborn, Falciparum |
|---|---|---|---|
| Random Forest | ACT | Non-ACT | Non-ACT |
| XGBoost | ACT | ACT | ACT |
| SVM | ACT | Non-ACT | ACT |
| Logistic Regression | ACT | ACT | ACT |
| AdaBoost | ACT | ACT | ACT |
All five models correctly recommended ACT for the elderly male patient with uncomplicated Falciparum malaria, consistent with WHO first-line treatment guidelines. Only Random Forest and SVM correctly recommended Non-ACT for the pregnant woman presenting with severe malaria indicators, a case where WHO guidelines favour Quinine over ACT. For the newborn, Random Forest applied a more cautious Non-ACT recommendation, while the remaining four models recommended ACT, which is also supported by WHO guidance for uncomplicated malaria in infants. Random Forest was the only model to combine the highest overall accuracy with clinically sound, age-sensitive recommendations across all three test patients, reinforcing its selection as the final model for this study.
Ifeanyi (MasterIfeanyi / japandi) Master's Thesis Project