financial-sentiment-bert-large

Model Description

BERT-Large financial sentiment analysis model with high accuracy

This model is fine-tuned from bert-large-uncased for financial sentiment analysis, capable of classifying financial text into three categories:

  • Bearish (0): Negative financial sentiment
  • Neutral (1): Neutral financial sentiment
  • Bullish (2): Positive financial sentiment

Model Performance

  • Accuracy: 0.843
  • Dataset: Twitter Financial News Sentiment
  • Base Model: bert-large-uncased

Usage

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("codealchemist01/financial-sentiment-bert-large")
model = AutoModelForSequenceClassification.from_pretrained("codealchemist01/financial-sentiment-bert-large")

# Example usage
text = "Apple stock is showing strong growth potential"
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)

with torch.no_grad():
    outputs = model(**inputs)
    predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
    predicted_class = torch.argmax(predictions, dim=-1).item()

# Labels: 0=Bearish, 1=Neutral, 2=Bullish
labels = ["Bearish", "Neutral", "Bullish"]
print(f"Prediction: {labels[predicted_class]}")

Training Details

  • Training Dataset: Twitter Financial News Sentiment
  • Training Framework: Transformers
  • Optimization: AdamW
  • Hardware: RTX GPU

Limitations

This model is specifically trained for financial sentiment analysis and may not perform well on general sentiment analysis tasks.

Citation

If you use this model, please cite:

@misc{financial-sentiment-large,
  author = {CodeAlchemist01},
  title = {financial-sentiment-bert-large},
  year = {2024},
  publisher = {Hugging Face},
  url = {https://huggingface.co/codealchemist01/financial-sentiment-bert-large}
}
Downloads last month
13
Safetensors
Model size
0.3B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train codealchemist01/financial-sentiment-bert-large

Space using codealchemist01/financial-sentiment-bert-large 1

Evaluation results