Beispiel #1
0
 def test_batcher(self):
     data = [{"a": i, "b": 10 + i, "c": 20 + i} for i in range(10)]
     batcher = Batcher(train_batch_size=3)
     batches = list(batcher.batchify(data))
     self.assertEqual(len(batches), 4)
     self.assertEqual(batches[1]["a"], [3, 4, 5])
     self.assertEqual(batches[3]["b"], [19])
Beispiel #2
0
 def test_batcher(self):
     data = [
         RowData({"text": "something"}, {
             "a": i,
             "b": 10 + i,
             "c": 20 + i
         }) for i in range(10)
     ]
     batcher = Batcher(train_batch_size=3)
     batches = list(batcher.batchify(data))
     self.assertEqual(len(batches), 4)
     self.assertEqual(len(batches[0].raw_data), 3)
     self.assertEqual("something", batches[1].raw_data[0]["text"])
     self.assertEqual(batches[1].numberized["a"], [3, 4, 5])
     self.assertEqual(batches[3].numberized["b"], [19])