Skip to content

Scale isolated label ASW - #371

Merged
mumichae merged 1 commit into
mainfrom
fix/scale_isolated_asw
Feb 2, 2023
Merged

mumichae merged 1 commit into
mainfrom
fix/scale_isolated_asw

Conversation

@mumichae

@mumichae mumichae commented Feb 1, 2023

Copy link
Copy Markdown
Collaborator

Isolated label ASW is not scaled, so that the expected output range would be between -1 and +1

# AWS score between isolated label vs rest
if "silhouette_temp" not in adata.obs:
adata.obs["silhouette_temp"] = silhouette_samples(
adata.obsm[embed], adata.obs[label_key]
)
# aggregate silhouette scores for isolated label only
score = adata.obs[adata.obs[label_key] == isolated_label].silhouette_temp.mean()
if verbose:
print(f"{isolated_label}: {score}")
return score

Solution: Add scaling option to metric

@codecov

codecov Bot commented Feb 1, 2023

Copy link
Copy Markdown

Codecov Report

Merging #371 (225adf6) into main (98ee9a2) will increase coverage by 0.05%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #371      +/-   ##
==========================================
+ Coverage   53.13%   53.18%   +0.05%     
==========================================
  Files          22       22              
  Lines        1850     1852       +2     
==========================================
+ Hits          983      985       +2     
  Misses        867      867              
Flag Coverage Δ
unittests 53.18% <100.00%> (+0.05%) ⬆️

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

Impacted Files Coverage Δ
scib/metrics/isolated_labels.py 92.98% <100.00%> (+0.25%) ⬆️

@danielStrobl danielStrobl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Was wondering about that test_isolated_labels_silhouette one, it's a duplicate from test_isolated_label_metrics.py, right?

@LuckyMD LuckyMD left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. The same scaling as in cell type ASW, and it's scaled per label, so each label has equal weight.

@LuckyMD

LuckyMD commented Feb 1, 2023

Copy link
Copy Markdown
Collaborator

We'll need a new release and then an open problems PR to pin to that release @danielStrobl

@mumichae
mumichae merged commit c42935b into main Feb 2, 2023
@mumichae
mumichae deleted the fix/scale_isolated_asw branch February 2, 2023 09:10
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.

3 participants