Skip to content

Commit

Permalink
run full notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo-gar committed Jun 16, 2023
1 parent b546e81 commit c1667fd
Showing 1 changed file with 175 additions and 13 deletions.
188 changes: 175 additions & 13 deletions api/python/notebooks/experimental/pytorch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -347,18 +347,19 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"id": "733ec2fb",
"metadata": {},
"outputs": [
{
"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"
]
}
],
Expand Down Expand Up @@ -397,7 +398,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"id": "d3e33edc",
"metadata": {},
"outputs": [],
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -466,10 +493,145 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 13,
"id": "f4ac8087",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>actual cell type</th>\n",
" <th>predicted cell type</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>epithelial cell</td>\n",
" <td>basal cell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>epithelial cell</td>\n",
" <td>basal cell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>epithelial cell</td>\n",
" <td>basal cell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>epithelial cell</td>\n",
" <td>basal cell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>epithelial cell</td>\n",
" <td>basal cell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>epithelial cell</td>\n",
" <td>basal cell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>epithelial cell</td>\n",
" <td>basal cell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>epithelial cell</td>\n",
" <td>basal cell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>epithelial cell</td>\n",
" <td>basal cell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>epithelial cell</td>\n",
" <td>basal cell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>epithelial cell</td>\n",
" <td>basal cell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>epithelial cell</td>\n",
" <td>basal cell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>epithelial cell</td>\n",
" <td>basal cell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>epithelial cell</td>\n",
" <td>basal cell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>epithelial cell</td>\n",
" <td>basal cell</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>epithelial cell</td>\n",
" <td>basal cell</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"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",
Expand Down Expand Up @@ -506,7 +668,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.10.10"
}
},
"nbformat": 4,
Expand Down

0 comments on commit c1667fd

Please sign in to comment.