--- tags: - text-classification - sentiment-analysis - finance - BERT library_name: transformers license: apache-2.0 datasets: - financial_phrasebank metrics: - accuracy - f1 --- # FinancialSentimentAnalyzer: FinBERT-tuned for Market News ## 📑 Overview 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. ## 🤖 Model Architecture The model uses the standard **BERT (Bidirectional Encoder Representations from Transformers)** architecture. * **Base Model:** `bert-base-uncased`. * **Head:** A classification layer is added on top of the pooled output of the final transformer layer. * **Classification Task:** Sequence Classification with 3 labels: `0: Negative`, `1: Neutral`, `2: Positive`. * **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. ## 🎯 Intended Use This model is intended for: 1. **Algorithmic Trading:** Providing sentiment scores for market-moving news to inform trade decisions. 2. **Market Research:** Scaling the analysis of large volumes of financial documents. 3. **Risk Management:** Monitoring real-time sentiment shifts for specific stocks or sectors. ## ⚠️ Limitations * **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. * **Novel Events:** May struggle with sentiment related to completely unprecedented market events or jargon not present in the training set. * **Language:** Only suitable for English text. ## 💻 Example Code Use the `pipeline` feature for quick inference: ```python from transformers import pipeline # Load the model and tokenizer sentiment_pipeline = pipeline("sentiment-analysis", model="[YOUR_HF_USERNAME]/FinancialSentimentAnalyzer") # Test cases result1 = sentiment_pipeline("Tesla's revenue beat expectations, leading to a surge in stock price.") result2 = sentiment_pipeline("The company announced a neutral guidance for the upcoming quarter.") result3 = sentiment_pipeline("Massive product recall due to safety issues caused the stock to plummet.") print(result1) # [{'label': 'Positive', 'score': 0.998}] print(result2) # [{'label': 'Neutral', 'score': 0.985}] print(result3) # [{'label': 'Negative', 'score': 0.999}]