Repository navigation
DOC Fix Matern nu=5/2 formula typo and paired_manhattan_distances off-by-one docstring - #34349
Closed
AYUSHPALLAV1 wants to merge 1 commit into
Closed
AYUSHPALLAV1 wants to merge 1 commit into
AYUSHPALLAV1 wants to merge 1 commit into
Conversation
Fix off-by-one indexing in paired_manhattan_distances docstring (scikit-learn#34315): The docstring described distances as computed up to (X[n_samples], Y[n_samples]), which is an IndexError in Python. Corrected to (X[n_samples - 1], Y[n_samples - 1]) to accurately reflect 0-based indexing. Fix missing square in Matern nu=5/2 formula in user guide (scikit-learn#34283): The closed-form expression for the Matern kernel with nu=5/2 had a typo: the quadratic term read 5/(3l)*d^2 but should be 5/(3l^2)*d^2, consistent with Rasmussen & Williams (2006) p.84 and the actual implementation in kernels.py.
|
Thank you for opening your first pull request to scikit-learn! 🎉 To help get your contribution reviewed, please make sure that:
|
virchan
reviewed
Jun 20, 2026
virchan
left a comment
Member
There was a problem hiding this comment.
Thank you for your interest in contributing to scikit-learn, @AYUSHPALLAV1.
The changes appear to be largely automated, and do not show sufficient human review. With that said, I'm closing this PR as spam.
If you'd like to contribute to scikit-learn meaningfully, please review the following resources first:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference Issues/PRs
Fixes #34315
Fixes #34283
What does this implement/fix?
Fix 1 — Off-by-one in
paired_manhattan_distancesdocstring (#34315)The docstring described the last computed pair as
(X[n_samples], Y[n_samples]), which would raiseIndexErrorin Python. Valid indices for an array ofn_sampleselements are0ton_samples - 1. Updated to(X[n_samples - 1], Y[n_samples - 1]).Fix 2 — Missing exponent in Matern kernel nu=5/2 formula (#34283)
The closed-form Matern nu=5/2 formula in
doc/modules/gaussian_process.rsthad a typo in the quadratic term:5 / (3l) * d^25 / (3l^2) * d^2This is consistent with:
kernels.pyimplementation:K = dists * sqrt(5)(already divided byl), thenK**2 / 3.0, which expands to5/(3l^2) * d^2First time contributor introduction
I am an ML student who uses scikit-learn extensively for research in Gaussian Processes and metric learning. I found these issues while studying the source code and documentation.
AI usage disclosure
I used AI-assisted tooling to verify the mathematical correctness against the reference implementation and the Rasmussen & Williams textbook.