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by-nc-4.0
|
| 3 |
+
tags:
|
| 4 |
+
- sentiment-analysis
|
| 5 |
+
- text-classification
|
| 6 |
+
- nlp
|
| 7 |
+
language:
|
| 8 |
+
- en
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# Amazon Reviews Sentiment Analysis Model
|
| 12 |
+
|
| 13 |
+
## Model Description
|
| 14 |
+
This model is a **sentiment analysis model** trained on the **Amazon Reviews dataset** to classify customer reviews into sentiment categories (e.g., positive, negative, neutral depending on configuration).
|
| 15 |
+
It is designed for:
|
| 16 |
+
* Learning and research purposes
|
| 17 |
+
* NLP experimentation
|
| 18 |
+
* Academic projects
|
| 19 |
+
* Non-commercial applications
|
| 20 |
+
|
| 21 |
+
The model is based on a **Transformer architecture (BERT-based)** and fine-tuned specifically for sentiment classification tasks.
|
| 22 |
+
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
## Intended Use
|
| 26 |
+
|
| 27 |
+
### ✅ Allowed Uses
|
| 28 |
+
* Academic research
|
| 29 |
+
* Educational projects
|
| 30 |
+
* Personal experimentation
|
| 31 |
+
* Non-commercial applications
|
| 32 |
+
* Benchmarking and evaluation
|
| 33 |
+
|
| 34 |
+
### ❌ Prohibited Uses
|
| 35 |
+
* Commercial use
|
| 36 |
+
* Selling or reselling the model
|
| 37 |
+
* Monetized APIs or SaaS products
|
| 38 |
+
* Integration into paid software or services
|
| 39 |
+
|
| 40 |
+
> **Note:** Commercial use is strictly prohibited under the CC BY-NC 4.0 license.
|
| 41 |
+
|
| 42 |
+
---
|
| 43 |
+
|
| 44 |
+
## Training Data
|
| 45 |
+
The model was trained on the **Amazon Reviews dataset**, which contains user-generated product reviews and ratings from Amazon.
|
| 46 |
+
* Language: English
|
| 47 |
+
* Domain: E-commerce product reviews
|
| 48 |
+
* Data type: Text reviews with sentiment labels
|
| 49 |
+
|
| 50 |
+
The original dataset creators retain their respective rights. Please refer to the dataset’s original license and terms for more details.
|
| 51 |
+
|
| 52 |
+
---
|
| 53 |
+
|
| 54 |
+
## Training Procedure
|
| 55 |
+
* Model: BertForSequenceClassification
|
| 56 |
+
* Framework: Hugging Face Transformers
|
| 57 |
+
* Number of labels: 3
|
| 58 |
+
* Loss Function: Cross-entropy loss
|
| 59 |
+
* Training was performed using device-agnostic code (GPU if available, otherwise CPU)
|
| 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 |
|
| 67 |
+
| 1 | Neutral |
|
| 68 |
+
| 2 | Positive |
|
| 69 |
+
|
| 70 |
+
---
|
| 71 |
+
|
| 72 |
+
## Evaluation
|
| 73 |
+
The model was evaluated using a **multi-class classification report** with three sentiment categories:
|
| 74 |
+
* Negative
|
| 75 |
+
* Neutral
|
| 76 |
+
* Positive
|
| 77 |
+
|
| 78 |
+
Evaluation metrics include:
|
| 79 |
+
* Precision
|
| 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 |
+
* The model reflects biases present in Amazon user reviews
|
| 91 |
+
* Performance may degrade on non-product-related text
|
| 92 |
+
* Not suitable for languages other than English
|
| 93 |
+
* May not generalize well to informal or domain-specific slang
|
| 94 |
+
|
| 95 |
+
Users are encouraged to evaluate the model on their own datasets before deployment.
|
| 96 |
+
|
| 97 |
+
---
|
| 98 |
+
|
| 99 |
+
## Ethical Considerations
|
| 100 |
+
* This model analyzes user-generated content, which may include biased or subjective opinions
|
| 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 |
+
```
|
| 129 |
+
|
| 130 |
+
---
|
| 131 |
+
|
| 132 |
+
## License
|
| 133 |
+
This model is released under the **Creative Commons Attribution-NonCommercial 4.0 (CC BY-NC 4.0)** license.
|
| 134 |
+
**Commercial use, resale, or monetization of this model is strictly prohibited.**
|
| 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 = {Mian Zaka},
|
| 145 |
+
title = {Amazon Reviews Sentiment Analysis Model},
|
| 146 |
+
year = {2026},
|
| 147 |
+
publisher = {Hugging Face}
|
| 148 |
+
}
|
| 149 |
+
```
|
| 150 |
+
|
| 151 |
+
---
|
| 152 |
+
|
| 153 |
+
## Contact
|
| 154 |
+
For questions, feedback, or licensing inquiries, please contact the model author via Hugging Face.
|