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

Fixing incoherent style of references #4344

Closed
sotte opened this issue Mar 5, 2015 · 18 comments
Closed

Fixing incoherent style of references #4344

sotte opened this issue Mar 5, 2015 · 18 comments

Comments

@sotte
Copy link
Contributor

sotte commented Mar 5, 2015

TLDR: The references in the docstrings have weird/wrong/very different formats. "There should be one-- and preferably only one --obvious way to do it."

I was looking at the reference links of some classifiers when I realized they were not formated correctly. When I was about to submit a pull request I realized that many references have a different format and according to the Zen of Python

There should be one-- and preferably only one --obvious way to do it.

Some references

I think references should be referencable, be as concise as possible (authors, title, conference/book, etc). I'm not sure about the link to the PDFs because the URIs change over time and lead to dead links. What do you think?

My suggestion:

   References
    ----------

    .. [1] Hinton, G. E., Osindero, S. and Teh, Y. A fast learning algorithm
           for deep belief nets. Neural Computation 18, pp 1527-1554.

I'd be willing to spend a few hours on the weekend to fix the references once we decide on how it's supposed to look like.

Also, #3912 should document the format for the references.

@raghavrv
Copy link
Member

raghavrv commented Mar 5, 2015

Minor suggestion : We could have a script (not a test) that could scrape the reference links and verify them all... The script could be run before every release maybe?

@amueller
Copy link
Member

amueller commented Mar 5, 2015

The problem with having sphinx referencable references is that sphinx will complain if there are duplicates. On the other hand, we definitely want to list references in multiple docstrings.
Any ideas?

+1 on the general theme though.

@sotte
Copy link
Contributor Author

sotte commented Mar 5, 2015

@ragv I aggree, one could write a script like that.

@amueller I didn't know that sphinx complains about duplicates.

One could use what should be used for referencing: bibtex. There is sphinxcontrib-bibtex which integrates bibtex into sphinx. However, having a sep. bibtex file also makes the docstring a bit harder to read. And there is another dependency.

@amueller
Copy link
Member

amueller commented Mar 5, 2015

Yeah -1 on bibtex. Why is the benefit of having a referenceable reference in the docstring? I think a list would be just fine.

@sotte
Copy link
Contributor Author

sotte commented Mar 5, 2015

Referenceable reference are nice because you can say things like: "...we did X according to [ref1] and Y according to [ref2]..." ( exmaple)

Alternatively, when only using lists for the references one could just put the name of the first author + year (or something similar) into the brakets.

@amueller
Copy link
Member

amueller commented Mar 5, 2015

That would be kind of nice, if the docstrings where that detailed ;)
Can you maybe double check if / how sphinx complains with your original suggestion?

@sotte
Copy link
Contributor Author

sotte commented Mar 5, 2015

ensemble/bagging.py uses referencable references (great word btw) and they reference the same papers. Seems to work without problems.

So we could use that & a script that checks the if the links to the pdf are alive.

Edit:

@sotte
Copy link
Contributor Author

sotte commented Mar 8, 2015

I'd suggest settling for the following:

We implemented method X according to [1]_ and Y according to [2]_.

lorem ipsum...

References
----------
.. [1] AUTHORS.
       TITLE.
       DETAILS.
       URL

.. [2] AUTHORS.
       TITLE.
       DETAILS.
       URL

This is also how scipy does it...most of the time. See http://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html#id12

@sotte
Copy link
Contributor Author

sotte commented Mar 8, 2015

Checking links with sphinx:
http://sphinx-doc.org/builders.html#sphinx.builders.linkcheck.CheckExternalLinksBuilder

Maybe there is no need for an extenal scirpt. Haven't tried it yet.

@sotte
Copy link
Contributor Author

sotte commented Mar 8, 2015

There are currently 139 non-local redirects and broken links in the docs.

@raghavrv
Copy link
Member

raghavrv commented Mar 8, 2015

Checking links with sphinx:
http://sphinx-doc.org/builders.html#sphinx.builders.linkcheck.CheckExternalLinksBuilder

Thats awesome!

Hey btw do we need to decide on the order of the papers? (chronological / relevance / alphabetical / simply leave the order as it is)

@agramfort
Copy link
Member

is there a simple command line way to check the links of the doc? or maybe
differently "how do you use CheckExternalLinksBuilder
http://sphinx-doc.org/builders.html#sphinx.builders.linkcheck.CheckExternalLinksBuilder
"?

@sotte
Copy link
Contributor Author

sotte commented Mar 8, 2015

Oh, sorry. This is how you do it:

cd doc
make linkcheck

This however currently builds all the docs including plots. But in the end you get the file _build/linkcheck/output.txt.

@agramfort
Copy link
Member

agramfort commented Mar 8, 2015 via email

@amueller
Copy link
Member

amueller commented Mar 9, 2015

if the numeric style doesn't give any warnings, I'm all for it.

@raghavrv
Copy link
Member

raghavrv commented Apr 9, 2015

@sotte hey :) any news on this? :)

@sotte
Copy link
Contributor Author

sotte commented Apr 10, 2015

@ragv I've been very busy but I'll try to finish it this weekend...

@adrinjalali
Copy link
Member

We've standardized our docstrings a lot ever since.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants