Work

Suicide Risk Detection from Text

Type a post and the app says whether it shows signs of suicide risk. A LightGBM model trained on 232,074 Reddit posts, built by our team The Untouchaballs for Data Royale 2023. It is a competition project, not a clinical tool.

Year
2023
Fields
AI / ML
Stack
  • Python
  • NLP
  • NLTK
  • scikit-learn
  • LightGBM
  • Streamlit
Data Royale competition logo: gold letters on a blue shield above clouds

01 / Problem

Posts are short, messy and full of slang, and missing a risk post costs more than a false alarm.

02 / How it works

  1. Type or paste a post.
  2. The text is cleaned: lowercased, stopwords removed, words reduced to their base form.
  3. It becomes character-pattern features (TF-IDF).
  4. LightGBM classifies it as risk or no risk.

03 / Tech & why

NLTK
Lowercase, remove punctuation and stopwords, tokenize and lemmatize before featurising.
Character-level TF-IDF
1–3 character n-grams, 5,000 features, chosen because it copes with typos and slang.
LightGBM (vs Random Forest, Naive Bayes)
The most accurate of the three on an 80/20 stratified split, and small enough to deploy: 3.8 MB against 226 MB for Random Forest.
Streamlit Community Cloud
Free hosting for a demo anyone can try in the browser.

04 / Results

  • 3rd place, Senior Division, Data Royale 2023 (Kotak Riset & DSAI OmahTI, Universitas Gadjah Mada).
  • 95% accuracy on 46,415 held-out posts.

05 / Evaluation

Model comparison, 46,415 test posts

Data: Kaggle Suicide and Depression Detection, 232,074 posts, half suicide and half non-suicide, no missing or duplicate rows. The most frequent bigrams in risk posts were “feel like”, “don't want”, “want die”, “I'm tired” and “I'm scared”.

LightGBM
95% accuracy · 0.95 F1
Random Forest
90% accuracy · 0.90 F1
Naive Bayes
84% accuracy · 0.83 F1
Confusion matrix of the LightGBM model on the test set
LightGBM on 46,415 test posts: 95% accuracy.

Faris Zaidan Nafis

Loading portfolio