Skip to content

Commit d87b817

Browse files
Change shuffle to do sampling without replacement
`numpy.random.randint` does sampling with replacement. Change to `numpy.random.choice` and set `replace=False` for sampling without replacement.
1 parent 8a30b90 commit d87b817

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

6.3-advanced-usage-of-recurrent-neural-networks.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,8 +1157,7 @@
11571157
" i = min_index + lookback\n",
11581158
" while 1:\n",
11591159
" if shuffle:\n",
1160-
" rows = np.random.randint(\n",
1161-
" min_index + lookback, max_index, size=batch_size)\n",
1160+
" rows = np.random.choice(range(min_index + lookback, max_index), size=batch_size, replace=False)\n"
11621161
" else:\n",
11631162
" if i + batch_size >= max_index:\n",
11641163
" i = min_index + lookback\n",

0 commit comments

Comments
 (0)