Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,138 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
metrics:
|
6 |
+
- accuracy
|
7 |
+
- precision
|
8 |
+
- recall
|
9 |
+
- f1
|
10 |
+
tags:
|
11 |
+
- code
|
12 |
---
|
13 |
+
|
14 |
+
# Model Card for Sentiment Analysis on Primate Dataset
|
15 |
+
|
16 |
+
This model card provides details about a sentiment analysis model trained on a dataset containing posts related to primates. The model predicts sentiment labels for textual data using transformer-based architectures.
|
17 |
+
|
18 |
+
## Model Details
|
19 |
+
|
20 |
+
### Model Description
|
21 |
+
|
22 |
+
The sentiment analysis model aims to classify text data into sentiment categories such as positive, negative, or neutral. It utilizes transformer-based architectures for sequence classification.
|
23 |
+
|
24 |
+
- **Developed by:** Jaskaran Singh
|
25 |
+
- **Model type:** Transformer-based sentiment analysis model
|
26 |
+
- **Language(s) (NLP):** English
|
27 |
+
- **License:** MIT
|
28 |
+
- **Finetuned from model:** Transformer-based pre-trained model
|
29 |
+
|
30 |
+
### Model Sources
|
31 |
+
|
32 |
+
- **Repository:** https://github.com/JaskaranSingh-01/Sentiment_Analyzer
|
33 |
+
- **Demo:** https://sentimentanalyzer-f76oxwautwypxpea4lj3wg.streamlit.app/
|
34 |
+
|
35 |
+
## Uses
|
36 |
+
|
37 |
+
### Direct Use
|
38 |
+
|
39 |
+
The model can be directly used for sentiment analysis tasks, particularly on textual data related to primates.
|
40 |
+
|
41 |
+
### Downstream Use
|
42 |
+
|
43 |
+
The model can be fine-tuned for specific downstream tasks or integrated into larger applications requiring sentiment analysis functionality.
|
44 |
+
|
45 |
+
## Bias, Risks, and Limitations
|
46 |
+
|
47 |
+
### Bias
|
48 |
+
|
49 |
+
The model's predictions may reflect biases present in the training data, including any biases related to primates or sentiment labeling.
|
50 |
+
|
51 |
+
### Risks
|
52 |
+
|
53 |
+
- Misclassification: The model may misclassify sentiment due to ambiguity or complexity in the text.
|
54 |
+
- Generalization: The model's performance may vary across different domains or datasets.
|
55 |
+
|
56 |
+
### Limitations
|
57 |
+
|
58 |
+
- Limited Domain: The model's effectiveness may be limited to text related to primates.
|
59 |
+
- Cultural Bias: The model's performance may be influenced by cultural nuances present in the training data.
|
60 |
+
|
61 |
+
## Recommendations
|
62 |
+
|
63 |
+
Users should be cautious when interpreting the model's predictions, considering potential biases and limitations. Fine-tuning on domain-specific data or applying post-processing techniques may help mitigate biases and improve performance.
|
64 |
+
|
65 |
+
## How to Get Started with the Model
|
66 |
+
|
67 |
+
```python
|
68 |
+
# Example code for using the sentiment analysis model
|
69 |
+
|
70 |
+
# 1. Load the model and tokenizer
|
71 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
72 |
+
|
73 |
+
tokenizer = AutoTokenizer.from_pretrained("sbcBI/sentiment_analysis_model")
|
74 |
+
model = AutoModelForSequenceClassification.from_pretrained("sbcBI/sentiment_analysis_model")
|
75 |
+
|
76 |
+
# 2. Tokenize input text
|
77 |
+
text = "Sample text for sentiment analysis"
|
78 |
+
encoded_input = tokenizer(text, return_tensors='pt')
|
79 |
+
|
80 |
+
# 3. Perform inference
|
81 |
+
output = model(**encoded_input)
|
82 |
+
predicted_label = output.logits.argmax().item()
|
83 |
+
|
84 |
+
# 4. Interpret prediction
|
85 |
+
sentiment_labels = ['Negative', 'Neutral', 'Positive']
|
86 |
+
print("Predicted Sentiment:", sentiment_labels[predicted_label])
|
87 |
+
```
|
88 |
+
|
89 |
+
## Training Details
|
90 |
+
|
91 |
+
### Training Data
|
92 |
+
|
93 |
+
The training data consists of posts related to primates, annotated with sentiment labels.
|
94 |
+
|
95 |
+
### Training Procedure
|
96 |
+
|
97 |
+
#### Preprocessing
|
98 |
+
|
99 |
+
Text data underwent preprocessing steps including lowercase conversion, punctuation removal, tokenization, stopword removal, and stemming.
|
100 |
+
|
101 |
+
#### Training Hyperparameters
|
102 |
+
|
103 |
+
- **Training regime:** Fine-tuning of transformer-based pre-trained model
|
104 |
+
- **Optimizer:** Adam optimizer
|
105 |
+
- **Learning rate:** 5e-5
|
106 |
+
- **Batch size:** 8
|
107 |
+
- **Epochs:** 10
|
108 |
+
|
109 |
+
### Evaluation
|
110 |
+
|
111 |
+
#### Testing Data, Factors & Metrics
|
112 |
+
|
113 |
+
- **Testing Data:** Holdout test set
|
114 |
+
- **Metrics:** Accuracy, Precision, Recall, F1-score
|
115 |
+
|
116 |
+
#### Results
|
117 |
+
|
118 |
+
- **Accuracy:** 0.79
|
119 |
+
- **Precision:** 0.74
|
120 |
+
- **Recall:** 0.77
|
121 |
+
- **F1-score:** 0.75
|
122 |
+
|
123 |
+
## Environmental Impact
|
124 |
+
|
125 |
+
Carbon emissions were not directly measured for model training. However, users should consider the environmental impact of training and deploying machine learning models, especially on large-scale infrastructure.
|
126 |
+
|
127 |
+
## Technical Specifications
|
128 |
+
|
129 |
+
### Model Architecture and Objective
|
130 |
+
|
131 |
+
The model architecture is based on transformer-based architectures, specifically designed for sequence classification tasks such as sentiment analysis.
|
132 |
+
|
133 |
+
### Compute Infrastructure
|
134 |
+
|
135 |
+
#### Software
|
136 |
+
|
137 |
+
- **Framework:** PyTorch
|
138 |
+
- **Dependencies:** Transformers, NLTK
|