-
Notifications
You must be signed in to change notification settings - Fork 517
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
Generate notebook with HTML for admonitions #152
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
JupyterBookhttps://inria.github.io/scikit-learn-mooc/python_scripts/02_numerical_pipeline_hands_on.html Notebookhttps://nbviewer.jupyter.org/github/inria/scikit-learn-mooc/blob/master/notebooks/02_numerical_pipeline_hands_on.ipynb The HTML generation logic is in the |
And just so that the hack is more explicit the markdown cell for the example above in the Jupyter notebook looks like this: <div class="admonition tip alert alert-warning">
<p class="first admonition-title" style="font-weight: bold;">Tip</p>
<p class="last"><tt class="docutils literal">random_state</tt> parameter allows to get a deterministic results even if we
use some random process (i.e. data shuffling).</p>
</div>
In the previous notebook, we used a k-nearest neighbors predictor. While this
model is really intuitive to understand, it is not widely used. Here, we will
a predictive model belonging to the linear model families.
<div class="admonition note alert alert-info">
<p class="first admonition-title" style="font-weight: bold;">Note</p>
<p class="last">In short, these models find a set of weights to combine each column in the
data matrix to predict the target. For instance, the model can come up with
rules such as <tt class="docutils literal">0.1 * age + 3.3 * <span class="pre">education-num</span> - 15.1 > 0</tt> means that
<tt class="docutils literal"><span class="pre">high-income</span></tt> is predicted.</p>
</div>
Thus, we will use a logistic regression classifier and train it. |
@@ -0,0 +1,138 @@ | |||
import sys |
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 a small docstring to explain what is going on in this file / what is its purpose
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.
Yeah that's a good point, I added small docstrings (be it only to remember it myself) to the functions but not to the module.
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.
Done in d61c5c1
Just FYI: |
Thanks for your comment, I'll try to have a look! Maybe two points that are worth stressing:
|
That's no problem for
Yeah, that's a bit of a trade-off ... The example from the nbsphinx docs looks like this:
This is not great, but IMHO it isn't too bad either. In the
Regarding the example shown above (#152 (comment)), I would suggest a compromise:
This is still somewhat readable in the source, it looks acceptable in JupyterLab and it looks quite good when using Note that And note that there is still a problem in |
Fix #107.
This allows: