From c1667fdedff18cbe168a7ae0c167b91ae4863f68 Mon Sep 17 00:00:00 2001 From: Pablo E Garcia-Nieto Date: Fri, 16 Jun 2023 16:18:27 -0600 Subject: [PATCH] run full notebook --- .../notebooks/experimental/pytorch.ipynb | 188 ++++++++++++++++-- 1 file changed, 175 insertions(+), 13 deletions(-) diff --git a/api/python/notebooks/experimental/pytorch.ipynb b/api/python/notebooks/experimental/pytorch.ipynb index 5af72e253..54b0fd873 100644 --- a/api/python/notebooks/experimental/pytorch.ipynb +++ b/api/python/notebooks/experimental/pytorch.ipynb @@ -347,7 +347,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "733ec2fb", "metadata": {}, "outputs": [ @@ -355,10 +355,11 @@ "name": "stdout", "output_type": "stream", "text": [ - "Epoch 1: Train Loss: 0.1156352 Accuracy 0.4472\n", - "Epoch 2: Train Loss: 0.1096967 Accuracy 0.7261\n", - "Epoch 3: Train Loss: 0.1082206 Accuracy 0.7729\n", - "Epoch 4: Train Loss: 0.1071653 Accuracy 0.8268\n" + "Epoch 1: Train Loss: 0.1156322 Accuracy 0.4494\n", + "Epoch 2: Train Loss: 0.1095988 Accuracy 0.7357\n", + "Epoch 3: Train Loss: 0.1089615 Accuracy 0.7300\n", + "Epoch 4: Train Loss: 0.1080885 Accuracy 0.7275\n", + "Epoch 5: Train Loss: 0.1101440 Accuracy 0.4220\n" ] } ], @@ -397,7 +398,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "d3e33edc", "metadata": {}, "outputs": [], @@ -417,10 +418,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "id": "00e12182", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "model.eval()\n", "\n", @@ -444,10 +456,25 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "id": "1cfff865", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "array(['basal cell', 'basal cell', 'basal cell', 'basal cell',\n", + " 'basal cell', 'basal cell', 'basal cell', 'basal cell',\n", + " 'basal cell', 'basal cell', 'basal cell', 'basal cell',\n", + " 'basal cell', 'basal cell', 'basal cell', 'basal cell'],\n", + " dtype=object)" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "cell_type_encoder = experiment_datapipe.obs_encoders()[\"cell_type\"]\n", "\n", @@ -466,10 +493,145 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "f4ac8087", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
actual cell typepredicted cell type
0epithelial cellbasal cell
1epithelial cellbasal cell
2epithelial cellbasal cell
3epithelial cellbasal cell
4epithelial cellbasal cell
5epithelial cellbasal cell
6epithelial cellbasal cell
7epithelial cellbasal cell
8epithelial cellbasal cell
9epithelial cellbasal cell
10epithelial cellbasal cell
11epithelial cellbasal cell
12epithelial cellbasal cell
13epithelial cellbasal cell
14epithelial cellbasal cell
15epithelial cellbasal cell
\n", + "
" + ], + "text/plain": [ + " actual cell type predicted cell type\n", + "0 epithelial cell basal cell\n", + "1 epithelial cell basal cell\n", + "2 epithelial cell basal cell\n", + "3 epithelial cell basal cell\n", + "4 epithelial cell basal cell\n", + "5 epithelial cell basal cell\n", + "6 epithelial cell basal cell\n", + "7 epithelial cell basal cell\n", + "8 epithelial cell basal cell\n", + "9 epithelial cell basal cell\n", + "10 epithelial cell basal cell\n", + "11 epithelial cell basal cell\n", + "12 epithelial cell basal cell\n", + "13 epithelial cell basal cell\n", + "14 epithelial cell basal cell\n", + "15 epithelial cell basal cell" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "import pandas as pd\n", "\n", @@ -506,7 +668,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.10.10" } }, "nbformat": 4,