Update README.md
Browse files
README.md
CHANGED
@@ -15,4 +15,81 @@ tags:
|
|
15 |
- finance
|
16 |
- english
|
17 |
- text-classification
|
18 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
- finance
|
16 |
- english
|
17 |
- text-classification
|
18 |
+
---
|
19 |
+
|
20 |
+
# FinanceBERT
|
21 |
+
|
22 |
+
FinanceBERT is a transformer-based model specifically fine-tuned for sentiment analysis in the financial sector. It's designed to assess sentiments expressed in financial texts, aiding stakeholders in making data-driven financial decisions.
|
23 |
+
|
24 |
+
## Model Description
|
25 |
+
|
26 |
+
FinanceBERT uses the BERT architecture, renowned for its deep contextual understanding. This model helps analyze sentiments in financial news articles, reports, and social media content, categorizing them into positive, negative, or neutral sentiments.
|
27 |
+
|
28 |
+
## How to Use
|
29 |
+
|
30 |
+
To use FinanceBERT, you can load it with the Transformers library:
|
31 |
+
|
32 |
+
```python
|
33 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
34 |
+
import torch
|
35 |
+
|
36 |
+
tokenizer = AutoTokenizer.from_pretrained('marev/financebert')
|
37 |
+
model = AutoModelForSequenceClassification.from_pretrained('marcev/financebert')
|
38 |
+
|
39 |
+
def predict(text):
|
40 |
+
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
|
41 |
+
outputs = model(**inputs)
|
42 |
+
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
|
43 |
+
return predictions
|
44 |
+
|
45 |
+
text = "Your sample text here."
|
46 |
+
predict(text)
|
47 |
+
```
|
48 |
+
|
49 |
+
# Evaluation Results
|
50 |
+
FinanceBERT was evaluated on a held-out test set and achieved the following performance metrics:
|
51 |
+
|
52 |
+
- Accuracy: 92%
|
53 |
+
- F1-Score (Weighted): 92%
|
54 |
+
- Evaluation Loss: 0.320
|
55 |
+
|
56 |
+
|
57 |
+
# Detailed Performance Metrics
|
58 |
+
|
59 |
+
Classification Report:
|
60 |
+
|
61 |
+
class_index: 0
|
62 |
+
- precision: 0.84
|
63 |
+
- recall: 0.90
|
64 |
+
- f1_score: 0.87
|
65 |
+
- support: 29
|
66 |
+
class_index: 1
|
67 |
+
- precision: 0.94
|
68 |
+
- recall: 0.94
|
69 |
+
- f1_score: 0.94
|
70 |
+
- support: 199
|
71 |
+
class_index: 2
|
72 |
+
- precision: 0.90
|
73 |
+
- recall: 0.88
|
74 |
+
- f1_score: 0.89
|
75 |
+
- support: 83
|
76 |
+
|
77 |
+
Confusion Matrix:
|
78 |
+
- actual_0: [26, 2, 1]
|
79 |
+
- actual_1: [4, 188, 7]
|
80 |
+
- actual_2: [1, 9, 73]
|
81 |
+
|
82 |
+
|
83 |
+
# Limitations
|
84 |
+
FinanceBERT has been rigorously trained and tested to ensure reliable performance across a variety of financial texts. However, there are several limitations to consider:
|
85 |
+
|
86 |
+
- Domain Specificity: Optimized for financial contexts, may not perform well on non-financial texts.
|
87 |
+
- Language Support: Currently supports English only.
|
88 |
+
- Data Bias: Reflects the bias inherent in its training data, which may not include diverse global financial perspectives.
|
89 |
+
- Interpretability: As a deep learning model, it does not offer easy interpretability of its decision-making process.
|
90 |
+
|
91 |
+
# License
|
92 |
+
This model is released under the GNU General Public License v3.0 (GPL-3.0), requiring that modifications and derivatives remain open source under the same license.
|
93 |
+
|
94 |
+
# Acknowledgements
|
95 |
+
FinanceBERT was developed using the Transformers library by Hugging Face, trained on a curated dataset of financial texts.
|