Abstract
Diagnosis of malaria is challenging due to the complexity of clinical presentation, environmental risk factors and behavioural risk factors. Any machine learning (ML) technique can be used to help classify malaria; however, a high-accuracy model might not give much information on how the individual prediction was made. This research presents a clinically constrained counterfactual ML approach to classify malaria based on symptoms and risk factors. The accuracies, precisions, sensitivities, specificities, F1 scores, ROC-AUC and PR-AUC were used to compare the performance of Decision Tree, Random Forest and XGBoost classifiers. XGBoost gave the best overall performance with an accuracy of 83.06%, sensitivity of 87.16%, F1-score of 87.62%, ROC-AUC of 0.8830 and PR-AUC of 0.9387. Mosquito-bite exposure, bitter taste in the mouth, travelling to endemic areas, and severity of fever were some of the most important factors identified by feature-importance analysis. The chosen XGBoost model was then combined with a domain-driven counterfactual search method that safeguarded the immutable variables and limited the changes of the candidate variables based on clinical-consistency rules. The unconstrained baseline found no valid prediction-changing counterfactuals, while the constrained procedure found counterfactuals in 57.08% of the cases evaluated, with an average of 1.8237 modified features. The results demonstrate that domain-guided counterfactual search can deliver sparse prediction-change scenarios grounded in clinical knowledge, which are informative and easy to understand. The generated counterfactuals are meant to be an explanation of the model's decision boundary, not an assertion that changing a feature will cause a change in the patient's actual disease state. Before clinical application, the framework needs to be externally validated, have more robust resampling-based model validation and be compared to existing counterfactual-generation approaches.