license: unknown
task_categories:
- text-classification
language:
- en
size_categories:
- 1M<n<10M
About Dataset
This dataset consists of a few million Amazon customer reviews (input text) and star ratings (output labels) for training fastText models for sentiment analysis.
The dataset is based on real business data at a reasonable scale, which can be trained on a modest laptop in minutes.
Content
The fastText supervised learning tutorial requires data in this format:
__label__<X> __label__<Y> ... <Text>
X
andY
are the class names, without quotes and all on one line.- In this dataset, the classes are
__label__1
and__label__2
, with only one class per row. __label__1
corresponds to 1- and 2-star reviews, while__label__2
corresponds to 4- and 5-star reviews.- 3-star reviews (neutral sentiment) are excluded from the dataset.
- Review titles are prepended to the text, followed by a colon and a space.
- Most reviews are in English, with a few in other languages like Spanish.
Source
The data was obtained from Xiang Zhang's Google Drive directory in .csv format, which was then adapted for use with fastText.
Training and Testing
Follow the instructions in the fastText supervised learning tutorial to set up the directory.
Training
To train the model, use:
./fasttext supervised -input train.ft.txt -output model_amzn
This should take a few minutes.
To test:
./fasttext test model_amzn.bin test.ft.txt
Expect precision and recall of 0.916 if all is in order.
Acknowledgments
Dataset obtained from https://www.kaggle.com/datasets/bittlingmayer/amazonreviews/data