FinBERT Sentiment Analysis on English/Quotes Dataset
📌 Overview
This repository hosts the FinBERT model fine-tuned for sentiment analysis using the English/Quotes dataset. The model classifies text into sentiment categories such as positive, negative, or neutral.
🏗 Model Details
Model Architecture:
FinBERT (BERT-based model for sentiment analysis)
defpredict_sentiment(text):
inputs = tokenizer(text, padding="max_length", truncation=True, max_length=128, return_tensors="pt")
inputs = {key: val.to(device) for key, val in inputs.items()} # Move inputs to devicewith torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
prediction = torch.argmax(logits, dim=-1).item()
label_map = {0: "negative", 1: "neutral", 2: "positive"}
return label_map[prediction]
# Test on the original 5 quotes
original_quotes = [
"“Be yourself; everyone else is already taken.”",
"“I'm selfish, impatient and a little insecure. I make mistakes, I am out of control and at times hard to handle. But if you can't handle me at my worst, then you sure as hell don't deserve me at my best.”",
"“Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.”",
"“So many books, so little time.”",
"“A room without books is like a body without a soul.”"
]
print("Predictions for original quotes:")
for quote in original_quotes:
pred = predict_sentiment(quote)
print(f"Quote: {quote}\nPredicted Sentiment: {pred}\n")
# Test on a new example
new_quote = "Life is beautiful when you smile."print("Prediction for new quote:")
print(f"Quote: {new_quote}\nPredicted Sentiment: {predict_sentiment(new_quote)}")
📊 Evaluation Metric: Accuracy & F1 Score
For sentiment analysis, accuracy and F1-score are key evaluation metrics. The model achieves:
Accuracy:
88%
F1 Score:
0.85
📂 Repository Structure
.
├── model/ # Contains the fine-tuned model files
├── tokenizer_config/ # Tokenizer configuration and vocabulary files
├── model.safetensors/ # Model weights
├── README.md # Model documentation
⚠️ Limitations
The model may struggle with ambiguous phrases.
Performance might vary across different jurisdictions and terminologies.
The dataset primarily contains English text, making it less effective for multilingual applications.
🤝 Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request if you have suggestions or improvements.
Runs of AventIQ-AI finbert-sentiment-analysis on huggingface.co
8
Total runs
1
24-hour runs
2
3-day runs
-1
7-day runs
-2
30-day runs
More Information About finbert-sentiment-analysis huggingface.co Model
finbert-sentiment-analysis huggingface.co
finbert-sentiment-analysis huggingface.co is an AI model on huggingface.co that provides finbert-sentiment-analysis's model effect (), which can be used instantly with this AventIQ-AI finbert-sentiment-analysis model. huggingface.co supports a free trial of the finbert-sentiment-analysis model, and also provides paid use of the finbert-sentiment-analysis. Support call finbert-sentiment-analysis model through api, including Node.js, Python, http.
finbert-sentiment-analysis huggingface.co is an online trial and call api platform, which integrates finbert-sentiment-analysis's modeling effects, including api services, and provides a free online trial of finbert-sentiment-analysis, you can try finbert-sentiment-analysis online for free by clicking the link below.
AventIQ-AI finbert-sentiment-analysis online free url in huggingface.co:
finbert-sentiment-analysis is an open source model from GitHub that offers a free installation service, and any user can find finbert-sentiment-analysis on GitHub to install. At the same time, huggingface.co provides the effect of finbert-sentiment-analysis install, users can directly use finbert-sentiment-analysis installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
finbert-sentiment-analysis install url in huggingface.co: