Break training data into slices for stochastic gradient decent:
import numpy as np n = 100 training_data = list(range(n)) mini_batch_size = 10 np.random.shuffle(training_data) mini_batches = [training_data[k:k+mini_batch_size] for k in range(0, n, mini_batch_size)] mini_batches
[[90, 5, 70, 82, 58, 2, 16, 85, 12, 35],
[14, 54, 62, 39, 96, 73, 60, 80, 33, 89],
[20, 38, 76, 47, 65, 42, 71, 46, 93, 34],
[52, 64, 13, 92, 17, 49, 88, 63, 74, 23],
[43, 25, 10, 97, 48, 68, 95, 81, 24, 31],
[9, 32, 84, 83, 22, 87, 61, 26, 28, 99],
[0, 67, 30, 69, 72, 45, 79, 51, 40, 55],
[6, 15, 75, 66, 29, 3, 18, 77, 98, 21],
[53, 44, 50, 19, 91, 8, 11, 59, 27, 56],
[36, 94, 7, 57, 1, 37, 86, 78, 41, 4]]