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

Add hacker-stats notebooks #98

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add hacker-stats notebooks #98

wants to merge 1 commit into from

Conversation

hugobowne
Copy link
Collaborator

@hugobowne hugobowne commented Nov 11, 2020

@ericmjl as discussed in #97.

These NBs run programmatically but there's the small issue of data access: I think I need to mimic something you did and use some utility functions in the NBs to load the data?

We can discuss tomorrow but it may be worth adding some instructions to #97 so others can reproduce, if and when necessary.

Cool!

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Owner

@ericmjl ericmjl left a comment

Choose a reason for hiding this comment

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

Cool beans, thanks @hugobowne!

I've dropped a few comments here that should help with organizing things nicely.

The only one I couldn't drop a comment for is the filenames for the notebooks; could you give them a shorter names, perhaps "01-simulated-probability.ipynb" and "02-parameter-estimation.ipynb"? Doing so makes managing the mkdocs.yml file navigation section just that teeny bit easier.

@@ -0,0 +1,74 @@
import pandas as pd
Copy link
Owner

Choose a reason for hiding this comment

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

I think the entire data.py can be placed inside the project's src/bayes_tutorial/data.py; there's some data loaders already in there. Inside the notebooks, it should be a small change to get the data imported:

from bayes_tutorial.data import <the necessary functions>

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

HBA to move all data imports into src/bayes_tutorial/data.py (w/out duplication).

Edit import calls in NBs

@@ -0,0 +1,5 @@
axes.spines.left : True # display axis spines
Copy link
Owner

@ericmjl ericmjl Nov 11, 2020

Choose a reason for hiding this comment

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

I like the style sheet; let's get this one used across the entire series.

According to the Matplotlib docs, we can reference it from a single source of truth using the following pattern:

import matplotlib.pyplot as plt
plt.style.use('./images/presentation.mplstyle')

I'd like to propose that we use the style sheet by doing the following:

  1. Place the matplotlibrc file in the project root directory.
  2. Reference it at the top of every notebook (I'll take care of that for the other notebooks I've written), using the following pattern:
import matplotlib.pyplot as plt
from pyprojroot import here
plt.style.use(here() / "matplotlibrc")

What do you think, @hugobowne?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

HBA to move matplotlibrc into config/matplotibrc

and load at top of both NBs.

@@ -0,0 +1,19 @@
import numpy as np
Copy link
Owner

Choose a reason for hiding this comment

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

The utils.py module can probably be moved to the path src/bayes_tutorial/utils.py, which would allow us to use it across all of the notebooks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

HBA to do

Comment on lines +11 to +13
def despine(ax):
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
Copy link
Owner

Choose a reason for hiding this comment

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

With the matplotlibrc file in place, do we need this function? If so, we keep it.

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 don't think I wrote any of this 👯‍♂️

Comment on lines +16 to +19
def despine_traceplot(traceplot):
for row in traceplot:
for ax in row:
despine(ax)
Copy link
Owner

Choose a reason for hiding this comment

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

Ditto with this function; if we have matplotlibrc, is this function still needed? If so, we keep it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👯‍♂️

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

Successfully merging this pull request may close these issues.

2 participants