Downloads · 30 days
0
mzmuzni/sinmood-emotion-detection
sinmood-emotion-detection is a machine learning model from mzmuzni. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
SinMood is a machine learning project aimed at developing a multi-class classifier to detect emotional states (Normal, Sad, Depressed, Anxious) in romanized Singlish social media posts. This model is designed to assis…
Downloads · 30 days
0
Access
Public
Updated Feb 3, 2026
Repo size
70.5 MB
Likes
0
Public
Click a slice to open those files.
.pkl67.2 MB · 95%
From the Hugging Face model README
SinMood is a machine learning project aimed at developing a multi-class classifier to detect emotional states (Normal, Sad, Depressed, Anxious) in romanized Singlish social media posts. This model is designed to assist in identifying early signs of emotional distress in a linguistically unique context.
The SinMood model employs a hybrid feature representation combined with an ensemble classifier:
xlm-roberta-base to extract 768-dimensional contextual embeddings for each post, capturing semantic meaning and context.These diverse feature sets are concatenated to form a rich representation for each social media post.
The final model is an ensemble classifier combining three powerful algorithms through soft voting (averaging probabilities):
Class Weighting: Crisis classes (Depressed, Anxious) are given higher weights during training to prioritize their detection, reflecting the critical nature of these emotional states.
Overall Metrics (4-class classification):
The model demonstrates a good baseline for a challenging multi-class classification task in a low-resource, code-mixed language.
To use this model for inference, you can leverage the inference.py script provided in this repository. The init() function loads all necessary model artifacts (ensemble model, vectorizers, and XLM-RoBERTa components), and the inference() function takes a dictionary with a "text" key and returns the predicted emotion and probabilities.
from huggingface_hub import HfApi, snapshot_download
import os
import sys
import json
# Assuming inference.py, model files are locally available or downloaded
# For Hugging Face Spaces, these are automatically handled.
# --- Minimal setup to run inference locally after downloading repo contents ---
# from inference import init, inference # If inference.py is in current directory
# If running directly from Hub, use the API
# api = HfApi()
# model_path = snapshot_download(repo_id="mzmuzni/sinmood-emotion-detection")
# sys.path.append(model_path)
# from inference import init, inference
# init() # Initialize the model once
# text_input = {"text": "mata jeewithe nethi krgnna hithenwa hamadema epa wela"}
# result = inference(text_input)
# print(result)
# Output example:
# {
# 'prediction': 'Depressed',
# 'confidence': 0.870,
# 'probabilities': {'Depressed': 0.870, 'Sad': 0.057, 'Normal': 0.044, 'Anxious': 0.029}
# }
# This model is primarily for research and educational purposes.
# Always consult with mental health professionals for actual diagnosis and treatment.
sinmood_model_compatible.pkl: The pickled ensemble classifier.char_vectorizer_compatible.pkl: The pickled TF-IDF vectorizer for character n-grams.word_vectorizer_compatible.pkl: The pickled TF-IDF vectorizer for word n-grams.model_metadata.json: Metadata about the model, features, and performance.confusion_matrix.png: Visualization of the model's confusion matrix.inference.py: Python script for performing inference with the loaded model.requirements.txt: List of Python dependencies required to run the model.X_train_xlmr.npy, X_test_xlmr.npy: Pre-computed XLM-RoBERTa embeddings for train and test sets (for reproducibility/reference).This project was developed by M.M.M. Maznavi (20212086) at the Informatics Institute of Technology & University of Westminster. Special thanks to the contributors of the XLM-RoBERTa model and the open-source community.
Disclaimer: This model is for research and experimental purposes only. It is not a substitute for professional medical advice, diagnosis, or treatment. If you or someone you know is experiencing emotional distress, please seek help from a qualified mental health professional or crisis hotline.