-
Notifications
You must be signed in to change notification settings - Fork 461
DOC move notebooks to sphinx user guides and generated docs #336
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
Conversation
Signed-off-by: adrinjalali <adrin.jalali@gmail.com>
Signed-off-by: adrinjalali <adrin.jalali@gmail.com>
Signed-off-by: adrinjalali <adrin.jalali@gmail.com>
Thanks, I'll take a look as soon as I get a chance. |
@adrinjalali , may I suggest to add |
So the idea is that there are a few ways of having this content on the docs:
We usually have a combination of the user guide |
OK, but I think we will want to have example notebooks for users as well. So is there a way of automatically generating the notebooks from these changes, and having them appear on a webpage? |
Yes, the examples are used to automatically generate the notebook. As an example you can see this one. There's a notebook download button on the bottom of the page. |
|
Signed-off-by: adrinjalali <adrin.jalali@gmail.com>
Signed-off-by: adrinjalali <adrin.jalali@gmail.com>
Signed-off-by: adrinjalali <adrin.jalali@gmail.com>
Signed-off-by: adrinjalali <adrin.jalali@gmail.com>
The tests are failing due to some pep8 issues (line too long). In sklearn we find it hard to maintain the like length in examples, especially with math lines or links. Should we relax on the linter on the |
I've removed the linter, and now we have the link to the example on the main index page. Let me know what you think. |
Works for me! @riedgar-ms ? |
I'm OK with upping the line length limit in the docs directory |
Signed-off-by: adrinjalali <adrin.jalali@gmail.com>
Signed-off-by: adrinjalali <adrin.jalali@gmail.com>
Signed-off-by: adrinjalali <adrin.jalali@gmail.com>
@riedgar-ms @romanlutz We can also have a quick chat about the whole sphinx, sphinx-gallery, etc if it helps. |
docs/index.rst
Outdated
fairlearn.reductions | ||
fairlearn.widget | ||
|
||
auto_examples/plot_binary_classification_COMPAS |
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.
Could we have an 'examples' entry at this level of the table of contents, and the notebook beneath it?
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.
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.
On the landing page, I'd suggest not opening up the TOC for each example. Just list the examples. Well, 'example' for now.
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.
ok, done.
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.
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.
How does it look now?
Binary Classification on COMPAS dataset | ||
======================================= | ||
""" | ||
print(__doc__) |
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.
Was this supposed to show up on the rendered webpage?
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.
yes. It's there to show up when you run the .py
version of the example.
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.
What does it print? All of the (former) notebook text?
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.
Yes. Could remove it if you want.
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.
Maybe leave it in for now; I think it looks a little odd, but I don't have the only vote here :-)
When you push your changes, I'll bring them over to my branch, and get the updated sample documentation.
I've generated the docs locally as suggested, and apart from the two small layout issues I've mentioned, it looks OK to me. I wouldn't do more than this right now, though. We need to figure out how to fit this into our build pipeline (both for testing the notebooks and autopublishing the docs), and there may also be other integration points with other resources we're putting together. However, I doubt any of that can happen until this is in the main Fairlearn repo (unless I can suck the branch from the fork into the main repo.... I imagine git can do that somehow). Any other comments @romanlutz ? |
Everything looks good to me. I'd like to proceed since we're not breaking anything existing, get it into master, so that we can see what it looks like, and then step-by-step replace existing ones. @adrinjalali I would love to have that chat on sphinx, sphinx-gallery, etc. and I'm sure @riedgar-ms is also interested. Feel free to DM me/us on Gitter or Teams or wherever you like with possible times. I'm willing to compromise on timing since I'm 9h away from you ;-) |
I like the proposal here and I think we should go ahead and merge this PR. I really like the ability to more naturally include examples in the documentation. However, we shouldn't yet remove the current notebooks--and I also don't think we should quite yet put them into the new format. My main concern is the ease of editing the notebooks. I like developing and editing the notebook in jupyter. I see that sphinx-gallery can generate |
The issue is that
So I believe once we get used to it, it shouldn't affect our productivity while working on the |
* adding sphinx-gallery Signed-off-by: adrinjalali <adrin.jalali@gmail.com> * add example as user guide Signed-off-by: adrinjalali <adrin.jalali@gmail.com> * remove exceptions Signed-off-by: adrinjalali <adrin.jalali@gmail.com> * cleanups Signed-off-by: adrinjalali <adrin.jalali@gmail.com> * fix link to doc Signed-off-by: adrinjalali <adrin.jalali@gmail.com> * remove user guide format Signed-off-by: adrinjalali <adrin.jalali@gmail.com> * improve on pep8 Signed-off-by: adrinjalali <adrin.jalali@gmail.com> * fix after merge upstream/master Signed-off-by: adrinjalali <adrin.jalali@gmail.com> * change flake8 settings and fix some pep8 issues Signed-off-by: adrinjalali <adrin.jalali@gmail.com> * pep8, blacked the example Signed-off-by: adrinjalali <adrin.jalali@gmail.com> * ignore docstring warnings Signed-off-by: adrinjalali <adrin.jalali@gmail.com> * fix inline math Signed-off-by: adrinjalali <adrin.jalali@gmail.com> * minor change Signed-off-by: adrinjalali <adrin.jalali@gmail.com> Co-authored-by: adrinjalali <adrin.jalali@gmail.com>
FYI, this is what the docs will look like after the change: |
I share all your concerns! The process you outline here sounds promising and I'll go ahead and try that. It seems to address lots of the issues I have with notebooks. I'll count Miro's statement above as an endorsement to complete the PR. We'll have to have a broader discussion about notebooks since some of them are examples on how to use the package, others are more like case studies. |
Oh I missed the two outstanding comments by @riedgar-ms . Richard, please complete the PR when you're happy with them. |
Signed-off-by: adrinjalali <adrin.jalali@gmail.com>
Signed-off-by: adrinjalali <adrin.jalali@gmail.com>
Signed-off-by: adrinjalali <adrin.jalali@gmail.com>
The DCO is wrong in failing, it's failing because of your commit to my branch @riedgar-ms (I so much dislike this DCO thing) |
I committed to your branch? In your fork? Sorry :-( I don't even know how I managed that :-( |
haha, yes you did. It's a good tool. It's a nice one for maintainers. Basically, if the author of the PR checks the "allow changes from maintainers", then maintainers can commit to the relevant branch of the author directly ;) and we do it pretty often in sklearn to do last fixes on people's PRs. It's odd that DCO can't understand that. |
Yes, but I thought I was updating my copy of your branch.... I was doing a PR from your branch of your fork into my branch of Fairlearn itself (so that we could view in ReadTheDocs). And I thought the conflict was on that PR, and that I'd merged into my branch. |
I've just shown this to @mesameki and @vingu . They like the basic flow, but aren't sure about converting our big 'scenario' notebooks over to this. For smaller code samples (I think that the Metrics notebook is a good candidate), they think it looks great and a valuable addition to our documentation. I've expanded on that a bit in the Fairlearn Teams channel (or are we moving to Gitter?). |
@adrinjalali : I think you make an excellent point re. One of the issues that we are running into here is that there is no established way to talk about fairness in AI, so we are developing standards as we go and that's why our examples are more exploratory than one would like. Also--as soon as we discover that something might have bad unintented consequences, we want to be able to easily edit things--any any barrier to that will slow things down. Given all these disclaimers: I'm good to go ahead with this PR. @riedgar-ms : I don't think we need to move this conversation elsewhere given that the bulk of it is here (and we are reaching a consensus). |
I think it'd be best if we could have a call on this one. Any day this week 17:30-19:30 would work for me. |
I'm assuming that's European time? Have your clocks gone forward, @adrinjalali . What were your particular concerns? With @MiroDudik being happy with this, we can complete the PR (after that ever-fun DCO issue is fixed). However, I don't think we'd go ahead and convert other notebooks, while we decide how best to present things. It's great to have this new option, though. |
Yes, sorry, CEST time.
that'll mean force pushing and losing the history here, which I'm not super fond of, do we have to? You can still merge I guess w/o.
I'd like to be a part of that conversation if you don't mind. It doesn't give the contributor (in this case me) a feeling of inclusion when you come and say we talked and we decided we won't do it for the other ones. I think it's better to have a discussion, hear your concerns, and here the pro side, and see what we can do. I agree that the larger notebooks shouldn't be converted to an example, but those are perfect examples of something which should go to a user guide. At the end of the day, the website is where people find information, and those user guides are important for people to understand how the package works. |
No problem. Invitation set.
There's a suggested fix from the DCO bot:
Understood, and my apologies for the lack of organisation on this my end. |
DCO can be overridden so don't worry. I don't see your sign-off, @riedgar-ms, though, so I'll wait. |
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.
Thanks for showing us how to do this!
[i'm playing with jupytext to try things out a bit] |
Our notebooks are examples for users, and they are conceptually a part of the documentation.
This PR proposes to move them to a sphinx gallery generated example. You can call
make doc
(or run the command that it runs) to generate the examples locally.@philippjfr @cmarmo I'm trying to point to the examples from the main
index.rst
, not sure how to do that. Theauto_generated
examples doesn't exist when theindex.rst
is processed, and therefore gives an error.