CCA Module¶
src/fed_maxfuse/correlation_utils/
Canonical correlation analysis, centralized and federated. Conceptual background: Iterative Federated CCA.
Layout¶
| Path | Role |
|---|---|
cca/centralized/ |
Reference CCA (delegates to scikit-learn) |
cca/distributed/pls_w2a_node.py |
PLSw2aNode — federated Two-block Mode B PLS |
cca/distributed/pseudo_cca_node.py |
Pseudo-CCA variant |
cca/functions.py |
Shared CCA helpers |
pearson/correlation.py |
Pearson correlation |
PLSw2aNode¶
Node-side implementation of Two-block Mode B PLS, decomposed so the singular-vector search can be distributed.
PLSw2aNode(n_components: int, max_iter: int = 500, target: bool = False)
| Method | Corresponds to |
|---|---|
init_fit(data) |
Normalise the view: \(X^i_1 \leftarrow \texttt{normalize}(X^i)\) |
fit_start_iter(randomness_init_ratio) |
NoiseInterpolation — initialise latent scores without sharing a real data column |
fit_svpm_iter(...) |
One singular-vector power-method iteration |
sign_for_svd_flip(weights) |
Sign convention — forces the largest-magnitude element positive |
fit_finish_iter(...) |
Scores, loadings, deflation |
fit_finish() |
Assemble \(U\), \(\Gamma\) |
transform(data) |
Project: \(U\Gamma^\top X\) |
Why Mode B PLS rather than classical CCA¶
Classical CCA overfits when features greatly outnumber samples, which is the single-cell regime. Two-block Mode B PLS weights indicators by predictive association and is robust when indicator quality is heterogeneous. It also decomposes: four of five per-component steps are purely local, leaving one coupled step to federate.
What crosses the wire¶
Only latent score vectors \(\xi_k, \omega_k\) (length \(N\) = samples) and a scalar convergence norm \(\delta\). Never weight vectors, which live in feature space.
CCAType¶
Selects the implementation:
| Value | Meaning |
|---|---|
sklearn |
scikit-learn CCA (centralized reference) |
pseudo |
Pseudo-CCA variant |
plswtb |
Two-block Mode B PLS |
plswtb_rand_init |
Mode B PLS with noise-interpolated initialisation |
Configuration¶
"cca": {
"randomness": 0.6,
"components": 20,
"max_loop_iterations": 2000,
"bad_filter_wt": 0.0
}
| Key | Symbol | Notes |
|---|---|---|
components |
\(C\) | Shared components |
max_loop_iterations |
\(K\) | SVPM iteration cap; a large value is recommended |
randomness |
\(w\) | 0.6 recommended; 0.0 shares a real data column |
bad_filter_wt |
— | Pairs dropped before each internal CCA fit |
Cost
Message complexity is \(T \times C \times K\) round trips in the worst case, the dominant cost of the system.