Skip to content

Commit 8c0b584

Browse files
committed
add results
1 parent 5649623 commit 8c0b584

7 files changed

+426
-0
lines changed

notebooks/draw_graphs.ipynb

+291
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,291 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"import matplotlib.pyplot as plt\n",
10+
"import pandas as pd\n",
11+
"\n",
12+
"%matplotlib inline"
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": 2,
18+
"metadata": {},
19+
"outputs": [],
20+
"source": [
21+
"df_raw = pd.read_csv('../results/over_smoothing.csv')\n",
22+
"models = ['GAT', 'GCN', 'MLP', 'g2-MLP']\n",
23+
"df = df_raw[['num_layers'] + models]"
24+
]
25+
},
26+
{
27+
"cell_type": "code",
28+
"execution_count": 3,
29+
"metadata": {},
30+
"outputs": [
31+
{
32+
"data": {
33+
"text/html": [
34+
"<div>\n",
35+
"<style scoped>\n",
36+
" .dataframe tbody tr th:only-of-type {\n",
37+
" vertical-align: middle;\n",
38+
" }\n",
39+
"\n",
40+
" .dataframe tbody tr th {\n",
41+
" vertical-align: top;\n",
42+
" }\n",
43+
"\n",
44+
" .dataframe thead th {\n",
45+
" text-align: right;\n",
46+
" }\n",
47+
"</style>\n",
48+
"<table border=\"1\" class=\"dataframe\">\n",
49+
" <thead>\n",
50+
" <tr style=\"text-align: right;\">\n",
51+
" <th></th>\n",
52+
" <th>GAT</th>\n",
53+
" <th>GCN</th>\n",
54+
" <th>MLP</th>\n",
55+
" <th>g2-MLP</th>\n",
56+
" </tr>\n",
57+
" <tr>\n",
58+
" <th>num_layers</th>\n",
59+
" <th></th>\n",
60+
" <th></th>\n",
61+
" <th></th>\n",
62+
" <th></th>\n",
63+
" </tr>\n",
64+
" </thead>\n",
65+
" <tbody>\n",
66+
" <tr>\n",
67+
" <th>4</th>\n",
68+
" <td>82.435234</td>\n",
69+
" <td>80.842844</td>\n",
70+
" <td>82.530775</td>\n",
71+
" <td>99.531331</td>\n",
72+
" </tr>\n",
73+
" <tr>\n",
74+
" <th>8</th>\n",
75+
" <td>85.084230</td>\n",
76+
" <td>80.693114</td>\n",
77+
" <td>82.970030</td>\n",
78+
" <td>99.662898</td>\n",
79+
" </tr>\n",
80+
" <tr>\n",
81+
" <th>12</th>\n",
82+
" <td>83.510422</td>\n",
83+
" <td>79.961670</td>\n",
84+
" <td>83.067067</td>\n",
85+
" <td>99.689350</td>\n",
86+
" </tr>\n",
87+
" <tr>\n",
88+
" <th>16</th>\n",
89+
" <td>79.539979</td>\n",
90+
" <td>78.262997</td>\n",
91+
" <td>83.080772</td>\n",
92+
" <td>99.699493</td>\n",
93+
" </tr>\n",
94+
" <tr>\n",
95+
" <th>20</th>\n",
96+
" <td>73.782353</td>\n",
97+
" <td>74.484533</td>\n",
98+
" <td>83.126373</td>\n",
99+
" <td>99.704700</td>\n",
100+
" </tr>\n",
101+
" <tr>\n",
102+
" <th>24</th>\n",
103+
" <td>73.514252</td>\n",
104+
" <td>72.801060</td>\n",
105+
" <td>83.102734</td>\n",
106+
" <td>99.700391</td>\n",
107+
" </tr>\n",
108+
" </tbody>\n",
109+
"</table>\n",
110+
"</div>"
111+
],
112+
"text/plain": [
113+
" GAT GCN MLP g2-MLP\n",
114+
"num_layers \n",
115+
"4 82.435234 80.842844 82.530775 99.531331\n",
116+
"8 85.084230 80.693114 82.970030 99.662898\n",
117+
"12 83.510422 79.961670 83.067067 99.689350\n",
118+
"16 79.539979 78.262997 83.080772 99.699493\n",
119+
"20 73.782353 74.484533 83.126373 99.704700\n",
120+
"24 73.514252 72.801060 83.102734 99.700391"
121+
]
122+
},
123+
"execution_count": 3,
124+
"metadata": {},
125+
"output_type": "execute_result"
126+
}
127+
],
128+
"source": [
129+
"df_mean = df.groupby(['num_layers']).agg('mean')\n",
130+
"df_mean"
131+
]
132+
},
133+
{
134+
"cell_type": "code",
135+
"execution_count": 4,
136+
"metadata": {},
137+
"outputs": [
138+
{
139+
"data": {
140+
"text/html": [
141+
"<div>\n",
142+
"<style scoped>\n",
143+
" .dataframe tbody tr th:only-of-type {\n",
144+
" vertical-align: middle;\n",
145+
" }\n",
146+
"\n",
147+
" .dataframe tbody tr th {\n",
148+
" vertical-align: top;\n",
149+
" }\n",
150+
"\n",
151+
" .dataframe thead th {\n",
152+
" text-align: right;\n",
153+
" }\n",
154+
"</style>\n",
155+
"<table border=\"1\" class=\"dataframe\">\n",
156+
" <thead>\n",
157+
" <tr style=\"text-align: right;\">\n",
158+
" <th></th>\n",
159+
" <th>GAT</th>\n",
160+
" <th>GCN</th>\n",
161+
" <th>MLP</th>\n",
162+
" <th>g2-MLP</th>\n",
163+
" </tr>\n",
164+
" <tr>\n",
165+
" <th>num_layers</th>\n",
166+
" <th></th>\n",
167+
" <th></th>\n",
168+
" <th></th>\n",
169+
" <th></th>\n",
170+
" </tr>\n",
171+
" </thead>\n",
172+
" <tbody>\n",
173+
" <tr>\n",
174+
" <th>4</th>\n",
175+
" <td>0.589346</td>\n",
176+
" <td>0.132747</td>\n",
177+
" <td>0.012823</td>\n",
178+
" <td>0.018307</td>\n",
179+
" </tr>\n",
180+
" <tr>\n",
181+
" <th>8</th>\n",
182+
" <td>0.538360</td>\n",
183+
" <td>0.322166</td>\n",
184+
" <td>0.012899</td>\n",
185+
" <td>0.008760</td>\n",
186+
" </tr>\n",
187+
" <tr>\n",
188+
" <th>12</th>\n",
189+
" <td>1.864513</td>\n",
190+
" <td>0.726863</td>\n",
191+
" <td>0.015326</td>\n",
192+
" <td>0.007406</td>\n",
193+
" </tr>\n",
194+
" <tr>\n",
195+
" <th>16</th>\n",
196+
" <td>3.812715</td>\n",
197+
" <td>1.609076</td>\n",
198+
" <td>0.018779</td>\n",
199+
" <td>0.013000</td>\n",
200+
" </tr>\n",
201+
" <tr>\n",
202+
" <th>20</th>\n",
203+
" <td>1.211128</td>\n",
204+
" <td>0.785786</td>\n",
205+
" <td>0.036188</td>\n",
206+
" <td>0.013964</td>\n",
207+
" </tr>\n",
208+
" <tr>\n",
209+
" <th>24</th>\n",
210+
" <td>1.111541</td>\n",
211+
" <td>0.675653</td>\n",
212+
" <td>0.017731</td>\n",
213+
" <td>0.006226</td>\n",
214+
" </tr>\n",
215+
" </tbody>\n",
216+
"</table>\n",
217+
"</div>"
218+
],
219+
"text/plain": [
220+
" GAT GCN MLP g2-MLP\n",
221+
"num_layers \n",
222+
"4 0.589346 0.132747 0.012823 0.018307\n",
223+
"8 0.538360 0.322166 0.012899 0.008760\n",
224+
"12 1.864513 0.726863 0.015326 0.007406\n",
225+
"16 3.812715 1.609076 0.018779 0.013000\n",
226+
"20 1.211128 0.785786 0.036188 0.013964\n",
227+
"24 1.111541 0.675653 0.017731 0.006226"
228+
]
229+
},
230+
"execution_count": 4,
231+
"metadata": {},
232+
"output_type": "execute_result"
233+
}
234+
],
235+
"source": [
236+
"df_std = df.groupby(['num_layers']).agg('std')\n",
237+
"df_std"
238+
]
239+
},
240+
{
241+
"cell_type": "code",
242+
"execution_count": 5,
243+
"metadata": {},
244+
"outputs": [],
245+
"source": [
246+
"fig = plt.figure(figsize=(15,10))\n",
247+
"for k in models:\n",
248+
" plt.errorbar(\n",
249+
" df_mean.index,\n",
250+
" df_mean[k],\n",
251+
" yerr=df_std[k],\n",
252+
" capsize=5, # エラーバーの横線の長さ\n",
253+
" label=k,\n",
254+
" )\n",
255+
"plt.title('Relationship between micro-F1 score on PPI dataset and number of layers.', fontsize=15)\n",
256+
"plt.xlabel('number of layers', fontsize=15)\n",
257+
"plt.ylabel('micro-f1 score on PPI dataset', fontsize=15)\n",
258+
"plt.xticks(df_mean.index, df_mean.index)\n",
259+
"plt.ylim(70, 100)\n",
260+
"plt.legend()\n",
261+
"fig.savefig('../results/over_smoothing.jpg')\n",
262+
"plt.close()"
263+
]
264+
}
265+
],
266+
"metadata": {
267+
"interpreter": {
268+
"hash": "53f4404ef9f7fdbb37798299073ec93abaa467fc0299b6ad19199a390e89e955"
269+
},
270+
"kernelspec": {
271+
"display_name": "Python 3.8.10 64-bit ('0203_internship-iouMVtx2': venv)",
272+
"language": "python",
273+
"name": "python3"
274+
},
275+
"language_info": {
276+
"codemirror_mode": {
277+
"name": "ipython",
278+
"version": 3
279+
},
280+
"file_extension": ".py",
281+
"mimetype": "text/x-python",
282+
"name": "python",
283+
"nbconvert_exporter": "python",
284+
"pygments_lexer": "ipython3",
285+
"version": "3.9.2"
286+
},
287+
"orig_nbformat": 4
288+
},
289+
"nbformat": 4,
290+
"nbformat_minor": 2
291+
}

0 commit comments

Comments
 (0)