Skip to content

DOC clarify eigenvectors shape difference between PCA and KernelPCA - #34581

Merged
lorentzenchr merged 5 commits into
scikit-learn:mainfrom
Jihanvall:doc-kpca-eigenvectors
Dec 1, 2026
Merged

lorentzenchr merged 5 commits into
scikit-learn:mainfrom
Jihanvall:doc-kpca-eigenvectors

Conversation

@Jihanvall

Copy link
Copy Markdown
Contributor

Reference Issues/PRs

Fixes #17171

What does this implement/fix? Explain your changes.

This PR adds a clarifying note in the KernelPCA documentation (doc/modules/decomposition.rst) explaining why the eigenvectors shape differs between standard PCA and KernelPCA:

  • PCA eigenvectors (components_): shape (n_components, n_features) — computed in the original feature space.
  • KernelPCA eigenvectors (alphas_): shape (n_samples, n_components) — computed via eigen-decomposition on the (n_samples, n_samples) Gram/Kernel matrix.

This helps prevent confusion for users expecting alphas_ to depend on n_features.

First time contributor introduction

I am an AI and Data Science engineer and a first-time contributor to scikit-learn. I wanted to clarify this subtle documentation detail after working with PCA and KernelPCA to make it easier for future users to understand the shape differences.

AI usage disclosure

I used AI assistance for:

  • Documentation (including examples)
  • Research and understanding

Any other comments?

None.

@github-actions

Copy link
Copy Markdown

Thank you for opening your first pull request to scikit-learn! 🎉

To help get your contribution reviewed, please make sure that:

  • You have filled out the pull request template.
  • The pull request addresses an existing issue that is ready for
    contribution (e.g. not tagged as "Needs Triage", "Needs Decision", ...).
    If you are proposing a new feature, please open an issue to discuss it first.
  • There are no other open pull requests already targeting the same issue.
  • You have followed the pull request checklist.
    In particular, linting and tests should pass.

@lorentzenchr lorentzenchr changed the title doc: clarify eigenvectors shape difference between PCA and KernelPCA DOC clarify eigenvectors shape difference between PCA and KernelPCA Nov 30, 2026

@lorentzenchr lorentzenchr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for this doc improvement.

@lorentzenchr
lorentzenchr enabled auto-merge (squash) November 30, 2026 21:13
@github-actions github-actions Bot added the CI:Linter failure The linter CI is failing on this PR label Nov 30, 2026
@lorentzenchr

Copy link
Copy Markdown
Member

@Jihanvall Could you fix the linter errors?

auto-merge was automatically disabled December 1, 2026 08:31

Head branch was pushed to by a user without write access

@github-actions github-actions Bot removed the CI:Linter failure The linter CI is failing on this PR label Dec 1, 2026
@Jihanvall

Copy link
Copy Markdown
Contributor Author

@lorentzenchr Fixed the trailing whitespace, thanks for the review!

@lorentzenchr
lorentzenchr merged commit e8d44c9 into scikit-learn:main Dec 1, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to get eigenvectors of kernel pca

2 participants