-
Notifications
You must be signed in to change notification settings - Fork 14
Add documentation for patching utilities and interfaces
#107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,15 @@ | ||
| .. _fullapi: | ||
|
|
||
| Class MKLRandomState | ||
| ==================== | ||
|
|
||
| .. autoclass:: mkl_random.MKLRandomState | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The rendered page has |
||
| :members: | ||
| :inherited-members: | ||
|
|
||
| Class RandomState | ||
| ================= | ||
|
|
||
| .. autoclass:: mkl_random.RandomState | ||
| :members: | ||
| :inherited-members: | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,110 @@ | ||||||
| .. _interfaces: | ||||||
|
|
||||||
| :mod:`mkl_random.interfaces` | ||||||
| ==================================================== | ||||||
|
|
||||||
| :mod:`mkl_random.interfaces` provides drop-in replacements for supported random number generation | ||||||
| modules using :mod:`mkl_random` implementations. Currently, only a NumPy interface is provided, | ||||||
| but more may be added in the future. | ||||||
|
|
||||||
|
|
||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we updat examples in brngs description with
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same is about example on How-to guide (documentation/how_to.html)
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And Beginner's guide (documentation/tutorials.html)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea, yes, we should |
||||||
| .. _numpy_random_interface: | ||||||
|
|
||||||
| NumPy interface --- :mod:`mkl_random.interfaces.numpy_random` | ||||||
| ------------------------------------------------------------- | ||||||
|
|
||||||
| :mod:`mkl_random.interfaces.numpy_random` is a drop-in replacement for the legacy portion of | ||||||
| :mod:`numpy.random`. | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should it be a ref on numpy.random page? |
||||||
|
|
||||||
| .. note:: | ||||||
| While the API is the same, :mod:`mkl_random.interfaces.numpy_random` is **not** seed-compatible | ||||||
| with :mod:`numpy.random`. Given the same seed, the two modules will produce different sequences. | ||||||
| The output of `get_state` and accepted input to `set_state` may also differ. It is not | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should here be a ref on functions?
Suggested change
|
||||||
| recommended to provide the output of `get_state` from one module to `set_state` of the other. | ||||||
| There also may be differences in some edge cases, such as behavior of functions when given specific inputs. | ||||||
|
|
||||||
|
|
||||||
| RandomState class | ||||||
| ^^^^^^^^^^^^^^^^^ | ||||||
|
|
||||||
| .. autoclass:: mkl_random.interfaces.numpy_random.RandomState | ||||||
| :members: | ||||||
| :undoc-members: | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same here:
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The link on
|
||||||
|
|
||||||
|
|
||||||
| Functions | ||||||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||||||
|
|
||||||
| **Seeding and state functions:** | ||||||
|
|
||||||
| .. autosummary:: | ||||||
|
|
||||||
| mkl_random.interfaces.numpy_random.seed | ||||||
| mkl_random.interfaces.numpy_random.get_state | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||||||
| mkl_random.interfaces.numpy_random.set_state | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should it be clickable to go from the table to the function description? |
||||||
|
|
||||||
| **Simple random data:** | ||||||
|
|
||||||
| Similar to NumPy, the methods of :class:`RandomState` are exported as functions in the module. | ||||||
| Their usage is discouraged, as they are implemented from a global instance of :class:`RandomState`, | ||||||
| which means results may change across calls. | ||||||
|
|
||||||
| .. autosummary:: | ||||||
|
|
||||||
| mkl_random.interfaces.numpy_random.rand | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The link on page with numpy corresponding functions are not working. |
||||||
| mkl_random.interfaces.numpy_random.randn | ||||||
| mkl_random.interfaces.numpy_random.randint | ||||||
| mkl_random.interfaces.numpy_random.random_integers | ||||||
| mkl_random.interfaces.numpy_random.random_sample | ||||||
| mkl_random.interfaces.numpy_random.random | ||||||
| mkl_random.interfaces.numpy_random.ranf | ||||||
| mkl_random.interfaces.numpy_random.choice | ||||||
| mkl_random.interfaces.numpy_random.bytes | ||||||
| mkl_random.interfaces.numpy_random.sample | ||||||
|
|
||||||
| **Permutations:** | ||||||
|
|
||||||
| .. autosummary:: | ||||||
|
|
||||||
| mkl_random.interfaces.numpy_random.shuffle | ||||||
| mkl_random.interfaces.numpy_random.permutation | ||||||
|
|
||||||
| **Distributions:** | ||||||
|
|
||||||
| .. autosummary:: | ||||||
|
|
||||||
| mkl_random.interfaces.numpy_random.beta | ||||||
| mkl_random.interfaces.numpy_random.binomial | ||||||
| mkl_random.interfaces.numpy_random.chisquare | ||||||
| mkl_random.interfaces.numpy_random.dirichlet | ||||||
| mkl_random.interfaces.numpy_random.exponential | ||||||
| mkl_random.interfaces.numpy_random.f | ||||||
| mkl_random.interfaces.numpy_random.gamma | ||||||
| mkl_random.interfaces.numpy_random.geometric | ||||||
| mkl_random.interfaces.numpy_random.gumbel | ||||||
| mkl_random.interfaces.numpy_random.hypergeometric | ||||||
| mkl_random.interfaces.numpy_random.laplace | ||||||
| mkl_random.interfaces.numpy_random.logistic | ||||||
| mkl_random.interfaces.numpy_random.lognormal | ||||||
| mkl_random.interfaces.numpy_random.logseries | ||||||
| mkl_random.interfaces.numpy_random.multinomial | ||||||
| mkl_random.interfaces.numpy_random.multivariate_normal | ||||||
| mkl_random.interfaces.numpy_random.negative_binomial | ||||||
| mkl_random.interfaces.numpy_random.noncentral_chisquare | ||||||
| mkl_random.interfaces.numpy_random.noncentral_f | ||||||
| mkl_random.interfaces.numpy_random.normal | ||||||
| mkl_random.interfaces.numpy_random.pareto | ||||||
| mkl_random.interfaces.numpy_random.poisson | ||||||
| mkl_random.interfaces.numpy_random.power | ||||||
| mkl_random.interfaces.numpy_random.rayleigh | ||||||
| mkl_random.interfaces.numpy_random.standard_cauchy | ||||||
| mkl_random.interfaces.numpy_random.standard_exponential | ||||||
| mkl_random.interfaces.numpy_random.standard_gamma | ||||||
| mkl_random.interfaces.numpy_random.standard_normal | ||||||
| mkl_random.interfaces.numpy_random.standard_t | ||||||
| mkl_random.interfaces.numpy_random.triangular | ||||||
| mkl_random.interfaces.numpy_random.uniform | ||||||
| mkl_random.interfaces.numpy_random.vonmises | ||||||
| mkl_random.interfaces.numpy_random.wald | ||||||
| mkl_random.interfaces.numpy_random.weibull | ||||||
| mkl_random.interfaces.numpy_random.zipf | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,27 @@ | ||||||
| .. _patching: | ||||||
|
|
||||||
| Patching :mod:`numpy.random` | ||||||
| ============================ | ||||||
|
|
||||||
| :mod:`mkl_random` can temporarily replace functions and classes in :mod:`numpy.random` with | ||||||
| :mod:`mkl_random`implementations from the :ref:`numpy interface <numpy_random_interface>`. | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
|
|
||||||
| Functions | ||||||
| --------- | ||||||
|
|
||||||
| .. autofunction:: mkl_random.patch_numpy_random | ||||||
|
|
||||||
| .. autofunction:: mkl_random.restore_numpy_random | ||||||
|
|
||||||
| .. autofunction:: mkl_random.is_patched | ||||||
|
|
||||||
|
|
||||||
| Context manager | ||||||
| --------------- | ||||||
|
|
||||||
| .. autoclass:: mkl_random.mkl_random | ||||||
| :members: | ||||||
|
|
||||||
| :class:`mkl_random.mkl_random` is both a context manager and a decorator, making it possible to | ||||||
| scope the patch to a block of code or a function. | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All links here are referred on
documentation/reference/index.htmlpage, but I guess, it should be on specific section with detailed description.