Skip to content
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

Docs: Fix issues callback docs #867

Merged
merged 3 commits into from
Jul 5, 2022
Merged

Conversation

BenjaminBossan
Copy link
Collaborator

@BenjaminBossan BenjaminBossan commented Jul 4, 2022

I fixed a couple of minor issues I found in the docs

  • Added/removed some blank lines for consistency
  • Some entries like 'event_' were interpreted as links, so I added code
    markers around them.
  • Added usage example to TensorBoard docstring
  • Fixed a copy paste error in WandbLogger
  • Some links were not parsed correctly, so I used different syntax
  • Fixed issue in code example of SacredLogger

Additionally, I removed an outdated comment in probabilistic.py docstring.

What I would like to know: Is it possible to have blank lines inside
example code blocks without starting a completely new block? Some
examples are now very cramped and I would like to add some blank lines,
but don't know how.

Also, it looks like in the official docs, the API docs for probabilistic.py are empty:

https://skorch.readthedocs.io/en/latest/probabilistic.html

I cannot reproduce this error locally :(

- Added/removed some blank lines for consistency
- Some entries like 'event_' were interpreted as links, so I added code
  markers around them.
- Added usage example to TensorBoard docstring
- Fixed a copy paste error in WandbLogger
- Some links were not parsed correctly, so I used different syntax
- Fixed issue in code example of SacredLogger

What I would like to know: Is it possible to have blank lines inside
example code blocks without starting a completely new block? Some
examples are now very cramped and I would like to add some blank lines,
but don't know how.
@BenjaminBossan BenjaminBossan changed the title Docs: fix issues callback docs Docs: Fix issues callback docs Jul 4, 2022
@BenjaminBossan BenjaminBossan self-assigned this Jul 4, 2022
@@ -747,32 +756,30 @@ class SacredLogger(Callback):

To use this logger, you first have to install Sacred:

$ python -m pip install sacred
``$ python -m pip install sacred``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this works for Sphinx?

Suggested change
``$ python -m pip install sacred``
.. code-block::
$ python -m pip install sacred

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used code blocks for the 2 shell commands in this docstring.

>>> import numpy as np
>>> from sacred import Experiment
>>> from sklearn.datasets import make_classification
>>> from skorch.callbacks.logging import SacredLogger
>>> from skorch.callbacks.scoring import EpochScoring
>>> from skorch import NeuralNetClassifier
>>> from skorch.toy import make_classifier

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One way to split this up is to add a comment describing the code.

XREF: https://numpydoc.readthedocs.io/en/latest/format.html#examples

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I wanted to avoid that. My goal would be to just have a block of code with some blank lines:

from skorch import NeuralNetClassifier
from skorch.toy import make_classifier

ex = Experiment()

@ex.config
def my_config():
    max_epochs = 20
    lr = 0.01

X, y = make_classification()

Adding comments seems unnecessary to me in this case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see. I do not think there is a great way to do this.

>>> import numpy as np
>>> from sacred import Experiment
>>> from sklearn.datasets import make_classification
>>> from skorch.callbacks.logging import SacredLogger
>>> from skorch.callbacks.scoring import EpochScoring
>>> from skorch import NeuralNetClassifier
>>> from skorch.toy import make_classifier

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see. I do not think there is a great way to do this.

@BenjaminBossan BenjaminBossan merged commit d17e3bc into master Jul 5, 2022
@BenjaminBossan BenjaminBossan deleted the docs/fix-issues-callback-docs branch July 5, 2022 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants