Created
April 3, 2020 20:24
-
-
Save phil8192/cca49e2d54ce7f927cfb7cd6bfdf4dc5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def batches(X, y, batch_size, randomise): | |
rows = X.shape[0] | |
i = np.arange(rows) | |
if randomise: | |
np.random.shuffle(i) | |
splits = rows / batch_size | |
for x_batch, y_batch in zip(np.array_split(X[i, ], splits), | |
np.array_split(y[i], splits)): | |
yield x_batch, y_batch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment