Abstract
Accurate and interpretable suicide risk assessment is critical for timely intervention in mental health contexts. This study presents an explainable machine learning approach for suicide risk assessment using social media data, evaluating both multi-class and binary classification settings alongside a multi-level explainability strategy. Results show that while multi-class classification enables fine-grained risk stratification, it introduces substantial predictive complexity, with models achieving moderate performance (balanced accuracy ≈ 0.53 and ROC-AUC ≈ 0.79). In contrast, binary classification improves stability and discrimination, supporting its suitability for real-world risk prioritisation in digital mental health settings. To enhance interpretability, the study integrates SHAP and LIME to provide complementary global and local explanations. SHAP identifies key linguistic indicators such as temporal references, intent-related terms, and self-referential expressions as primary drivers of elevated risk, while LIME provides instance-level justification for individual predictions. Building on this, a counterfactual explanation method, Counterfactual Explanations with Optimised Contextual Flow (CE-OCF), is introduced. CE-OCF generates minimal, contextually coherent textual modifications that shift model predictions, enabling the simulation of both escalation and de-escalation pathways. The study advances explainable artificial intelligence (XAI) for suicide risk assessment by combining predictive modelling with actionable interpretability. These findings highlight the importance of aligning model performance with clinically relevant explanations, supporting the development of transparent and decision-supportive artificial intelligence (AI) systems for early detection and intervention.