Skip to content

Add documentation note about data standardization for ARD kernels#2751

Open
r69shabh wants to merge 1 commit into
cornellius-gp:mainfrom
r69shabh:fix/issue-724-standardize-data-note
Open

Add documentation note about data standardization for ARD kernels#2751
r69shabh wants to merge 1 commit into
cornellius-gp:mainfrom
r69shabh:fix/issue-724-standardize-data-note

Conversation

@r69shabh
Copy link
Copy Markdown

@r69shabh r69shabh commented May 4, 2026

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.

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.
Copilot AI review requested due to automatic review settings May 4, 2026 07:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 RBFKernel recommending 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.
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