Repository navigation
Fit PCA in batches to overcome LAPACK memory overflow - #4869
kushaangupta wants to merge 3 commits into
Conversation
Add a configurable 64 MiB waveform input budget for by_channel_global fitting, read batches before reshaping, and cap augmented SVD dimensions below the 32-bit LAPACK limit. Preserve input ordering, sparse channel handling and existing update boundaries for small units. Document numerical implications and cover NumPy/Zarr reads, complete input coverage and extension round trips.
Share waveform batching with mode-specific PCA row and feature counts. Preserve each channel model update order and reuse local workers across bounded batches. Cover dense and sparse NumPy/Zarr fitting across all modes, and compare serial with spawn-worker local results.
|
Thanks for this @kushaangupta, good catch that's funny that we are hitting the 32-bit indexing limit on these matrices 😂 This is a nice approach but I wonder if it could be more targetted to fix only the bug at hand, rather than extending to provide general memory handling. Fundamentally the main thing we want to avoid is passing too large matrices to partial fit and batch them instead, e.g. I think this could be achieved with something like the below helper: This is basically the approach IncrementalPCA is taking. |
I agree with @JoeZiminski @kushaangupta what do you think? Can you apply the suggested change? |
Fixes #4868
max_fit_batch_memory="64Mi"for PCA fitting. The 64 MiB default is a proposed input-buffer budget, not a measured optimum or a bound on total process RAM.slice_rows()before reshaping. This supports NumPy and Zarr storage and avoids first copying the whole unit.