forked from mmistakes/minimal-mistakes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mmistakes#84 from pesser/faq
Faq
- Loading branch information
Showing
3 changed files
with
37 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
FAQ | ||
===== | ||
|
||
How do I set a random seed? | ||
Iterators or models or datasets can use a random seed from | ||
the config. How and where to set such seeds is application | ||
specific. It is recommended to create local pseudo-random-number-generators | ||
whenever possible, e.g. using `RandomState | ||
<https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.RandomState.html>`_ | ||
for `numpy`. | ||
|
||
Note that loading examples from a dataset happens in multiple processes, and | ||
the same random seed is copied to all child processes. If your | ||
:meth:`edflow.data.dataset.DatasetMixin.get_example` method relies on random | ||
numbers, you should use :class:`edflow.util.PRNGMixin` to make sure examples | ||
in your batches are independent. This will add a :attr:`prng` attribute (a | ||
`RandomState` instance) to your class, which will be seeded differently in | ||
each process. |