Add documentation note about data standardization for ARD kernels#2751
Open
r69shabh wants to merge 1 commit into
Open
Add documentation note about data standardization for ARD kernels#2751r69shabh wants to merge 1 commit into
r69shabh wants to merge 1 commit into
Conversation
Addresses issue cornellius-gp#724: Add warning about zero gradients with high-variance data For ARD kernels (when ard_num_dims is not None), input data with very different scales across dimensions can cause the kernel matrix to numerically underflow to zero, resulting in zero gradients for lengthscale parameters during training. This change adds a note to the RBFKernel and MaternKernel docstrings recommending data standardization for numerical stability.
There was a problem hiding this comment.
Pull request overview
Adds documentation guidance to help users avoid numerical underflow / zero-gradient issues when using ARD kernels with poorly scaled inputs.
Changes:
- Add an ARD-specific documentation note to
RBFKernelrecommending input standardization for numerical stability. - Add the same ARD-specific documentation note to
MaternKernel.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| gpytorch/kernels/rbf_kernel.py | Adds a docstring note warning about ARD + unstandardized inputs causing numerical underflow and zero gradients. |
| gpytorch/kernels/matern_kernel.py | Adds the same docstring note for Matern ARD usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+36
to
+41
| For ARD kernels (when :attr:`ard_num_dims` is not None), it is highly recommended | ||
| to standardize the input data (e.g., subtract the mean and divide by the standard | ||
| deviation) before passing it to the kernel. With input data that has very different | ||
| scales across dimensions, the kernel matrix can numerically underflow to zero, | ||
| causing zero gradients for the lengthscale parameters. Standardizing the data | ||
| ensures numerical stability and proper gradient flow during training. |
Comment on lines
+44
to
+49
| For ARD kernels (when :attr:`ard_num_dims` is not None), it is highly recommended | ||
| to standardize the input data (e.g., subtract the mean and divide by the standard | ||
| deviation) before passing it to the kernel. With input data that has very different | ||
| scales across dimensions, the kernel matrix can numerically underflow to zero, | ||
| causing zero gradients for the lengthscale parameters. Standardizing the data | ||
| ensures numerical stability and proper gradient flow during training. |
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.
Addresses issue #724: Add warning about zero gradients with high-variance data
For ARD kernels (when ard_num_dims is not None), input data with very different scales across dimensions can cause the kernel matrix to numerically underflow to zero, resulting in zero gradients for lengthscale parameters during training.
This change adds a note to the RBFKernel and MaternKernel docstrings recommending data standardization for numerical stability.