Datasets:
Sub-tasks:
multi-class-classification
Languages:
English
Size:
1K<n<10K
Tags:
natural-language-understanding
ideology classification
text classification
natural language processing
License:
EricR401S
commited on
Commit
·
d33962c
1
Parent(s):
b51128e
data
Browse files- Pill_Ideologies-Post_Titles.py +22 -22
Pill_Ideologies-Post_Titles.py
CHANGED
@@ -196,12 +196,12 @@ class SubRedditPosts(datasets.GeneratorBasedBuilder):
|
|
196 |
# raised too many errors that my local machine did not
|
197 |
|
198 |
# make splits
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
|
206 |
return [
|
207 |
datasets.SplitGenerator(
|
@@ -213,22 +213,22 @@ class SubRedditPosts(datasets.GeneratorBasedBuilder):
|
|
213 |
"split": "train",
|
214 |
},
|
215 |
),
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
]
|
233 |
|
234 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
|
|
196 |
# raised too many errors that my local machine did not
|
197 |
|
198 |
# make splits
|
199 |
+
train, test = train_test_split(
|
200 |
+
data, test_size=0.10, stratify=data["subreddit"], random_state=42
|
201 |
+
)
|
202 |
+
train, val = train_test_split(
|
203 |
+
train, test_size=0.20, stratify=train["subreddit"], random_state=42
|
204 |
+
)
|
205 |
|
206 |
return [
|
207 |
datasets.SplitGenerator(
|
|
|
213 |
"split": "train",
|
214 |
},
|
215 |
),
|
216 |
+
datasets.SplitGenerator(
|
217 |
+
name=datasets.Split.VALIDATION,
|
218 |
+
# These kwargs will be passed to _generate_examples
|
219 |
+
gen_kwargs={
|
220 |
+
"filepath": val,
|
221 |
+
"split": "dev",
|
222 |
+
},
|
223 |
+
),
|
224 |
+
datasets.SplitGenerator(
|
225 |
+
name=datasets.Split.TEST,
|
226 |
+
# These kwargs will be passed to _generate_examples
|
227 |
+
gen_kwargs={
|
228 |
+
"filepath": test,
|
229 |
+
"split": "test",
|
230 |
+
},
|
231 |
+
),
|
232 |
]
|
233 |
|
234 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|