Update README.md
Browse files
README.md
CHANGED
|
@@ -11,15 +11,16 @@ language:
|
|
| 11 |
# Amazon Reviews Sentiment Analysis Model
|
| 12 |
|
| 13 |
## Model Description
|
| 14 |
-
This model is a **sentiment analysis model**
|
| 15 |
-
It
|
| 16 |
-
*
|
| 17 |
-
* NLP experimentation
|
| 18 |
-
* Academic projects
|
| 19 |
-
* Non-commercial applications
|
| 20 |
|
| 21 |
-
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
---
|
| 24 |
|
| 25 |
## Intended Use
|
|
@@ -27,27 +28,27 @@ The model is based on a **Transformer architecture (BERT-based)** and fine-tuned
|
|
| 27 |
### ✅ Allowed Uses
|
| 28 |
* Academic research
|
| 29 |
* Educational projects
|
| 30 |
-
* Personal
|
| 31 |
* Non-commercial applications
|
| 32 |
-
*
|
| 33 |
|
| 34 |
### ❌ Prohibited Uses
|
| 35 |
* Commercial use
|
| 36 |
* Selling or reselling the model
|
| 37 |
-
*
|
| 38 |
-
*
|
| 39 |
|
| 40 |
-
|
| 41 |
|
| 42 |
---
|
| 43 |
|
| 44 |
## Training Data
|
| 45 |
-
|
| 46 |
* Language: English
|
| 47 |
* Domain: E-commerce product reviews
|
| 48 |
* Data type: Text reviews with sentiment labels
|
| 49 |
|
| 50 |
-
The original dataset creators retain
|
| 51 |
|
| 52 |
---
|
| 53 |
|
|
@@ -56,11 +57,9 @@ The original dataset creators retain their respective rights. Please refer to th
|
|
| 56 |
* Framework: Hugging Face Transformers
|
| 57 |
* Number of labels: 3
|
| 58 |
* Loss Function: Cross-entropy loss
|
| 59 |
-
* Training
|
| 60 |
|
| 61 |
### Label Mapping
|
| 62 |
-
The sentiment labels used by the model are mapped as follows:
|
| 63 |
-
|
| 64 |
| Label ID | Sentiment |
|
| 65 |
| -------- | --------- |
|
| 66 |
| 0 | Negative |
|
|
@@ -70,59 +69,45 @@ The sentiment labels used by the model are mapped as follows:
|
|
| 70 |
---
|
| 71 |
|
| 72 |
## Evaluation
|
| 73 |
-
|
| 74 |
* Negative
|
| 75 |
* Neutral
|
| 76 |
* Positive
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
* Recall
|
| 81 |
-
* F1-score
|
| 82 |
-
* Support (per class)
|
| 83 |
-
|
| 84 |
-
The classification report was generated using standard tools such as `sklearn.metrics.classification_report`.
|
| 85 |
-
Performance may vary depending on product category, writing style, and domain shift.
|
| 86 |
|
| 87 |
---
|
| 88 |
|
| 89 |
## Limitations and Bias
|
| 90 |
-
*
|
| 91 |
-
*
|
| 92 |
-
* Not suitable for
|
| 93 |
-
*
|
| 94 |
-
|
| 95 |
-
Users are encouraged to evaluate the model on their own datasets before deployment.
|
| 96 |
-
|
| 97 |
---
|
| 98 |
|
| 99 |
## Ethical Considerations
|
| 100 |
-
|
| 101 |
-
* Predictions should not be treated as factual judgments
|
| 102 |
-
* Not intended for high-stakes decision-making
|
| 103 |
|
| 104 |
---
|
| 105 |
|
| 106 |
## How to Use
|
| 107 |
-
|
| 108 |
```python
|
| 109 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 110 |
import torch
|
| 111 |
|
| 112 |
-
model_name = "mianzaka/sentiment-analysis-model
|
| 113 |
|
| 114 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 115 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 116 |
|
| 117 |
text = "The product quality is decent but delivery was slow."
|
| 118 |
-
|
| 119 |
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
|
| 120 |
|
| 121 |
with torch.no_grad():
|
| 122 |
outputs = model(**inputs)
|
| 123 |
|
| 124 |
predicted_label = torch.argmax(outputs.logits, dim=1).item()
|
| 125 |
-
|
| 126 |
label_map = {0: "Negative", 1: "Neutral", 2: "Positive"}
|
| 127 |
print("Predicted sentiment:", label_map[predicted_label])
|
| 128 |
```
|
|
@@ -130,25 +115,22 @@ print("Predicted sentiment:", label_map[predicted_label])
|
|
| 130 |
---
|
| 131 |
|
| 132 |
## License
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
For more details, see the full license text: [https://creativecommons.org/licenses/by-nc/4.0/](https://creativecommons.org/licenses/by-nc/4.0/)
|
| 136 |
|
| 137 |
---
|
| 138 |
|
| 139 |
## Citation
|
| 140 |
-
If you use this model in your research or projects, please cite:
|
| 141 |
-
|
| 142 |
```bibtex
|
| 143 |
@misc{sentiment-analysis-model,
|
| 144 |
-
author
|
| 145 |
-
title
|
| 146 |
-
year
|
| 147 |
-
publisher
|
| 148 |
}
|
| 149 |
```
|
| 150 |
|
| 151 |
---
|
| 152 |
|
| 153 |
## Contact
|
| 154 |
-
For questions
|
|
|
|
| 11 |
# Amazon Reviews Sentiment Analysis Model
|
| 12 |
|
| 13 |
## Model Description
|
| 14 |
+
This model is a **sentiment analysis model** fine-tuned using **BertForSequenceClassification** on the **Amazon Reviews dataset**.
|
| 15 |
+
It classifies Amazon product reviews into sentiment categories: negative, neutral, or positive.
|
| 16 |
+
Intended for **research, educational, and non-commercial use only**.
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
---
|
| 19 |
|
| 20 |
+
## Base Model
|
| 21 |
+
* **bert-base-uncased**
|
| 22 |
+
* Architecture: Transformer (BERT)
|
| 23 |
+
* Head: Sequence Classification
|
| 24 |
---
|
| 25 |
|
| 26 |
## Intended Use
|
|
|
|
| 28 |
### ✅ Allowed Uses
|
| 29 |
* Academic research
|
| 30 |
* Educational projects
|
| 31 |
+
* Personal learning
|
| 32 |
* Non-commercial applications
|
| 33 |
+
* Experiments and benchmarking
|
| 34 |
|
| 35 |
### ❌ Prohibited Uses
|
| 36 |
* Commercial use
|
| 37 |
* Selling or reselling the model
|
| 38 |
+
* Paid APIs or SaaS products
|
| 39 |
+
* Monetized applications or services
|
| 40 |
|
| 41 |
+
Commercial use is **strictly prohibited** under the CC BY-NC 4.0 license.
|
| 42 |
|
| 43 |
---
|
| 44 |
|
| 45 |
## Training Data
|
| 46 |
+
Trained on the **Amazon Reviews dataset**:
|
| 47 |
* Language: English
|
| 48 |
* Domain: E-commerce product reviews
|
| 49 |
* Data type: Text reviews with sentiment labels
|
| 50 |
|
| 51 |
+
The original dataset creators retain all rights to the data. Users should consult the dataset’s original license for details.
|
| 52 |
|
| 53 |
---
|
| 54 |
|
|
|
|
| 57 |
* Framework: Hugging Face Transformers
|
| 58 |
* Number of labels: 3
|
| 59 |
* Loss Function: Cross-entropy loss
|
| 60 |
+
* Training performed on GPU if available, otherwise CPU
|
| 61 |
|
| 62 |
### Label Mapping
|
|
|
|
|
|
|
| 63 |
| Label ID | Sentiment |
|
| 64 |
| -------- | --------- |
|
| 65 |
| 0 | Negative |
|
|
|
|
| 69 |
---
|
| 70 |
|
| 71 |
## Evaluation
|
| 72 |
+
Evaluated using a **multi-class classification report** with three categories:
|
| 73 |
* Negative
|
| 74 |
* Neutral
|
| 75 |
* Positive
|
| 76 |
|
| 77 |
+
Metrics include precision, recall, F1-score, and support (per class).
|
| 78 |
+
Performance may vary depending on product category and review style.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
---
|
| 81 |
|
| 82 |
## Limitations and Bias
|
| 83 |
+
* Reflects biases in Amazon reviews
|
| 84 |
+
* May not perform well on non-product text
|
| 85 |
+
* Not suitable for non-English languages
|
| 86 |
+
* Predictions are subjective, not factual judgments
|
|
|
|
|
|
|
|
|
|
| 87 |
---
|
| 88 |
|
| 89 |
## Ethical Considerations
|
| 90 |
+
Analyze subjective content only; not for high-stakes decisions.
|
|
|
|
|
|
|
| 91 |
|
| 92 |
---
|
| 93 |
|
| 94 |
## How to Use
|
|
|
|
| 95 |
```python
|
| 96 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 97 |
import torch
|
| 98 |
|
| 99 |
+
model_name = "mianzaka/sentiment-analysis-model"
|
| 100 |
|
| 101 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 102 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 103 |
|
| 104 |
text = "The product quality is decent but delivery was slow."
|
|
|
|
| 105 |
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
|
| 106 |
|
| 107 |
with torch.no_grad():
|
| 108 |
outputs = model(**inputs)
|
| 109 |
|
| 110 |
predicted_label = torch.argmax(outputs.logits, dim=1).item()
|
|
|
|
| 111 |
label_map = {0: "Negative", 1: "Neutral", 2: "Positive"}
|
| 112 |
print("Predicted sentiment:", label_map[predicted_label])
|
| 113 |
```
|
|
|
|
| 115 |
---
|
| 116 |
|
| 117 |
## License
|
| 118 |
+
Released under **CC BY-NC 4.0**. Commercial use, resale, or monetization is prohibited.
|
| 119 |
+
Full license: [https://creativecommons.org/licenses/by-nc/4.0/](https://creativecommons.org/licenses/by-nc/4.0/)
|
|
|
|
| 120 |
|
| 121 |
---
|
| 122 |
|
| 123 |
## Citation
|
|
|
|
|
|
|
| 124 |
```bibtex
|
| 125 |
@misc{sentiment-analysis-model,
|
| 126 |
+
author = {Mian Zaka},
|
| 127 |
+
title = {Amazon Reviews Sentiment Analysis Model},
|
| 128 |
+
year = {2026},
|
| 129 |
+
publisher = {Hugging Face}
|
| 130 |
}
|
| 131 |
```
|
| 132 |
|
| 133 |
---
|
| 134 |
|
| 135 |
## Contact
|
| 136 |
+
For questions or feedback, contact the model author via Hugging Face.
|