Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
model_card_content = """
|
| 2 |
+
# **FinBERT Fine-Tuned on Financial Sentiment (Financial PhraseBank + GitHub Dataset)**
|
| 3 |
+
|
| 4 |
+
## **📌 Model Description**
|
| 5 |
+
This model is a fine-tuned version of **FinBERT** (`ProsusAI/finbert`) trained for **financial sentiment classification**.
|
| 6 |
+
It can classify financial text into **three categories**:
|
| 7 |
+
- **Negative (0)**
|
| 8 |
+
- **Neutral (1)**
|
| 9 |
+
- **Positive (2)**
|
| 10 |
+
|
| 11 |
+
## **📂 Dataset Used**
|
| 12 |
+
This model was trained on:
|
| 13 |
+
✅ **Financial PhraseBank (All Agree)** - A widely used financial sentiment dataset.
|
| 14 |
+
✅ **GitHub Generated Sentiment Dataset** - An additional dataset to improve generalization.
|
| 15 |
+
|
| 16 |
+
## **⚙️ Training Parameters**
|
| 17 |
+
| Parameter | Value |
|
| 18 |
+
|---------------------|--------|
|
| 19 |
+
| Model Architecture | FinBERT (based on BERT) |
|
| 20 |
+
| Batch Size | 8 |
|
| 21 |
+
| Learning Rate | 2e-5 |
|
| 22 |
+
| Epochs | 3 |
|
| 23 |
+
| Optimizer | AdamW |
|
| 24 |
+
| Evaluation Metric | F1-Score, Accuracy |
|
| 25 |
+
|
| 26 |
+
## **📊 Model Performance**
|
| 27 |
+
| Dataset | Accuracy | F1 (Weighted) | Precision | Recall |
|
| 28 |
+
|-----------------|----------|--------------|------------|---------|
|
| 29 |
+
| Financial PhraseBank (Train) | 95.21% | 95.23% | 95.32% | 95.21% |
|
| 30 |
+
| GitHub Test Set | 64.42% | 64.34% | 70.52% | 64.42% |
|
| 31 |
+
|
| 32 |
+
## **🚀 Intended Use**
|
| 33 |
+
This model is designed for:
|
| 34 |
+
✅ **Financial Analysts & Investors** to assess sentiment in earnings reports, news, and stock discussions.
|
| 35 |
+
✅ **Financial Institutions** for NLP-based sentiment analysis in automated trading.
|
| 36 |
+
✅ **AI Researchers** exploring financial NLP models.
|
| 37 |
+
|
| 38 |
+
## **⚠️ Limitations**
|
| 39 |
+
⚠️ **May not generalize well to datasets with very different financial language.**
|
| 40 |
+
⚠️ **Might require fine-tuning for specific financial domains (crypto, banking, startups).**
|
| 41 |
+
|
| 42 |
+
## **📥 Usage Example**
|
| 43 |
+
You can use the model via Hugging Face Transformers:
|
| 44 |
+
|
| 45 |
+
```python
|
| 46 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 47 |
+
|
| 48 |
+
model_name = "your-username/finbert-finetuned-github"
|
| 49 |
+
|
| 50 |
+
# Load model and tokenizer
|
| 51 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 52 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 53 |
+
|
| 54 |
+
# Example input
|
| 55 |
+
text = "The company's stock has seen significant growth this quarter."
|
| 56 |
+
|
| 57 |
+
# Tokenize and predict
|
| 58 |
+
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=128)
|
| 59 |
+
outputs = model(**inputs)
|
| 60 |
+
|
| 61 |
+
# Get predicted class
|
| 62 |
+
predicted_class = outputs.logits.argmax().item()
|
| 63 |
+
print(f"Predicted Sentiment: {['Negative', 'Neutral', 'Positive'][predicted_class]}")
|