-
Notifications
You must be signed in to change notification settings - Fork 521
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
ENH Rework narrative of GBDT notebook #763
Conversation
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.
Here are some comments.
|
||
# %% | ||
import pandas as pd | ||
import numpy as np | ||
|
||
# Create a random number generator that will be used to set the randomness | ||
rng = np.random.RandomState(0) | ||
rng = np.random.RandomState(0) # Create a random number generator |
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.
Let's move the generator next to the data generation. We should avoid showing a pattern where people would use the generator across different function and estimators.
So the best practice is just to show it next to the data generation. we could even slightly change the code and have:
def generate_data(n_samples=50, seed=0):
rng = np.random.default_rng(seed)
x = rng.normal(size=(n_samples,)) * ...
noise = rng.normal(size=(s_samples,)) * 0.3
using default_rng
should be encourage nowadays.
Co-authored-by: ArturoAmorQ <[email protected]> Co-authored-by: Guillaume Lemaitre <[email protected]> 31bfaaf
Originally I wanted to rework only the wording, as well explaining the GBDT algo is the cornerstone for understanding HGBT. But then I decided to factorize the code by introducing a helper function to keep the focus on the narrative other than the code.