Commit ·
9872c2a
1
Parent(s): 8746881
Update README.md
Browse files
README.md
CHANGED
|
@@ -9,13 +9,81 @@ metrics:
|
|
| 9 |
- f1
|
| 10 |
pipeline_tag: text-classification
|
| 11 |
tags:
|
| 12 |
-
- finance
|
| 13 |
- sentiment
|
|
|
|
| 14 |
- sentiment-analysis
|
| 15 |
-
-
|
| 16 |
- twitter
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
base_model: StephanAkkerman/FinTwitBERT
|
| 18 |
---
|
| 19 |
|
| 20 |
# FinTwitBERT-sentiment
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
- f1
|
| 10 |
pipeline_tag: text-classification
|
| 11 |
tags:
|
|
|
|
| 12 |
- sentiment
|
| 13 |
+
- finance
|
| 14 |
- sentiment-analysis
|
| 15 |
+
- financial-sentiment-analysis
|
| 16 |
- twitter
|
| 17 |
+
- tweets
|
| 18 |
+
- stocks
|
| 19 |
+
- stock-market
|
| 20 |
+
- crypto
|
| 21 |
+
- cryptocurrency
|
| 22 |
base_model: StephanAkkerman/FinTwitBERT
|
| 23 |
---
|
| 24 |
|
| 25 |
# FinTwitBERT-sentiment
|
| 26 |
+
|
| 27 |
+
FinTwitBERT-sentiment is a finetuned model for classifying the sentiment of financial tweets. It uses [FinTwitBERT](https://huggingface.co/StephanAkkerman/FinTwitBERT) as a base model, which has been pre-trained on 1 million financial tweets.
|
| 28 |
+
This approach ensures that the FinTwitBERT-sentiment has seen enough financial tweets, which have an informal nature, compared to other financial texts, such as news headlines.
|
| 29 |
+
Therefore this model performs great on informal financial texts, seen on social media.
|
| 30 |
+
|
| 31 |
+
## Intended Uses
|
| 32 |
+
|
| 33 |
+
FinTwitBERT-sentiment is intended for classifying financial tweets or other financial social media texts.
|
| 34 |
+
|
| 35 |
+
## More Information
|
| 36 |
+
|
| 37 |
+
For a comprehensive overview, including the training setup and analysis of the model, visit the [FinTwitBERT GitHub repository](https://github.com/TimKoornstra/FinTwitBERT).
|
| 38 |
+
|
| 39 |
+
## Usage
|
| 40 |
+
|
| 41 |
+
Using [HuggingFace's transformers library](https://huggingface.co/docs/transformers/index) the model and tokenizers can be converted into a pipeline for text classification.
|
| 42 |
+
|
| 43 |
+
```python
|
| 44 |
+
from transformers import BertForSequenceClassification, AutoTokenizer, pipeline
|
| 45 |
+
|
| 46 |
+
model = BertForSequenceClassification.from_pretrained(
|
| 47 |
+
"StephanAkkerman/FinTwitBERT-sentiment",
|
| 48 |
+
num_labels=3,
|
| 49 |
+
id2label={0: "NEUTRAL", 1: "BULLISH", 2: "BEARISH"},
|
| 50 |
+
label2id={"NEUTRAL": 0, "BULLISH": 1, "BEARISH": 2},
|
| 51 |
+
)
|
| 52 |
+
model.config.problem_type = "single_label_classification"
|
| 53 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
| 54 |
+
"StephanAkkerman/FinTwitBERT-sentiment"
|
| 55 |
+
)
|
| 56 |
+
model.eval()
|
| 57 |
+
pipeline = pipeline(
|
| 58 |
+
"text-classification", model=model, tokenizer=tokenizer
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
# Sentences we want the sentiment for
|
| 62 |
+
sentence = ["I love you"]
|
| 63 |
+
|
| 64 |
+
# Get the predicted sentiment
|
| 65 |
+
print(pipeline(sentence))
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
## Training
|
| 69 |
+
|
| 70 |
+
The model was trained with the following parameters:
|
| 71 |
+
|
| 72 |
+
## Citing & Authors
|
| 73 |
+
|
| 74 |
+
If you use FinTwitBERT or FinTwitBERT-sentiment in your research, please cite us as follows, noting that both authors contributed equally to this work:
|
| 75 |
+
|
| 76 |
+
```bibtex
|
| 77 |
+
@misc{FinTwitBERT,
|
| 78 |
+
author = {Stephan Akkerman, Tim Koornstra},
|
| 79 |
+
title = {FinTwitBERT: A Specialized Language Model for Financial Tweets},
|
| 80 |
+
year = {2023},
|
| 81 |
+
publisher = {GitHub},
|
| 82 |
+
journal = {GitHub repository},
|
| 83 |
+
howpublished = {\url{https://github.com/TimKoornstra/FinTwitBERT}}
|
| 84 |
+
}
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
## License
|
| 88 |
+
|
| 89 |
+
This project is licensed under the MIT License. See the [LICENSE](https://choosealicense.com/licenses/mit/) file for details.
|