|
|
--- |
|
|
language: "en" |
|
|
tags: |
|
|
- deep-learning |
|
|
- transformers |
|
|
- huggingface |
|
|
license: "mit" |
|
|
datasets: |
|
|
- my_dataset |
|
|
model-name: "my_model" |
|
|
--- |
|
|
|
|
|
# **FinBERT Fine-Tuned on Financial Sentiment (Financial PhraseBank + GitHub Dataset)** |
|
|
|
|
|
## **π Model Description** |
|
|
This model is a fine-tuned version of **FinBERT** (`ProsusAI/finbert`) trained for **financial sentiment classification**. |
|
|
It can classify financial text into **three categories**: |
|
|
- **Negative (0)** |
|
|
- **Neutral (1)** |
|
|
- **Positive (2)** |
|
|
|
|
|
## **π Dataset Used** |
|
|
This model was trained on: |
|
|
β
**Financial PhraseBank** - A widely used financial sentiment dataset. |
|
|
β
**GitHub Generated Sentiment Dataset** - An additional dataset to test the model. |
|
|
|
|
|
## **βοΈ Training Parameters** |
|
|
| Parameter | Value | |
|
|
|---------------------|--------| |
|
|
| Model Architecture | FinBERT (based on BERT) | |
|
|
| Batch Size | 8 | |
|
|
| Learning Rate | 2e-5 | |
|
|
| Epochs | 3 | |
|
|
| Optimizer | AdamW | |
|
|
| Evaluation Metric | F1-Score, Accuracy | |
|
|
|
|
|
## **π Model Performance** |
|
|
| Dataset | Accuracy | F1 (Weighted) | Precision | Recall | |
|
|
|-----------------|----------|--------------|------------|---------| |
|
|
| Financial PhraseBank (Train) | 95.21% | 95.23% | 95.32% | 95.21% | |
|
|
| GitHub Test Set | 64.42% | 64.34% | 70.52% | 64.42% | |
|
|
|
|
|
## **π Intended Use** |
|
|
This model is designed for: |
|
|
β
**Financial Analysts & Investors** to assess sentiment of financial sentences in ex. reports, news, and stock discussions. |
|
|
β
**Financial Institutions** for NLP-based sentiment analysis in automated trading. |
|
|
β
**AI Researchers** exploring financial NLP models. |
|
|
|
|
|
## **β οΈ Limitations** |
|
|
β οΈ **May not generalize well to datasets with very different financial language.** |
|
|
β οΈ **Might require fine-tuning for specific financial domains (crypto, banking, startups).** |
|
|
|
|
|
## **π₯ Usage Example** |
|
|
You can use the model via Hugging Face Transformers: |
|
|
|
|
|
```python |
|
|
from transformers import AutoModelForSequenceClassification, AutoTokenizer |
|
|
|
|
|
model_name = "Driisa/finbert-finetuned-github" |
|
|
|
|
|
# Load model and tokenizer |
|
|
model = AutoModelForSequenceClassification.from_pretrained(model_name) |
|
|
tokenizer = AutoTokenizer.from_pretrained(model_name) |
|
|
|
|
|
# Example input |
|
|
text = "The company's stock has seen significant growth this quarter." |
|
|
|
|
|
# Tokenize and predict |
|
|
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=128) |
|
|
outputs = model(**inputs) |
|
|
|
|
|
# Get predicted class |
|
|
predicted_class = outputs.logits.argmax().item() |
|
|
print(f"Predicted Sentiment: {['Negative', 'Neutral', 'Positive'][predicted_class]}") |
|
|
|