question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update docstrings to match the current guideline.

See original GitHub issue

Motivation

Recently, we have introduced the docstrings guideline, and it is written in wiki.

However, some docstrings do not follow it. So, here, I would like to make a list which we need to update.

List

Need to add examples

Since optuna users will use these functions and methods, they should have an example to explain how to use it. So, we need to add an Example: section in the docstring.

  • optuna.logging.get_verbosity #3066
  • optuna.logging.set_verbosity #3061
  • optuna.logging.enable_default_handler
  • optuna.logging.disable_propagation
  • optuna.study.create_study #1711
  • optuna.study.load_study #1712
  • optuna.study.delete_study #1741
  • optuna.study.get_all_study_summaries #1742
  • optuna.study.Study.optimize #1726
  • optuna.study.Study.get_user_attr
  • optuna.study.Study.set_user_attr
  • optuna.study.Study.stop #1752
  • optuna.study.Study.get_trials #1746
  • optuna.multi_objective.study.MultiObjectiveStudy.optimize #1747
  • optuna.multi_objective.study.create_study #1749
  • optuna.multi_objective.study.load_study #1750

Need to add enough description

Since optuna users will use these functions and methods, they should explain their role and usage. So, we need to add more explanation in the docstring.

  • ~optuna.study.Study.get_user_attr~
  • optuna.study.Study.user_attrs #1745
  • optuna.study.Study.set_user_attr #1744

Need to add see also

Since the following functionalities are related each other, we need to add a .. seealso:: section in the docstring.

  • optuna.study.Study.get_trials <-> optuna.study.Study.trials

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
JoshKohcommented, Jul 23, 2020

I think we need examples for multiple objective optimization and study.stop as introduced recently in ver. 1.5. Especially how to stop study once objective function achieves certain threshold. Also, example for pruning needs more explanation: for step in range(100): # what is this for? Why do we need range(100), how to determine a range? clf.partial_fit(train_x, train_y, classes=classes)

    # Report intermediate objective value.
    intermediate_value = 1.0 - clf.score(valid_x, valid_y)
    trial.report(intermediate_value, step)
2reactions
hvycommented, Aug 25, 2020

Style varies quite a bit between example doctest code, e.g. some use single while other use double quotes for strings. Maybe we should make them consistent, following black?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Docstrings Tutorial : Examples & Format for Pydoc ...
See Python Docstrings. Learn about the different types of docstrings & various docstring formats like Sphinx, Numpy, and Pydoc with examples now.
Read more >
Docstring update guidelines · arviz-devs/arviz Wiki - GitHub
Guidelines for updating the Parameter and return section of the API docs. Below we highlight some of the changes (based on common bad ......
Read more >
Python Docstrings - GeeksforGeeks
Python documentation strings (or docstrings) provide a convenient way of associating documentation with Python modules, functions, classes, ...
Read more >
flake8-docstrings - PyPI
flake8-docstrings. A simple module that adds an extension for the fantastic pydocstyle tool to flake8. Simply install this extension:
Read more >
pandas docstring guide — pandas 1.5.2 documentation
A Python docstring is a string used to document a Python module, class, function or method, so programmers can understand what it does...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found