--- language: - ms - en library_name: transformers pipeline_tag: text-classification tags: - bert - sentiment-analysis --- # Malay–English Sentiment Classifier (mBERT) A three-class sentiment model developed for a 2025–2026 degree capstone on Malaysian COVID-19 social-media text. Labels: NEGATIVE (0), NEUTRAL (1), POSITIVE (2). ## Current evaluated release The corrected checkpoint is in **corrected-2026-10**, pinned at **9bc6645ce7a8e02761c59386ffd16969bed1bc55**. The live app uses this exact release and verifies its weights checksum. The root-level model files are retained as the older checkpoint for rollback; loading the repository root alone does not load the corrected release. [Release protocol, preprocessing and limitations](corrected-2026-10/README.md) · [Live app](https://huggingface.co/spaces/SiobhanGoh/emotion-detection-malaybert-skeleton) · [Source and aggregate results](https://github.com/SiobhanGoh/capstone2-sentiment-streamlit-colab) The corrected, shared split retains 6,539 unique inputs: 4,577 training, 981 validation and 981 test. Model selection used validation only. On the same internal test inputs, mBERT achieved **76.04% accuracy / 0.7557 macro-F1**, compared with **66.46% / 0.6553** for TF-IDF logistic regression. Earlier development used this broader corpus; these are retrospective internal results, not independent external validation. These metrics apply only to the corrected checkpoint. ## Correct usage ```python from transformers import AutoTokenizer, AutoModelForSequenceClassification repo = "SiobhanGoh/CP2_Emotion_Model_New" release = {"revision": "9bc6645ce7a8e02761c59386ffd16969bed1bc55", "subfolder": "corrected-2026-10"} tokenizer = AutoTokenizer.from_pretrained(repo, **release, fix_mistral_regex=False) model = AutoModelForSequenceClassification.from_pretrained(repo, **release, use_safetensors=True) model.eval() ``` Before inference, apply Unicode NFKC and casefolding, remove URLs and @mentions, remove hashtag markers and collapse whitespace. Reject empty cleaned inputs and truncate to 128 model tokens. The source app implements this preprocessing exactly as used during training. Weights SHA-256: `771a19b8c14865f8d8d8c7adc7df95d859b08a866195f5b7bfe3ac44723ec61b`. ## Limits This is an educational sentiment prototype. Sarcasm, slang, mixed languages, context and topics outside the training corpus can cause errors. Softmax scores are uncalibrated; they are not probabilities of correctness, emotion intensity, business risk or clinical assessments. YouTube comment summaries are not representative audience surveys. No raw social text is distributed here. Author: **Siobhan Goh Shze Mun**.