loganh274/nlp-testing-setfit
022
SetFit Sentiment Analysis Model
This is a SetFit model fine-tuned for sentiment classification on customer feedback data.
Model Description
Training Configuration
Training Progress
- Initial Loss: 0.2366
- Final Loss: 0.0893
- Eval Loss: 0.0984
- Training Runtime: 800.2981 seconds
- Samples/Second: 13.4950
Evaluation Results
Per-Class Performance
precision recall f1-score support
0 0.90 0.90 0.90 20
1 0.75 0.75 0.75 20
2 0.79 0.95 0.86 20
3 1.00 0.80 0.89 20
4 1.00 1.00 1.00 20
accuracy 0.88 100
macro avg 0.89 0.88 0.88 100
weighted avg 0.89 0.88 0.88 100
Visualizations
Evaluation Metrics Overview
<p align="center"> <img src="evaluation_metrics.png" alt="Evaluation Metrics" width="800"/> </p>
Confusion Matrix
<p align="center"> <img src="confusion_matrix.png" alt="Confusion Matrix" width="600"/> </p>
Training Loss Curve
<p align="center"> <img src="loss_curve.png" alt="Training Loss Curve" width="600"/> </p>
Learning Rate Schedule
<p align="center"> <img src="learning_rate.png" alt="Learning Rate Schedule" width="600"/> </p>
Usage
from setfit import SetFitModel
# Load the model
model = SetFitModel.from_pretrained("loganh274/nlp-testing-setfit")
# Single prediction
text = "This product exceeded my expectations!"
prediction = model.predict([text])
print(f"Sentiment: {prediction[0]}")
# Batch prediction
texts = [
"Amazing quality, highly recommend!",
"It's okay, nothing special.",
"Terrible experience, very disappointed.",
]
predictions = model.predict(texts)
probabilities = model.predict_proba(texts)
for text, pred, prob in zip(texts, predictions, probabilities):
print(f"Text: {text}")
print(f" Prediction: {pred}, Confidence: {max(prob):.2%}")Label Mapping
Environment
Citation
If you use this model, please cite the SetFit paper:
@article{tunstall2022efficient,
title={Efficient Few-Shot Learning Without Prompts},
author={Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
journal={arXiv preprint arXiv:2209.11055},
year={2022}
}License
Apache 2.0
