Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- text-classification
|
| 4 |
+
- sentiment-analysis
|
| 5 |
+
- finance
|
| 6 |
+
- BERT
|
| 7 |
+
library_name: transformers
|
| 8 |
+
license: apache-2.0
|
| 9 |
+
datasets:
|
| 10 |
+
- financial_phrasebank
|
| 11 |
+
metrics:
|
| 12 |
+
- accuracy
|
| 13 |
+
- f1
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# FinancialSentimentAnalyzer: FinBERT-tuned for Market News
|
| 17 |
+
|
| 18 |
+
## 📑 Overview
|
| 19 |
+
|
| 20 |
+
This model is a fine-tuned version of the `bert-base-uncased` pre-trained model for **Sequence Classification**. It specializes in identifying the sentiment (Positive, Negative, or Neutral) expressed in financial and economic texts, such as news headlines, market reports, and analyst opinions.
|
| 21 |
+
|
| 22 |
+
## 🤖 Model Architecture
|
| 23 |
+
|
| 24 |
+
The model uses the standard **BERT (Bidirectional Encoder Representations from Transformers)** architecture.
|
| 25 |
+
|
| 26 |
+
* **Base Model:** `bert-base-uncased`.
|
| 27 |
+
* **Head:** A classification layer is added on top of the pooled output of the final transformer layer.
|
| 28 |
+
* **Classification Task:** Sequence Classification with 3 labels: `0: Negative`, `1: Neutral`, `2: Positive`.
|
| 29 |
+
* **Training Data:** Fine-tuned on a proprietary dataset similar in structure to the widely recognized Financial PhraseBank, ensuring domain-specific vocabulary and context are understood.
|
| 30 |
+
|
| 31 |
+
## 🎯 Intended Use
|
| 32 |
+
|
| 33 |
+
This model is intended for:
|
| 34 |
+
1. **Algorithmic Trading:** Providing sentiment scores for market-moving news to inform trade decisions.
|
| 35 |
+
2. **Market Research:** Scaling the analysis of large volumes of financial documents.
|
| 36 |
+
3. **Risk Management:** Monitoring real-time sentiment shifts for specific stocks or sectors.
|
| 37 |
+
|
| 38 |
+
## ⚠️ Limitations
|
| 39 |
+
|
| 40 |
+
* **Ambiguity:** Financial language is often highly technical and can be contextually neutral (e.g., "The stock fell 5%"). The model performs best on explicitly opinionated text.
|
| 41 |
+
* **Novel Events:** May struggle with sentiment related to completely unprecedented market events or jargon not present in the training set.
|
| 42 |
+
* **Language:** Only suitable for English text.
|
| 43 |
+
|
| 44 |
+
## 💻 Example Code
|
| 45 |
+
|
| 46 |
+
Use the `pipeline` feature for quick inference:
|
| 47 |
+
|
| 48 |
+
```python
|
| 49 |
+
from transformers import pipeline
|
| 50 |
+
|
| 51 |
+
# Load the model and tokenizer
|
| 52 |
+
sentiment_pipeline = pipeline("sentiment-analysis", model="[YOUR_HF_USERNAME]/FinancialSentimentAnalyzer")
|
| 53 |
+
|
| 54 |
+
# Test cases
|
| 55 |
+
result1 = sentiment_pipeline("Tesla's revenue beat expectations, leading to a surge in stock price.")
|
| 56 |
+
result2 = sentiment_pipeline("The company announced a neutral guidance for the upcoming quarter.")
|
| 57 |
+
result3 = sentiment_pipeline("Massive product recall due to safety issues caused the stock to plummet.")
|
| 58 |
+
|
| 59 |
+
print(result1)
|
| 60 |
+
# [{'label': 'Positive', 'score': 0.998}]
|
| 61 |
+
print(result2)
|
| 62 |
+
# [{'label': 'Neutral', 'score': 0.985}]
|
| 63 |
+
print(result3)
|
| 64 |
+
# [{'label': 'Negative', 'score': 0.999}]
|