Datasets:
Tasks:
Text Classification
Formats:
csv
Sub-tasks:
sentiment-classification
Languages:
English
Size:
10K - 100K
License:
Francisco Castillo
commited on
Commit
·
b1daa1b
1
Parent(s):
4c93abd
wip
Browse files- reviews_with_drift.py +2 -15
reviews_with_drift.py
CHANGED
@@ -149,27 +149,15 @@ class ReviewsWithDrift(datasets.GeneratorBasedBuilder):
|
|
149 |
|
150 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
151 |
def _generate_examples(self, filepath):
|
152 |
-
#
|
153 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
154 |
label_mapping = {"positive": 1, "negative": 0}
|
155 |
with open(filepath) as csv_file:
|
156 |
csv_reader = csv.reader(csv_file)
|
157 |
for id_, row in enumerate(csv_reader):
|
158 |
prediction_ts,age,gender,context,text,label = row
|
159 |
-
# print(row)
|
160 |
-
# print(prediction_ts)
|
161 |
-
# print(type(prediction_ts))
|
162 |
-
# print(float(prediction_ts))
|
163 |
-
# print(type(float(prediction_ts)))
|
164 |
-
# print(age)
|
165 |
-
# print(type(label))
|
166 |
-
# print(label)
|
167 |
if id_==0:
|
168 |
continue
|
169 |
-
# print("CACA\n\n")
|
170 |
-
# print(label)
|
171 |
-
# print(type(label))
|
172 |
-
# print("\n\nCACA\n\n")
|
173 |
yield id_, {
|
174 |
"prediction_ts":prediction_ts,
|
175 |
"age":age,
|
@@ -177,5 +165,4 @@ class ReviewsWithDrift(datasets.GeneratorBasedBuilder):
|
|
177 |
"context":context,
|
178 |
"text": text,
|
179 |
"label":label,
|
180 |
-
}
|
181 |
-
# break
|
|
|
149 |
|
150 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
151 |
def _generate_examples(self, filepath):
|
152 |
+
# This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
153 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
154 |
label_mapping = {"positive": 1, "negative": 0}
|
155 |
with open(filepath) as csv_file:
|
156 |
csv_reader = csv.reader(csv_file)
|
157 |
for id_, row in enumerate(csv_reader):
|
158 |
prediction_ts,age,gender,context,text,label = row
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
if id_==0:
|
160 |
continue
|
|
|
|
|
|
|
|
|
161 |
yield id_, {
|
162 |
"prediction_ts":prediction_ts,
|
163 |
"age":age,
|
|
|
165 |
"context":context,
|
166 |
"text": text,
|
167 |
"label":label,
|
168 |
+
}
|
|