Skip to content

Conversation

@joon0390
Copy link

@joon0390 joon0390 commented Oct 2, 2025

Summary

This PR adds an n_components option to the BayesianPCA class, allowing users to directly specify the latent dimensionality instead of being forced to use d-1.

Changes

  • BayesianPCA.__init__ now accepts n_components (default: None).
  • If n_components is not provided, it falls back to the original behavior (q = d - 1).
  • Added fallback handling when eff_dim is empty (use all components).
  • Updated docstring for clarity.

Motivation

Currently, BayesianPCA always uses d-1 latent dimensions, which is impractical for high-dimensional datasets.
This update improves usability by letting researchers control the number of latent dimensions (e.g., 10, 20, …), similar to scikit-learn's PCA API.

Validation

  • Verified on real fMRI FC dataset (ROI=300): stable latent representations produced.

Checklist

  • Code runs without errors
  • Works with both default (d-1) and user-specified latent dimensions
  • Eff-dim fallback tested

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