Skip to content

Commit

Permalink
add tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
inoue0426 committed Aug 30, 2024
1 parent 97361ed commit c702109
Showing 1 changed file with 159 additions and 0 deletions.
159 changes: 159 additions & 0 deletions Tutorial.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "premier-closing",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"import torch\n",
"\n",
"device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "documented-viewer",
"metadata": {},
"outputs": [],
"source": [
"import drGAT"
]
},
{
"cell_type": "markdown",
"id": "protected-regular",
"metadata": {},
"source": [
"# model evaluation"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "869740ff-e2fc-43b8-9a0f-49e637522ec4",
"metadata": {},
"outputs": [],
"source": [
"test = torch.load('test.pt')"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "favorite-saturday",
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"tmp = !ls | grep pt\n",
"device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n",
"model = torch.load('sample.pt', map_location=device)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "subject-allen",
"metadata": {},
"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>Accuracy</th>\n",
" <th>Precision</th>\n",
" <th>Recall</th>\n",
" <th>F1 Score</th>\n",
" <th>True Positive</th>\n",
" <th>True Negative</th>\n",
" <th>False Positive</th>\n",
" <th>False Negative</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0.771375</td>\n",
" <td>0.740881</td>\n",
" <td>0.783245</td>\n",
" <td>0.761474</td>\n",
" <td>1178</td>\n",
" <td>1312</td>\n",
" <td>412</td>\n",
" <td>326</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Accuracy Precision Recall F1 Score True Positive True Negative \\\n",
"0 0.771375 0.740881 0.783245 0.761474 1178 1312 \n",
"\n",
" False Positive False Negative \n",
"0 412 326 "
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"drGAT.eval(model, test)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "korean-recipe",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "drGAT",
"language": "python",
"name": "drgat"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

0 comments on commit c702109

Please sign in to comment.