Francisco Castillo commited on
Commit
412a02e
1 Parent(s): f2d48b6
Files changed (1) hide show
  1. reviews_with_drift.py +7 -7
reviews_with_drift.py CHANGED
@@ -84,7 +84,7 @@ class ReviewsWithDrift(datasets.GeneratorBasedBuilder):
84
  DEFAULT_CONFIG_NAME = "default" # It's not mandatory to have a default configuration. Just use one if it make sense.
85
 
86
  def _info(self):
87
- class_names = ["Negative", "Positive"]
88
  # This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
89
  features = datasets.Features(
90
  # These are the features of your dataset like images, labels ...
@@ -151,7 +151,7 @@ class ReviewsWithDrift(datasets.GeneratorBasedBuilder):
151
  def _generate_examples(self, filepath):
152
  # TODO: 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):
@@ -166,10 +166,10 @@ class ReviewsWithDrift(datasets.GeneratorBasedBuilder):
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,
@@ -178,4 +178,4 @@ class ReviewsWithDrift(datasets.GeneratorBasedBuilder):
178
  "text": text,
179
  "label":label,
180
  }
181
- # break
 
84
  DEFAULT_CONFIG_NAME = "default" # It's not mandatory to have a default configuration. Just use one if it make sense.
85
 
86
  def _info(self):
87
+ class_names = ["negative", "positive"]
88
  # This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
89
  features = datasets.Features(
90
  # These are the features of your dataset like images, labels ...
 
151
  def _generate_examples(self, filepath):
152
  # TODO: 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):
 
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,
 
178
  "text": text,
179
  "label":label,
180
  }
181
+ break