From a89d2fa2ab5fd9394e2c0fd9b39435945c7439e0 Mon Sep 17 00:00:00 2001 From: caokai1073 Date: Tue, 28 Jun 2022 09:33:12 +0800 Subject: [PATCH] update --- docs/source/examples/.DS_Store | Bin 6148 -> 6148 bytes .../examples/PBMC/pbmc_integration.ipynb | 40 +++++++++++++++--- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/docs/source/examples/.DS_Store b/docs/source/examples/.DS_Store index 63902559431d51a924e5c69be8f79cf3f8304032..d3ed87fcbe3c805a65537f0fbf3a98b0e3bff965 100644 GIT binary patch delta 83 zcmZoMXfc=|#>B)qu~2NHo}wrl0|Nsi1A_nqLj{8#LlHwULy2e3#=_-{jBJ~eSe7zx jYzSl8%+A5j0o1ZtkmEb^WPTAx4xlEGE|$#^B5Rld@R1RX delta 144 zcmZoMXfc=|#>B!ku~2NHo}wr_0|Nsi1A_nqLq0CLp($7=7-G7ne{zIJb7&b?UtYHQK4MZY4 diff --git a/docs/source/examples/PBMC/pbmc_integration.ipynb b/docs/source/examples/PBMC/pbmc_integration.ipynb index 3f24a50..d289bc6 100644 --- a/docs/source/examples/PBMC/pbmc_integration.ipynb +++ b/docs/source/examples/PBMC/pbmc_integration.ipynb @@ -382,7 +382,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "Epochs: 100%|█████████████████████████████████| 345/345 [14:19<00:00, 2.49s/it, recloss=1143.28,klloss=12.49,otloss=5.70]\n" + "Epochs: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 345/345 [14:24<00:00, 2.51s/it, recloss=1143.28,klloss=12.49,otloss=5.70]\n" ] } ], @@ -453,6 +453,36 @@ "sc.pl.umap(adata, color=['source', 'cell_type'])" ] }, + { + "cell_type": "code", + "execution_count": 14, + "id": "de71e6ba", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "F1: 0.7776889599431566\n", + "ARI: 0.6321860186421134\n", + "NMI: 0.6718827954523922\n", + "Batch Entropy: 0.5858338812322246\n", + "Silhouette: 0.5916472971439362\n" + ] + } + ], + "source": [ + "adata1 = adata[adata.obs['domain_id']=='0']\n", + "adata2 = adata[adata.obs['domain_id']=='1']\n", + "y_test = up.metrics.label_transfer(adata2, adata1, label='cell_type', rep='X_umap')\n", + "from sklearn.metrics import adjusted_rand_score, normalized_mutual_info_score, f1_score\n", + "print('F1:', f1_score(adata1.obs['cell_type'], y_test, average='micro'))\n", + "print('ARI:', adjusted_rand_score(adata1.obs['cell_type'], y_test))\n", + "print('NMI:', normalized_mutual_info_score(adata1.obs['cell_type'], y_test))\n", + "print('Batch Entropy:', up.metrics.batch_entropy_mixing_score(adata.obsm['X_umap'], adata.obs['domain_id']))\n", + "print('Silhouette:', up.metrics.silhouette(adata.obsm['X_umap'], adata.obs['cell_type']))" + ] + }, { "cell_type": "markdown", "id": "7f23a7ea", @@ -464,7 +494,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 15, "id": "d6c480b2", "metadata": {}, "outputs": [], @@ -474,7 +504,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 16, "id": "5561c6b3", "metadata": {}, "outputs": [ @@ -519,7 +549,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 17, "id": "5eb7b985", "metadata": {}, "outputs": [ @@ -591,7 +621,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 18, "id": "b5851da3", "metadata": {}, "outputs": [