File size: 1,658 Bytes
cbe038b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
de9fab4
 
 
 
 
 
 
 
 
 
cbe038b
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
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` and `Y` 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:

```bash
./fasttext supervised -input train.ft.txt -output model_amzn
```

This should take a few minutes.

To test:

```bash
./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