Downloads · 30 days
0
B0b3rt1/emotions-classifier-mlp
emotions-classifier-mlp is a text classification model from B0b3rt1. Use it when you need a label for a piece of text. The card lists the license as mit.
Model klasyfikacji emocji w tekście oparty na wielowarstwowym perceptronie (MLP) z regularyzacją.
Downloads · 30 days
0
Access
Public
Updated Jan 19, 2026
Repo size
23.5 MB
Likes
1
Public
Click a slice to open those files.
.pth23.3 MB · 99%
From the Hugging Face model README
Model klasyfikacji emocji w tekście oparty na wielowarstwowym perceptronie (MLP) z regularyzacją.
Input (5000)
→ Linear(1024) + BatchNorm + ReLU + Dropout(0.5)
→ Linear(512) + BatchNorm + ReLU + Dropout(0.4)
→ Linear(256) + BatchNorm + ReLU + Dropout(0.3)
→ Linear(128) + BatchNorm + ReLU + Dropout(0.2)
→ Linear(6)
import torch
import pickle
from sklearn.feature_extraction.text import TfidfVectorizer
# Wczytaj model
model = DeepMLP()
model.load_state_dict(torch.load("model.pth", map_location="cpu"))
model.eval()
# Wczytaj vectorizer i emotion_map
with open("vectorizer.pkl", "rb") as f:
vectorizer = pickle.load(f)
with open("emotion_map.pkl", "rb") as f:
emotion_map = pickle.load(f)
# Klasyfikacja
text = "I am so happy today!"
X = vectorizer.transform([text]).toarray()
X_tensor = torch.FloatTensor(X)
with torch.no_grad():
outputs = model(X_tensor)
_, predicted = torch.max(outputs, 1)
emotion = emotion_map[predicted.item()]
print(f"Emotion: {emotion}")
| Emotion | Precision | Recall | F1-Score |
|---|---|---|---|
| sadness | 0.95 | 0.90 | 0.92 |
| joy | 0.89 | 0.93 | 0.91 |
| love | 0.81 | 0.73 | 0.77 |
| anger | 0.88 | 0.91 | 0.89 |
| fear | 0.83 | 0.86 | 0.84 |
| surprise | 0.72 | 0.77 | 0.74 |
| Macro avg | 0.85 | 0.85 | 0.85 |
@misc{emotions-classifier-mlp,
author = {Hubert Brzozowski},
title = {Emotions Classifier - Deep MLP},
year = {2026},
publisher = {Hugging Face}
}
MIT License