{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Sub-clustering and LRP weight plot" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import copy\n", "import numpy as np\n", "import pandas as pd\n", "import scanpy as sc\n", "import os.path as osp\n", "import matplotlib.pyplot as plt\n", "from typing import List, Union, Literal\n", "\n", "import STCase\n", "\n", "# Define input parameters directly or through interactive widgets\n", "class Args:\n", " def __init__(self, root: str, ds_dir: str, ds_name: str,\n", " h5_name: str, label_col_name: str, n_nei: int, target_types: List[str]=[],\n", " bad_types: List[str]=[], n_clusters: int=-1, alpha: float=0.0, reso: float=None,\n", " init: Union[Literal[\"one\"], Literal[\"std\"], Literal[\"re_sum\"], Literal[\"sum\"]]='one', \n", " gpu: int=0, use_gpu: bool=False, wo_anno: bool=False, region_col_name: str='NULL'):\n", " self.root = root\n", " self.ds_dir = ds_dir\n", " self.ds_name = ds_name\n", " self.h5_name = h5_name\n", " self.label_col_name = label_col_name\n", " self.target_types = target_types\n", " self.bad_types = bad_types\n", " self.n_nei = n_nei\n", " self.n_clusters = n_clusters\n", " self.alpha = alpha\n", " self.reso = reso\n", " self.init = init\n", " self.gpu = gpu\n", " self.use_gpu = use_gpu\n", " self.wo_anno = wo_anno\n", " self.region_col_name = region_col_name\n", "\n", "# Usage:\n", "test_args = Args(root='./tests/', ds_dir='datasets/', ds_name='NC_OSCC_s1', \n", " h5_name='s1_nohvg_stringent', target_types=['SCC'], \n", " gpu=1, use_gpu=True, n_nei=6, n_clusters=3, alpha=0.25,\n", " label_col_name='cell_type', region_col_name='cluster_annotations')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Prepare args for sub-clustering" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Input ST data: AnnData object with n_obs × n_vars = 1131 × 18100\n", " obs: 'pathologist_anno.x', 'sample_id.x', 'cluster_annotations', 'cell_type', 'n_genes_by_counts', \n", "'log1p_n_genes_by_counts', 'total_counts', 'log1p_total_counts', 'pct_counts_in_top_50_genes', \n", "'pct_counts_in_top_100_genes', 'pct_counts_in_top_200_genes', 'pct_counts_in_top_500_genes', 'total_counts_mt', \n", "'log1p_total_counts_mt', 'pct_counts_mt', 'n_genes'\n", " var: 'gene_ids', 'feature_types', 'genome', 'mt', 'n_cells_by_counts', 'mean_counts', 'log1p_mean_counts', \n", "'pct_dropout_by_counts', 'total_counts', 'log1p_total_counts', 'n_cells'\n", " uns: 'Cell_neighbors', 'LR_cell_weight', 'LR_celltype_aggregate_weight', 'LR_celltype_edge_num', \n", "'LR_celltype_mean_weight', 'LR_celltype_weight', 'LR_close_gene', 'LR_close_gene_exp', 'LR_gene_complex_exp', \n", "'LR_gene_complex_information', 'LR_pair_information', 'LR_pathway_cell_weight', 'LR_pathway_celltype_count', \n", "'LR_pathway_celltype_edge_num', 'LR_pathway_celltype_mean_weight', 'LR_pathway_celltype_weight', \n", "'cell_type_colors', 'cell_type_list', 'cluster_annotations_colors', 'log1p', 'radius', 'scenic_res', 'spatial'\n", " obsm: 'distances', 'spatial'\n", "\n" ], "text/plain": [ "Input ST data: AnnData object with n_obs × n_vars = \u001b[1;36m1131\u001b[0m × \u001b[1;36m18100\u001b[0m\n", " obs: \u001b[32m'pathologist_anno.x'\u001b[0m, \u001b[32m'sample_id.x'\u001b[0m, \u001b[32m'cluster_annotations'\u001b[0m, \u001b[32m'cell_type'\u001b[0m, \u001b[32m'n_genes_by_counts'\u001b[0m, \n", "\u001b[32m'log1p_n_genes_by_counts'\u001b[0m, \u001b[32m'total_counts'\u001b[0m, \u001b[32m'log1p_total_counts'\u001b[0m, \u001b[32m'pct_counts_in_top_50_genes'\u001b[0m, \n", "\u001b[32m'pct_counts_in_top_100_genes'\u001b[0m, \u001b[32m'pct_counts_in_top_200_genes'\u001b[0m, \u001b[32m'pct_counts_in_top_500_genes'\u001b[0m, \u001b[32m'total_counts_mt'\u001b[0m, \n", "\u001b[32m'log1p_total_counts_mt'\u001b[0m, \u001b[32m'pct_counts_mt'\u001b[0m, \u001b[32m'n_genes'\u001b[0m\n", " var: \u001b[32m'gene_ids'\u001b[0m, \u001b[32m'feature_types'\u001b[0m, \u001b[32m'genome'\u001b[0m, \u001b[32m'mt'\u001b[0m, \u001b[32m'n_cells_by_counts'\u001b[0m, \u001b[32m'mean_counts'\u001b[0m, \u001b[32m'log1p_mean_counts'\u001b[0m, \n", "\u001b[32m'pct_dropout_by_counts'\u001b[0m, \u001b[32m'total_counts'\u001b[0m, \u001b[32m'log1p_total_counts'\u001b[0m, \u001b[32m'n_cells'\u001b[0m\n", " uns: \u001b[32m'Cell_neighbors'\u001b[0m, \u001b[32m'LR_cell_weight'\u001b[0m, \u001b[32m'LR_celltype_aggregate_weight'\u001b[0m, \u001b[32m'LR_celltype_edge_num'\u001b[0m, \n", "\u001b[32m'LR_celltype_mean_weight'\u001b[0m, \u001b[32m'LR_celltype_weight'\u001b[0m, \u001b[32m'LR_close_gene'\u001b[0m, \u001b[32m'LR_close_gene_exp'\u001b[0m, \u001b[32m'LR_gene_complex_exp'\u001b[0m, \n", "\u001b[32m'LR_gene_complex_information'\u001b[0m, \u001b[32m'LR_pair_information'\u001b[0m, \u001b[32m'LR_pathway_cell_weight'\u001b[0m, \u001b[32m'LR_pathway_celltype_count'\u001b[0m, \n", "\u001b[32m'LR_pathway_celltype_edge_num'\u001b[0m, \u001b[32m'LR_pathway_celltype_mean_weight'\u001b[0m, \u001b[32m'LR_pathway_celltype_weight'\u001b[0m, \n", "\u001b[32m'cell_type_colors'\u001b[0m, \u001b[32m'cell_type_list'\u001b[0m, \u001b[32m'cluster_annotations_colors'\u001b[0m, \u001b[32m'log1p'\u001b[0m, \u001b[32m'radius'\u001b[0m, \u001b[32m'scenic_res'\u001b[0m, \u001b[32m'spatial'\u001b[0m\n", " obsm: \u001b[32m'distances'\u001b[0m, \u001b[32m'spatial'\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "WARNING: adata.X seems to be already log-transformed.\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/home/tid/mambaforge/envs/stcase/lib/python3.10/site-packages/scanpy/preprocessing/_highly_variable_genes.py:72: UserWarning: `flavor='seurat_v3'` expects raw count data, but non-integers were found.\n" ] }, { "data": { "text/html": [ "
318.1384907850702 5932 2.6224580017683468\n", "\n" ], "text/plain": [ "\u001b[1;36m318.1384907850702\u001b[0m \u001b[1;36m5932\u001b[0m \u001b[1;36m2.6224580017683468\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "
>>> Model and Training Details\n",
"\n"
],
"text/plain": [
">>> Model and Training Details\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"{\n", " 'root': './tests/',\n", " 'ds_dir': 'datasets/',\n", " 'ds_name': 'NC_OSCC_s1',\n", " 'h5_name': 's1_nohvg_stringent',\n", " 'label_col_name': 'cell_type',\n", " 'target_types': ['SCC'],\n", " 'bad_types': [],\n", " 'n_nei': 6,\n", " 'n_clusters': 3,\n", " 'alpha': 0.25,\n", " 'reso': None,\n", " 'init': 'one',\n", " 'gpu': 1,\n", " 'use_gpu': True,\n", " 'wo_anno': False,\n", " 'region_col_name': 'cluster_annotations',\n", " 'time_stamp': '0524_0642',\n", " 'raw_path': 'datasets/',\n", " 'data_path': 'generated/',\n", " 'model_path': 'model/',\n", " 'result_path': 'result/',\n", " 'embedding_data_path': 'embedding/',\n", " 'data_name': 'NC_OSCC_s1',\n", " 'device': 1,\n", " 'seed': 0,\n", " 'lr_cut': 'FULL',\n", " 'h': 10,\n", " 'n_input': 3000,\n", " 'num_epoch': 100,\n", " 'learning_rate': 0.001,\n", " 'use_norm': False,\n", " 'use_whole_gene': False\n", "}\n", "\n" ], "text/plain": [ "\u001b[1m{\u001b[0m\n", " \u001b[32m'root'\u001b[0m: \u001b[32m'./tests/'\u001b[0m,\n", " \u001b[32m'ds_dir'\u001b[0m: \u001b[32m'datasets/'\u001b[0m,\n", " \u001b[32m'ds_name'\u001b[0m: \u001b[32m'NC_OSCC_s1'\u001b[0m,\n", " \u001b[32m'h5_name'\u001b[0m: \u001b[32m's1_nohvg_stringent'\u001b[0m,\n", " \u001b[32m'label_col_name'\u001b[0m: \u001b[32m'cell_type'\u001b[0m,\n", " \u001b[32m'target_types'\u001b[0m: \u001b[1m[\u001b[0m\u001b[32m'SCC'\u001b[0m\u001b[1m]\u001b[0m,\n", " \u001b[32m'bad_types'\u001b[0m: \u001b[1m[\u001b[0m\u001b[1m]\u001b[0m,\n", " \u001b[32m'n_nei'\u001b[0m: \u001b[1;36m6\u001b[0m,\n", " \u001b[32m'n_clusters'\u001b[0m: \u001b[1;36m3\u001b[0m,\n", " \u001b[32m'alpha'\u001b[0m: \u001b[1;36m0.25\u001b[0m,\n", " \u001b[32m'reso'\u001b[0m: \u001b[3;35mNone\u001b[0m,\n", " \u001b[32m'init'\u001b[0m: \u001b[32m'one'\u001b[0m,\n", " \u001b[32m'gpu'\u001b[0m: \u001b[1;36m1\u001b[0m,\n", " \u001b[32m'use_gpu'\u001b[0m: \u001b[3;92mTrue\u001b[0m,\n", " \u001b[32m'wo_anno'\u001b[0m: \u001b[3;91mFalse\u001b[0m,\n", " \u001b[32m'region_col_name'\u001b[0m: \u001b[32m'cluster_annotations'\u001b[0m,\n", " \u001b[32m'time_stamp'\u001b[0m: \u001b[32m'0524_0642'\u001b[0m,\n", " \u001b[32m'raw_path'\u001b[0m: \u001b[32m'datasets/'\u001b[0m,\n", " \u001b[32m'data_path'\u001b[0m: \u001b[32m'generated/'\u001b[0m,\n", " \u001b[32m'model_path'\u001b[0m: \u001b[32m'model/'\u001b[0m,\n", " \u001b[32m'result_path'\u001b[0m: \u001b[32m'result/'\u001b[0m,\n", " \u001b[32m'embedding_data_path'\u001b[0m: \u001b[32m'embedding/'\u001b[0m,\n", " \u001b[32m'data_name'\u001b[0m: \u001b[32m'NC_OSCC_s1'\u001b[0m,\n", " \u001b[32m'device'\u001b[0m: \u001b[1;36m1\u001b[0m,\n", " \u001b[32m'seed'\u001b[0m: \u001b[1;36m0\u001b[0m,\n", " \u001b[32m'lr_cut'\u001b[0m: \u001b[32m'FULL'\u001b[0m,\n", " \u001b[32m'h'\u001b[0m: \u001b[1;36m10\u001b[0m,\n", " \u001b[32m'n_input'\u001b[0m: \u001b[1;36m3000\u001b[0m,\n", " \u001b[32m'num_epoch'\u001b[0m: \u001b[1;36m100\u001b[0m,\n", " \u001b[32m'learning_rate'\u001b[0m: \u001b[1;36m0.001\u001b[0m,\n", " \u001b[32m'use_norm'\u001b[0m: \u001b[3;91mFalse\u001b[0m,\n", " \u001b[32m'use_whole_gene'\u001b[0m: \u001b[3;91mFalse\u001b[0m\n", "\u001b[1m}\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
>>> For SCC spots\n",
"\n"
],
"text/plain": [
">>> For SCC spots\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"X: (1131, 3000)\n", "\n" ], "text/plain": [ "X: \u001b[1m(\u001b[0m\u001b[1;36m1131\u001b[0m, \u001b[1;36m3000\u001b[0m\u001b[1m)\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "c91a3eabba344e6fbbe0794f252997a3", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Output()" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n" ], "text/plain": [] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n",
"\n"
],
"text/plain": [
"\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
">>> Cache exisits: generated/NC_OSCC_s1/pre_cluster_adj_5.pkl\n",
"\n"
],
"text/plain": [
">>> Cache exisits: generated/NC_OSCC_s1/pre_cluster_adj_5.pkl\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"Edges in Adj for SCC: 1422\n",
"\n"
],
"text/plain": [
"Edges in Adj for SCC: \u001b[1;36m1422\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"Edges in Adj' for SCC: 626\n",
"\n"
],
"text/plain": [
"Edges in Adj' for SCC: \u001b[1;36m626\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "43eca7cbbcdc4e0f9bb670b728a5b034",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n"
],
"text/plain": []
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
"\n"
],
"text/plain": [
"\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"#Interaction without edges=555\n", "\n" ], "text/plain": [ "#Interaction without \u001b[33medges\u001b[0m=\u001b[1;36m555\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
#Interaction without std=279\n", "\n" ], "text/plain": [ "#Interaction without \u001b[33mstd\u001b[0m=\u001b[1;36m279\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "8b5a0ea7888342269a21d3243032f945", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Output()" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n" ], "text/plain": [] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n",
"\n"
],
"text/plain": [
"\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"#Interaction without edges after replacing=0\n", "\n" ], "text/plain": [ "#Interaction without edges after \u001b[33mreplacing\u001b[0m=\u001b[1;36m0\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
Use 1513 LR pairs\n",
"\n"
],
"text/plain": [
"Use \u001b[1;36m1513\u001b[0m LR pairs\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
">>> STCase sub-clustering...\n",
"\n"
],
"text/plain": [
">>> STCase sub-clustering\u001b[33m...\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Initial LR pairs' lambda Parameter containing:\n",
"tensor([[1.],\n",
" [1.],\n",
" [1.],\n",
" ...,\n",
" [1.],\n",
" [1.],\n",
" [1.]], requires_grad=True)\n"
]
},
{
"data": {
"text/html": [
">>> Epoch: 100, Loss: 0.00046\n", "\n" ], "text/plain": [ ">>> Epoch: \u001b[1;36m100\u001b[0m, Loss: \u001b[1;36m0.00046\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
time: 80.588, l_sp: 0.0005\n", "\n" ], "text/plain": [ "time: \u001b[1;36m80.588\u001b[0m, l_sp: \u001b[1;36m0.0005\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
Min Loss: 0.00046268512960523367\n",
"\n"
],
"text/plain": [
"Min Loss: \u001b[1;36m0.00046268512960523367\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
">>> Drawing map\n",
"\n"
],
"text/plain": [
">>> Drawing map\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/tid/projects/STACCI/STACCI/utils.py:175: FutureWarning: In the future, the default backend for leiden will be igraph instead of leidenalg.\n",
"\n",
" To achieve the future defaults please pass: flavor=\"igraph\" and n_iterations=2. directed must also be False to work with igraph's implementation.\n"
]
},
{
"data": {
"text/html": [
"Resolution: 0.19999999999999998\n",
"\n"
],
"text/plain": [
"Resolution: \u001b[1;36m0.19999999999999998\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"3 clusters in drawing...\n", "\n" ], "text/plain": [ "\u001b[1;36m3\u001b[0m clusters in drawing\u001b[33m...\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
>>> Similarity Matrix:\n",
"\n"
],
"text/plain": [
">>> Similarity Matrix:\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"Pred: 0 Pred: 1 Pred: 2\n", "\n" ], "text/plain": [ " Pred: \u001b[1;36m0\u001b[0m Pred: \u001b[1;36m1\u001b[0m Pred: \u001b[1;36m2\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
True: core 2.0 41.0 0.0\n", "\n" ], "text/plain": [ "\u001b[3;92mTrue\u001b[0m: core \u001b[1;36m2.0\u001b[0m \u001b[1;36m41.0\u001b[0m \u001b[1;36m0.0\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
True: edge 86.0 1.0 25.0\n", "\n" ], "text/plain": [ "\u001b[3;92mTrue\u001b[0m: edge \u001b[1;36m86.0\u001b[0m \u001b[1;36m1.0\u001b[0m \u001b[1;36m25.0\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
True: nc 24.0 7.0 4.0\n", "\n" ], "text/plain": [ "\u001b[3;92mTrue\u001b[0m: nc \u001b[1;36m24.0\u001b[0m \u001b[1;36m7.0\u001b[0m \u001b[1;36m4.0\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
True: transitory 28.0 20.0 5.0\n", "\n" ], "text/plain": [ "\u001b[3;92mTrue\u001b[0m: transitory \u001b[1;36m28.0\u001b[0m \u001b[1;36m20.0\u001b[0m \u001b[1;36m5.0\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
>>> Label Mapping:\n",
"{1: 'core', 0: 'edge', 2: 'transitory'}\n",
"\n"
],
"text/plain": [
">>> Label Mapping:\n",
"\u001b[1m{\u001b[0m\u001b[1;36m1\u001b[0m: \u001b[32m'core'\u001b[0m, \u001b[1;36m0\u001b[0m: \u001b[32m'edge'\u001b[0m, \u001b[1;36m2\u001b[0m: \u001b[32m'transitory'\u001b[0m\u001b[1m}\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
">>> ARI: 0.2514609622056457\n",
"\n"
],
"text/plain": [
">>> ARI: \u001b[1;36m0.2514609622056457\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
">>> NMI: 0.2950353059298418\n",
"\n"
],
"text/plain": [
">>> NMI: \u001b[1;36m0.2950353059298418\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
">>> F1-score: 0.4692121042163613\n",
"\n"
],
"text/plain": [
">>> F1-score: \u001b[1;36m0.4692121042163613\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
">>> Accuracy: 0.5432098765432098\n",
"\n"
],
"text/plain": [
">>> Accuracy: \u001b[1;36m0.5432098765432098\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"R[write to console]: __ __ \n",
" ____ ___ _____/ /_ _______/ /_\n",
" / __ `__ \\/ ___/ / / / / ___/ __/\n",
" / / / / / / /__/ / /_/ (__ ) /_ \n",
"/_/ /_/ /_/\\___/_/\\__,_/____/\\__/ version 6.1.1\n",
"Type 'citation(\"mclust\")' for citing this R package in publications.\n",
"\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"fitting ...\n",
" |======================================================================| 100%\n"
]
},
{
"data": {
"text/html": [
">>> Similarity Matrix:\n",
"\n"
],
"text/plain": [
">>> Similarity Matrix:\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"Pred: 0 Pred: 1 Pred: 2\n", "\n" ], "text/plain": [ " Pred: \u001b[1;36m0\u001b[0m Pred: \u001b[1;36m1\u001b[0m Pred: \u001b[1;36m2\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
True: core 0.0 42.0 1.0\n", "\n" ], "text/plain": [ "\u001b[3;92mTrue\u001b[0m: core \u001b[1;36m0.0\u001b[0m \u001b[1;36m42.0\u001b[0m \u001b[1;36m1.0\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
True: edge 25.0 2.0 85.0\n", "\n" ], "text/plain": [ "\u001b[3;92mTrue\u001b[0m: edge \u001b[1;36m25.0\u001b[0m \u001b[1;36m2.0\u001b[0m \u001b[1;36m85.0\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
True: nc 4.0 8.0 23.0\n", "\n" ], "text/plain": [ "\u001b[3;92mTrue\u001b[0m: nc \u001b[1;36m4.0\u001b[0m \u001b[1;36m8.0\u001b[0m \u001b[1;36m23.0\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
True: transitory 5.0 21.0 27.0\n", "\n" ], "text/plain": [ "\u001b[3;92mTrue\u001b[0m: transitory \u001b[1;36m5.0\u001b[0m \u001b[1;36m21.0\u001b[0m \u001b[1;36m27.0\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
>>> Label Mapping:\n",
"{1: 'core', 2: 'edge', 0: 'transitory'}\n",
"\n"
],
"text/plain": [
">>> Label Mapping:\n",
"\u001b[1m{\u001b[0m\u001b[1;36m1\u001b[0m: \u001b[32m'core'\u001b[0m, \u001b[1;36m2\u001b[0m: \u001b[32m'edge'\u001b[0m, \u001b[1;36m0\u001b[0m: \u001b[32m'transitory'\u001b[0m\u001b[1m}\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
">>> ARI: 0.25562096253427424\n",
"\n"
],
"text/plain": [
">>> ARI: \u001b[1;36m0.25562096253427424\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
">>> NMI: 0.2954294274015007\n",
"\n"
],
"text/plain": [
">>> NMI: \u001b[1;36m0.2954294274015007\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
">>> F1-score: 0.4691525868553842\n",
"\n"
],
"text/plain": [
">>> F1-score: \u001b[1;36m0.4691525868553842\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
">>> Accuracy: 0.5432098765432098\n",
"\n"
],
"text/plain": [
">>> Accuracy: \u001b[1;36m0.5432098765432098\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"SCC_alpha=0.25_reso=None_cut=FULL_hvg=3000_nei=6\n", "\n" ], "text/plain": [ "\u001b[33mSCC_alpha\u001b[0m=\u001b[1;36m0\u001b[0m\u001b[1;36m.\u001b[0m\u001b[33m25_reso\u001b[0m=\u001b[35mNone_cut\u001b[0m=\u001b[33mFULL_hvg\u001b[0m=\u001b[35m3000_nei\u001b[0m=\u001b[1;36m6\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "