Skip to content

Commit

Permalink
Update isolated_labels.py
Browse files Browse the repository at this point in the history
  • Loading branch information
danielStrobl authored Jan 27, 2023
1 parent 1be0daa commit f6090be
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scib/metrics/isolated_labels.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pandas as pd
from sklearn.metrics import f1_score
from sklearn.metrics import silhouette_samples

from .clustering import cluster_optimal_resolution
from .silhouette import silhouette
Expand Down Expand Up @@ -227,7 +228,8 @@ def max_f1(adata, label_key, cluster_key, label, argmax=False):
else:
# AWS score between isolated label vs rest
adata.obs[iso_label_key] = adata.obs[label_key] == isolated_label
score = silhouette(adata, iso_label_key, embed)
adata.obs['silhouette_temp'] = silhouette_samples(adata.obsm[embed], adata.obs[iso_label_key])
score = adata.obs[adata.obs[iso_label_key]].silhouette_temp.mean()

if verbose:
print(f"{isolated_label}: {score}")
Expand Down

0 comments on commit f6090be

Please sign in to comment.