ben-epstein
commited on
Commit
•
fa4f967
1
Parent(s):
ac188e6
Update README.md
Browse files
README.md
CHANGED
@@ -9,11 +9,7 @@ configs:
|
|
9 |
dataset_info:
|
10 |
features:
|
11 |
- name: label
|
12 |
-
dtype:
|
13 |
-
class_label:
|
14 |
-
names:
|
15 |
-
'0': negative
|
16 |
-
'1': positive
|
17 |
- name: title
|
18 |
dtype: string
|
19 |
- name: content
|
@@ -25,7 +21,7 @@ dataset_info:
|
|
25 |
- name: test
|
26 |
num_bytes: 18182813
|
27 |
num_examples: 40000
|
28 |
-
download_size:
|
29 |
dataset_size: 181542515
|
30 |
---
|
31 |
|
@@ -40,12 +36,16 @@ For quicker testing on Amazon Polarity. See https://huggingface.co/datasets/amaz
|
|
40 |
|
41 |
### Source Data
|
42 |
```python
|
43 |
-
from datasets import
|
44 |
|
45 |
ds_full = load_dataset("amazon_polarity", streaming=True)
|
46 |
ds_train_10_pct = Dataset.from_list(list(ds_full["train"].shuffle(seed=42).take(360_000)))
|
47 |
ds_test_10_pct = Dataset.from_list(list(ds_full["test"].shuffle(seed=42).take(40_000)))
|
48 |
|
49 |
ds_10_pct = DatasetDict({"train": ds_train_10_pct, "test": ds_test_10_pct})
|
|
|
|
|
|
|
|
|
50 |
```
|
51 |
|
|
|
9 |
dataset_info:
|
10 |
features:
|
11 |
- name: label
|
12 |
+
dtype: int64
|
|
|
|
|
|
|
|
|
13 |
- name: title
|
14 |
dtype: string
|
15 |
- name: content
|
|
|
21 |
- name: test
|
22 |
num_bytes: 18182813
|
23 |
num_examples: 40000
|
24 |
+
download_size: 0
|
25 |
dataset_size: 181542515
|
26 |
---
|
27 |
|
|
|
36 |
|
37 |
### Source Data
|
38 |
```python
|
39 |
+
from datasets import ClassLabel, Dataset, DatasetDict, load_dataset
|
40 |
|
41 |
ds_full = load_dataset("amazon_polarity", streaming=True)
|
42 |
ds_train_10_pct = Dataset.from_list(list(ds_full["train"].shuffle(seed=42).take(360_000)))
|
43 |
ds_test_10_pct = Dataset.from_list(list(ds_full["test"].shuffle(seed=42).take(40_000)))
|
44 |
|
45 |
ds_10_pct = DatasetDict({"train": ds_train_10_pct, "test": ds_test_10_pct})
|
46 |
+
# Need to recreate the class labels
|
47 |
+
class_label = ClassLabel(num_classes=2, names=["negative", "positive"])
|
48 |
+
ds_10_pct = ds_10_pct.map(lambda row: {"title": row["title"], "content": row["content"], "label": "negative" if not row["label"] else "positive"})
|
49 |
+
ds_10_pct = ds_10_pct.cast_column("label", class_label)
|
50 |
```
|
51 |
|