StephanAkkerman's picture
Update README.md
c079da7 verified
metadata
license: mit
datasets:
  - TimKoornstra/financial-tweets-sentiment
language:
  - en
metrics:
  - accuracy
  - f1
pipeline_tag: text-classification
tags:
  - sentiment
  - finance
  - sentiment-analysis
  - financial-sentiment-analysis
  - twitter
  - tweets
  - stocks
  - stock-market
  - crypto
  - cryptocurrency
base_model: StephanAkkerman/FinTwitBERT
widget:
  - text: "Nice 9% pre market move for $para, pump my calls Uncle\_Buffett\_🤑"
    example_title: Bullish Crypto Tweet
  - text: It is about damn time that my $ARB and $ETH bags pump FFS. 🚀
    example_title: Bullish Crypto Tweet 2
  - text: >-
      $SPY $SPX closed higher 8th consecutive weeks. Last time it closed 9th
      straight was 20 years ago.
    example_title: Bullish Stock Tweet
  - text: >-
      $TCBP Lowest float stock in the market. Float just 325k. Don’t sell for
      pennies, this one will be a monster. Still early
    example_title: Bullish Stock Tweet 2
  - text: Italian companies braced for more political uncertainty
    example_title: Bearish News

FinTwitBERT-sentiment

FinTwitBERT-sentiment is a finetuned model for classifying the sentiment of financial tweets. It uses FinTwitBERT as a base model, which has been pre-trained on 1 million financial tweets. 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. Therefore this model performs great on informal financial texts, seen on social media.

Intended Uses

FinTwitBERT-sentiment is intended for classifying financial tweets or other financial social media texts.

More Information

For a comprehensive overview, including the training setup and analysis of the model, visit the FinTwitBERT GitHub repository.

Usage

Using HuggingFace's transformers library the model and tokenizers can be converted into a pipeline for text classification.

from transformers import BertForSequenceClassification, AutoTokenizer, pipeline

model = BertForSequenceClassification.from_pretrained(
    "StephanAkkerman/FinTwitBERT-sentiment",
    num_labels=3,
    id2label={0: "NEUTRAL", 1: "BULLISH", 2: "BEARISH"},
    label2id={"NEUTRAL": 0, "BULLISH": 1, "BEARISH": 2},
)
model.config.problem_type = "single_label_classification"
tokenizer = AutoTokenizer.from_pretrained(
    "StephanAkkerman/FinTwitBERT-sentiment"
)
model.eval()
pipeline = pipeline(
    "text-classification", model=model, tokenizer=tokenizer
)

# Sentences we want the sentiment for
sentence = ["Nice 9% pre market move for $para, pump my calls Uncle Buffett 🤑"]

# Get the predicted sentiment
print(pipeline(sentence))

Training

The model was trained with the following parameters:

Citing & Authors

If you use FinTwitBERT or FinTwitBERT-sentiment in your research, please cite us as follows, noting that both authors contributed equally to this work:

@misc{FinTwitBERT,
  author = {Stephan Akkerman, Tim Koornstra},
  title = {FinTwitBERT: A Specialized Language Model for Financial Tweets},
  year = {2023},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/TimKoornstra/FinTwitBERT}}
}

License

This project is licensed under the MIT License. See the LICENSE file for details.