Francisco Castillo commited on
Commit
5006c5a
1 Parent(s): d3d63f6
Files changed (1) hide show
  1. fashion_mnist_label_drift.py +14 -7
fashion_mnist_label_drift.py CHANGED
@@ -160,13 +160,20 @@ class FashionMNISTLabelDrift(datasets.GeneratorBasedBuilder):
160
  def _generate_examples(self, filepath):
161
  # This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
162
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
163
- print("CACA = ", filepath)
164
- os.rename(filepath, "/Users/kiko/test.foo")
165
-
166
- with open(filepath) as file:
167
- df = pd.read_hdf(file)
168
- print(len(df))
169
- print(df.columns)
 
 
 
 
 
 
 
170
  # csv_reader = csv.reader(csv_file, delimiter='\t')
171
  # for id_, row in enumerate(csv_reader):
172
  # prediction_ts,language,text,ner_tags = row
 
160
  def _generate_examples(self, filepath):
161
  # This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
162
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
163
+ with open(filepath, 'rb') as pkl_file:
164
+ data = pickle.load(pkl_file, encoding='bytes')
165
+ pred_ts=data['prediction_ts']
166
+ images=data['image']
167
+ labels=data['label']
168
+ for idx, _ in enumerate(images):
169
+ if id_==0:
170
+ continue
171
+ yield id_, {
172
+ "prediction_ts":pred_ts[idx],
173
+ "label":labels[idx],
174
+ "image":images[idx]
175
+ }
176
+ # with open(filepath) as csv_file:
177
  # csv_reader = csv.reader(csv_file, delimiter='\t')
178
  # for id_, row in enumerate(csv_reader):
179
  # prediction_ts,language,text,ner_tags = row