Repository navigation
[MRG] Solve the TCA generalized eigenproblem instead of symmetrizing its product - #376
Open
AHMETHAKANBEZIR1 wants to merge 1 commit into
Open
AHMETHAKANBEZIR1 wants to merge 1 commit into
AHMETHAKANBEZIR1 wants to merge 1 commit into
Conversation
Co-authored-by: OpenAI Codex <codex@openai.com>
This was referenced Oct 22, 2026
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.
Summary
TCA passes A^-1 B to numpy.linalg.eigh even though that product is generally non-symmetric (A=I+muKLK, B=KH*K). eigh reads a single triangle, so the fitted directions need not solve the intended eigenproblem. Use scipy.linalg.eigh(B, A) directly and select the largest algebraic eigenvalues. Keep unit Euclidean column norms to retain the previous component-scale convention. The public mu parametrization is preserved and its reciprocal relationship to the paper's ridge is documented rather than silently changed.
Fixes #372. Thanks to VictorBauler for the report and suggested generalized formulation. No other open TCA/eigenvalue PR or issue ownership was found; the separate #371 weights report is not included.
Validation
Unmodified main, six new kernel/regularization cases: 4 fail and 2 passing mu=0 controls.
Final test_subspace.py: 20 passed, 11 optional-PyTorch skips.
Official Minimal CI profile (
pytest skada -m "not dataset"): 265 passed, 19 skipped, 98 deselected, 4 xfailed, with existing warnings visible. This is the supported base-dependency profile, not full optional-deep or downloaded-dataset coverage.Full configured pre-commit: all seven hooks pass; installed commit hooks are retained. Diff check passes. Windows checkout line endings were normalized locally; the diff contains only the two intended files.
The regression checks B W = A W Lambda on actual fitted components, leading eigenvalues using an independent Cholesky-whitened ordinary eigensolver, existing unit-column norms and transform consistency. It covers linear and RBF kernels with mu=0,0.1,2. Eigenvector signs are not fixed by the test. This establishes the spectral correction; no improved prediction score on a new dataset is claimed.
Python3.12.14 / NumPy2.5.4 / SciPy1.18.1 / scikit-learn1.9.1 / pandas3.1.0 / POT0.9.7.post1. No new dependency is added: scipy.linalg is already imported. No GPU or optional deep-path claim.
The generalized formulation follows the leading-eigenvector problem in Pan et al., Domain Adaptation via Transfer Component Analysis (2011), section III-C: https://home.cse.ust.hk/~qyang/Docs/2011/05640675.pdf . The existing docstring reference is retained with a narrative explanation of the solver and mu convention.
AI disclosure: the account owner requested OSS contributions. OpenAI Codex performed all technical analysis, implementation, tests and this description; the account owner has not independently reviewed the code. Normal maintainer review is requested; acceptance is not assumed.
Integration check: these three independent PR heads (#376/#377/#378) were applied together to a private worktree based on main 31f2ff8. The official base-dependency Minimal CI profile passed with 273 passed, 21 skipped, 98 deselected and 4 xfailed. The combined scorer/subspace tests and metrics doctest also passed in the separate Torch CPU environment (72 passed). This is a local compatibility check, not an upstream merge or remote-CI result. GitHub Testing workflows currently require maintainer approval.