Yields lists by batch
(dataset, batch_size)
| 64 | yield b |
| 65 | |
| 66 | def seprate_batch(dataset, batch_size): |
| 67 | """Yields lists by batch""" |
| 68 | num_batch = len(dataset)//batch_size+1 |
| 69 | batch_len = batch_size |
| 70 | # print (len(data)) |
| 71 | # print (num_batch) |
| 72 | batches = [] |
| 73 | for i in range(num_batch): |
| 74 | batches.append([dataset[j] for j in range(batch_len)]) |
| 75 | # print('current data index: %d' %(i*batch_size+batch_len)) |
| 76 | if (i+2==num_batch): batch_len = len(dataset)-(num_batch-1)*batch_size |
| 77 | return(batches) |
| 78 | |
| 79 | def split_train_val(dataset, val_percent=0.05): |
| 80 | dataset = list(dataset) |
nothing calls this directly
no outgoing calls
no test coverage detected