-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
DOC Fix UserWarning in plot_gpr_prior_posterior #29268
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
❌ Linting issuesThis PR is introducing linting issues. Here's a summary of the issues. Note that you can avoid having linting issues by enabling You can see the details of the linting issues under the
|
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.
Hi @ovenpickled, thanks for the PR. Here is a first batch of comments. I just have to mention that I have the impression that you used an LLM to assist you with this issue. Even if using them is not discouraged per se, do try to keep the quality of the codebase by:
- avoiding repeated imports
- keeping line length below 88 characters
- not making unrelated changes
- most importantly: do not contribute code that you don't understand
from sklearn.gaussian_process import GaussianProcessRegressor | ||
from sklearn.gaussian_process.kernels import ConstantKernel, DotProduct | ||
from sklearn.preprocessing import StandardScaler | ||
import matplotlib.pyplot as plt |
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.
matplotlib.pyplot
is already imported in line 33
GaussianProcessRegressor
is already imported in line 100
from sklearn.gaussian_process import GaussianProcessRegressor | |
from sklearn.gaussian_process.kernels import ConstantKernel, DotProduct | |
from sklearn.preprocessing import StandardScaler | |
import matplotlib.pyplot as plt | |
from sklearn.gaussian_process.kernels import ConstantKernel, DotProduct | |
from sklearn.preprocessing import StandardScaler |
# Define the kernel | ||
kernel = ConstantKernel(0.1, (0.01, 10.0)) * (DotProduct(sigma_0=1.0, sigma_0_bounds=(0.1, 10.0)) ** 2) |
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.
Please avoid unrelated changes.
# Define the kernel | |
kernel = ConstantKernel(0.1, (0.01, 10.0)) * (DotProduct(sigma_0=1.0, sigma_0_bounds=(0.1, 10.0)) ** 2) | |
kernel = ConstantKernel(0.1, (0.01, 10.0)) * ( | |
DotProduct(sigma_0=1.0, sigma_0_bounds=(0.1, 10.0)) ** 2 | |
) |
|
||
# plot prior | ||
# Increase the number of iterations | ||
gpr = GaussianProcessRegressor(kernel=kernel, random_state=0, n_restarts_optimizer=10, optimizer='fmin_l_bfgs_b') |
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.
Adding comments to the code is mostly required when showing the reasoning behind a complex decision, for instance here, a comment would rather explain the need for the "fmin_l_bfgs_b" optimizer.
Also, try to keep lines under 88 characters (see the linter comment on this PR).
Hi @ovenpickled are you still working on this PR? It actually suffices to set |
yess sure |
Reference Issues/PRs
Fixes #29055
What does this implement/fix? Explain your changes.
The dev documentation on the Scikit-learn website displayed an error while executing the dot product kernel code block. I scaled the data as the error requested and increased the number of iterations.
Any other comments?