Downloads · 30 days
9
11% of all-time downloads
athallabf/fp-ai-modul-6
fp-ai-modul-6 is a text classification model from athallabf. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as mit.
probably proofread and complete it, then remove this comment. --
Downloads · 30 days
9
11% of all-time downloads
All-time downloads
83
Public
Repo size
499 MB
Likes
0
Public
Click a slice to open those files.
.h5499 MB · 99%
From the Hugging Face model README
This model is a fine-tuned version of roberta-base on the GoEmotions dataset. It has been trained to perform multi-label text classification to detect one or more of 14 different emotions from a given text.
This model was trained as part of a final project for an AI module, demonstrating the end-to-end process of data analysis, preprocessing, model fine-tuning with TensorFlow/Keras, evaluation, and deployment on the Hugging Face Hub.
It achieves the following results on the evaluation set:
This is a roberta-base model fine-tuned for multi-label emotion classification. The model takes a text as input and outputs a probability score for each of the following 14 emotions:
amusementangerannoyancecaringconfusiondisappointmentdisgustembarrassmentexcitementfeargratitudejoylovesadnessSince it's a multi-label classification task, the output layer uses a Sigmoid activation function, and the model is trained with Binary Cross-Entropy loss.
You can use this model with the text-classification pipeline. Since it's a multi-label model, it's recommended to pass the top_k=None argument to see the scores for all labels.
from transformers import pipeline
# Replace "your-username/fp-ai-modul-6" with your actual model repo
classifier = pipeline("text-classification", model="your-username/fp-ai-modul-6", top_k=None)
text = "I can't believe I won the lottery! This is the best day of my life!"
predictions = classifier(text)
# Apply a threshold to filter relevant emotions
threshold = 0.35 # This threshold was tuned on the validation set
for pred in predictions[0]:
if pred['score'] > threshold:
print(f"Label: {pred['label']}, Score: {pred['score']:.4f}")
# Expected output:
# Label: joy, Score: 0.9876
# Label: excitement, Score: 0.9754
# Label: amusement, Score: 0.4532
joy and amusement and may struggle with rare emotions like embarrassment or disgust.roberta-base architecture is smaller and faster but may be less accurate than larger models like roberta-large.The model was fine-tuned on the GoEmotions dataset, a human-annotated dataset of 58k Reddit comments labeled with 27 emotion categories. For this project, a subset of 14 primary emotions was used.
The data was split into:
Preprocessing steps included lowercasing and tokenization with a max length of 128.
The following hyperparameters were used during training:
An EarlyStopping callback was used to monitor val_loss with a patience of 2, restoring the best weights at the end of training.
The final model achieved a Macro F1-Score of 0.5123 on the validation set after tuning the prediction threshold to 0.35.