farhanage commited on
Commit
16ebaf5
·
1 Parent(s): db6fc64

updated model card

Browse files
Files changed (1) hide show
  1. README.md +134 -0
README.md CHANGED
@@ -1,3 +1,137 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ language:
4
+ - en
5
+ tags:
6
+ - financial-nlp
7
+ - sentiment-analysis
8
+ - topic-classification
9
+ - multitask-learning
10
+ - bert
11
+ - financial-news
12
+ library_name: transformers
13
+ pipeline_tag: text-classification
14
+ datasets:
15
+ - financial-news
16
+ metrics:
17
+ - accuracy
18
+ - f1
19
+ - precision
20
+ - recall
21
  ---
22
+
23
+ # Multi-Task BERT for Financial News Topic Classification and Sentiment Analysis
24
+
25
+ ## Model Description
26
+
27
+ This model is a multi-task BERT-based architecture designed to simultaneously perform topic classification and sentiment analysis on financial news text. The model leverages shared representations to improve performance on both tasks through multi-task learning.
28
+
29
+ ## Model Details
30
+
31
+ - **Model Type**: Multi-task BERT for text classification
32
+ - **Language**: English
33
+ - **License**: MIT
34
+ - **Tasks**:
35
+ - Topic Classification (financial news categories)
36
+ - Sentiment Analysis (positive, negative, neutral)
37
+
38
+ ## Intended Uses
39
+
40
+ ### Direct Use
41
+
42
+ This model can be used for:
43
+ - Analyzing sentiment in financial news articles
44
+ - Classifying financial news into relevant topics/categories
45
+ - Automated content analysis for financial research
46
+ - Risk assessment based on news sentiment
47
+
48
+ ### Downstream Use
49
+
50
+ The model can be fine-tuned for:
51
+ - Specific financial domains (stocks, forex, commodities)
52
+ - Custom topic taxonomies
53
+ - Different sentiment granularities
54
+
55
+ ## How to Use
56
+
57
+ ```python
58
+ import torch
59
+ import pickle
60
+ from transformers import AutoTokenizer, AutoModel
61
+
62
+ # Load the model
63
+ with open('multitask_bert_model.pkl', 'rb') as f:
64
+ model = pickle.load(f)
65
+
66
+ # Load tokenizer (adjust model name as needed)
67
+ tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased')
68
+
69
+ # Example usage
70
+ text = "Apple stock rises 5% after strong quarterly earnings report"
71
+ inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=512)
72
+
73
+ # Get predictions (adjust based on your model's output format)
74
+ with torch.no_grad():
75
+ outputs = model(**inputs)
76
+ # Process outputs for topic and sentiment predictions
77
+ ```
78
+
79
+ ## Training Data
80
+
81
+ The model was trained on financial news data for multi-task learning. The training involved:
82
+ - Topic classification task
83
+ - Sentiment analysis task
84
+ - Joint optimization with shared BERT representations
85
+
86
+ ## Training Procedure
87
+
88
+ ### Training Hyperparameters
89
+
90
+ - **Training regime**: Multi-task learning with shared encoder
91
+ - **Model variants**:
92
+ - `multitask_bert_model.pkl`: Base model
93
+ - `multitask_bert_model_weight.pth`: Weighted version
94
+ - `multitask_bert_model_imbalanced.pth`: Version trained on imbalanced data
95
+
96
+ ### Training Details
97
+
98
+ The model uses a shared BERT encoder with task-specific classification heads for topic classification and sentiment analysis. The multi-task approach allows the model to learn shared representations that benefit both tasks.
99
+
100
+ ## Evaluation
101
+
102
+ ### Testing Data & Metrics
103
+
104
+ The model should be evaluated on:
105
+ - **Topic Classification**: Accuracy, F1-score, Precision, Recall
106
+ - **Sentiment Analysis**: Accuracy, F1-score, Precision, Recall
107
+
108
+ ### Results
109
+
110
+ [Add your evaluation results here]
111
+
112
+ | Task | Metric | Score |
113
+ |------|--------|-------|
114
+ | Topic Classification | Accuracy | 0.76 |
115
+ | Sentiment Analysis | Accuracy | 0.87 |
116
+
117
+ ## Limitations and Bias
118
+
119
+ ### Limitations
120
+
121
+ - Performance may vary on financial news from different time periods
122
+ - Model may not generalize well to non-financial text
123
+ - Limited to English language text
124
+ - Performance depends on the quality and diversity of training data
125
+
126
+ ### Bias Considerations
127
+
128
+ - Model may reflect biases present in financial news training data
129
+ - Sentiment predictions may be influenced by market conditions during training
130
+ - Topic classifications may favor certain financial sectors represented in training data
131
+
132
+ ## Technical Specifications
133
+
134
+ ### Model Architecture
135
+
136
+ - **Base Model**: BERT
137
+ - **Architecture**: Multi-task learning with shared encoder