Skip to content

Commit 1e8237e

Browse files
committed
Add notebook illustrating usage of new GNN stuff
1 parent 5117eea commit 1e8237e

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

examples/python-runtime.ipynb

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {
7+
"collapsed": true
8+
},
9+
"outputs": [],
10+
"source": [
11+
"DBID = \"beefbeef\"\n",
12+
"ENVIRONMENT = \"\"\n",
13+
"PASSWORD = \"\"\n",
14+
"\n",
15+
"from graphdatascience import GraphDataScience\n",
16+
"\n",
17+
"gds = GraphDataScience(\n",
18+
" f\"neo4j+s://{DBID}-{ENVIRONMENT}.databases.neo4j-dev.io/\", auth=(\"neo4j\", PASSWORD)\n",
19+
")\n",
20+
"gds.set_database(\"neo4j\")\n",
21+
"\n",
22+
"gds.gnn.nodeClassification.train(\"cora\", \"model\", [\"features\"], \"subject\", node_labels=[\"Paper\"])\n"
23+
]
24+
},
25+
{
26+
"cell_type": "code",
27+
"execution_count": null,
28+
"outputs": [],
29+
"source": [
30+
"try:\n",
31+
" gds.graph.load_cora()\n",
32+
"except:\n",
33+
" pass\n"
34+
],
35+
"metadata": {
36+
"collapsed": false
37+
}
38+
},
39+
{
40+
"cell_type": "code",
41+
"execution_count": null,
42+
"outputs": [],
43+
"source": [
44+
"gds.gnn.nodeClassification.train(\"cora\", \"model\", [\"features\"], \"subject\", node_labels=[\"Paper\"])\n"
45+
],
46+
"metadata": {
47+
"collapsed": false
48+
}
49+
},
50+
{
51+
"cell_type": "code",
52+
"execution_count": null,
53+
"outputs": [],
54+
"source": [
55+
"gds.gnn.nodeClassification.predict(\"cora\", \"model\", [\"features\"], \"subject\", node_labels=[\"Paper\"])"
56+
],
57+
"metadata": {
58+
"collapsed": false
59+
}
60+
}
61+
],
62+
"metadata": {
63+
"kernelspec": {
64+
"display_name": "Python 3",
65+
"language": "python",
66+
"name": "python3"
67+
},
68+
"language_info": {
69+
"codemirror_mode": {
70+
"name": "ipython",
71+
"version": 2
72+
},
73+
"file_extension": ".py",
74+
"mimetype": "text/x-python",
75+
"name": "python",
76+
"nbconvert_exporter": "python",
77+
"pygments_lexer": "ipython2",
78+
"version": "2.7.6"
79+
}
80+
},
81+
"nbformat": 4,
82+
"nbformat_minor": 0
83+
}

0 commit comments

Comments
 (0)