{ "cells": [ { "cell_type": "markdown", "id": "authentic-stevens", "metadata": { "lines_to_next_cell": 0 }, "source": [ "# Matching the C. elegans connectomes\n", "Here we compare performance on matching the C. elegans male and hermaphrodite\n", "chemical connectomes. The connectomes have been reduced to the intersection of their\n", "largest connected components prior to loading in, so they share the same node set." ] }, { "cell_type": "code", "execution_count": 1, "id": "historic-emerald", "metadata": { "execution": { "iopub.execute_input": "2021-03-16T13:58:33.499334Z", "iopub.status.busy": "2021-03-16T13:58:33.498615Z", "iopub.status.idle": "2021-03-16T13:58:33.785169Z", "shell.execute_reply": "2021-03-16T13:58:33.784757Z" }, "tags": [ "hide-input" ] }, "outputs": [], "source": [ "import datetime\n", "import time\n", "\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", "import seaborn as sns\n", "from scipy.optimize import quadratic_assignment\n", "\n", "from pkg.data import load_c_elegans\n", "from pkg.gmp import quadratic_assignment_ot\n", "from pkg.io import savefig\n", "\n", "t0 = time.time()\n", "\n", "\n", "def stashfig(name, **kwargs):\n", " savefig(name, foldername=\"elegans\", print_out=False, **kwargs)" ] }, { "cell_type": "markdown", "id": "corporate-imagination", "metadata": {}, "source": [ "## Load the data" ] }, { "cell_type": "code", "execution_count": 2, "id": "welcome-distinction", "metadata": { "execution": { "iopub.execute_input": "2021-03-16T13:58:33.788139Z", "iopub.status.busy": "2021-03-16T13:58:33.787621Z", "iopub.status.idle": "2021-03-16T13:58:33.929214Z", "shell.execute_reply": "2021-03-16T13:58:33.929638Z" }, "tags": [ "hide-input" ] }, "outputs": [], "source": [ "male_adj, herm_adj, cell_names = load_c_elegans()" ] }, { "cell_type": "markdown", "id": "naked-skiing", "metadata": { "lines_to_next_cell": 0 }, "source": [ "## Run the graph matching experiment" ] }, { "cell_type": "code", "execution_count": 3, "id": "loaded-navigation", "metadata": { "execution": { "iopub.execute_input": "2021-03-16T13:58:33.935728Z", "iopub.status.busy": "2021-03-16T13:58:33.935100Z", "iopub.status.idle": "2021-03-16T14:08:37.026018Z", "shell.execute_reply": "2021-03-16T14:08:37.026432Z" }, "tags": [ "hide-input" ] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "603.042 seconds elapsed.\n" ] }, { "data": { "text/html": [ "
\n", " | col_ind | \n", "fun | \n", "nit | \n", "match_ratio | \n", "method | \n", "reg | \n", "
---|---|---|---|---|---|---|
0 | \n", "[355, 354, 66, 3, 4, 62, 6, 7, 8, 9, 10, 11, 1... | \n", "466202.0 | \n", "50 | \n", "0.657277 | \n", "vanilla | \n", "None | \n", "
1 | \n", "[289, 0, 275, 3, 281, 75, 10, 38, 8, 9, 285, 1... | \n", "413488.0 | \n", "22 | \n", "0.528169 | \n", "goat | \n", "100 | \n", "
2 | \n", "[42, 228, 2, 3, 4, 5, 6, 38, 8, 10, 285, 11, 1... | \n", "449849.0 | \n", "42 | \n", "0.591549 | \n", "goat | \n", "300 | \n", "
3 | \n", "[1, 163, 2, 3, 4, 267, 9, 38, 8, 10, 285, 12, ... | \n", "454419.0 | \n", "31 | \n", "0.586854 | \n", "goat | \n", "500 | \n", "
4 | \n", "[2, 163, 62, 3, 4, 75, 5, 38, 8, 10, 9, 12, 11... | \n", "469003.0 | \n", "38 | \n", "0.624413 | \n", "goat | \n", "700 | \n", "