MindCare AI: Emotion & Sentiment Analysis Models (Trained from Scratch)
This repository hosts serialized machine learning models trained strictly from scratch without pretrained transformer weights, developed as part of the MindCare AI framework.
π Benchmark Results
1. 3-Class Sentiment (Positive, Negative, Neutral)
- Dataset: GoEmotions (54,258 authentic samples)
- Best Model: Logistic Regression / Calibrated SVM (LinearSVC)
- Held-out Test Accuracy: 68.80%
- Weighted F1 Score: 0.6909
2. 10-Class Fine-Grained Emotion Recognition
- Classes: Happiness, Sadness, Anger, Fear, Surprise, Disgust, Neutral, Excitement, Frustration, Gratitude
- Best Model: Custom Bidirectional LSTM with Self-Attention Context Pooling
- Held-out Test Accuracy: 56.99%
- Weighted F1 Score: 0.5610
π¦ Model Files Included
sentiment_lr.joblib- Calibrated Logistic Regression for 3-class sentimentsentiment_svm.joblib- Calibrated Linear Support Vector Machinesentiment_nb.joblib- Multinomial Naive Bayessentiment_rf.joblib- Random Forest Classifiersentiment_vectorizer.joblib- TF-IDF n-gram vectorizer (ngram_range=(1,2), max_features=12,000)sentiment_mlp.pt- PyTorch Multi-Layer Perceptronsentiment_lstm.pt- PyTorch Bidirectional LSTM with Attentionemotion_lr.joblib/emotion_svm.joblib/emotion_lstm.pt- 10-class emotion modelsvocab.json- Tokenizer vocabularysentiment_metadata.json/emotion_metadata.json- Validation & test performance metrics
π Quick Usage (Python)
import joblib
# Load TF-IDF vectorizer and trained Logistic Regression model
vectorizer = joblib.load("sentiment_vectorizer.joblib")
model = joblib.load("sentiment_lr.joblib")
text = "I am grateful for all the support and kindness."
X = vectorizer.transform([text])
prediction = model.predict(X)[0]
probs = model.predict_proba(X)[0]
print(f"Sentiment: {prediction}")
print(f"Probabilities: {dict(zip(model.classes_, probs))}")
βοΈ Ethical Boundary & Non-Medical Disclaimer
This model identifies linguistic patterns and sentiment correlations in text. It is not a psychiatric diagnostic instrument or medical device.