Skip to content

Fix PCA regression error for sparse matrices - #364

Merged
mumichae merged 2 commits into
mainfrom
fix_pcr_sparse
Feb 2, 2023
Merged

mumichae merged 2 commits into
mainfrom
fix_pcr_sparse

Conversation

@mumichae

Copy link
Copy Markdown
Collaborator

Closes #291

Error occurs in scib.me.cell_cycle and is rooted in scib.me.pc_regression.

When the number of features of the input matrix is smaller or equal to the number of PCA components (n_comps) the svd_solver is set to "full", which doesn't work with sparse matrices.

Solution
Whenever n_comps >= min(matrix.shape), convert to dense matrix

@mumichae
mumichae requested review from LuckyMD and MxMstrmn and removed request for MxMstrmn January 11, 2023 17:17
@codecov

codecov Bot commented Jan 11, 2023 •

Copy link
Copy Markdown

Codecov Report

Merging #364 (fbaa568) into main (c42935b) will increase coverage by 0.15%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #364      +/-   ##
==========================================
+ Coverage   53.18%   53.34%   +0.15%     
==========================================
  Files          22       22              
  Lines        1852     1854       +2     
==========================================
+ Hits          985      989       +4     
+ Misses        867      865       -2     
Flag Coverage Δ
unittests 53.34% <100.00%> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
scib/metrics/pcr.py 81.94% <100.00%> (+3.37%) ⬆️

@mumichae
mumichae merged commit 24069c6 into main Feb 2, 2023
@mumichae
mumichae deleted the fix_pcr_sparse branch February 2, 2023 14:40
barlowa124 pushed a commit to barlowa124/scib that referenced this pull request Dec 4, 2026
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.

Cell_cycle error: svd_solver can not be used with sparse input

2 participants